Skip to content
Permalink
Browse files

Checkpoint of cffi/OD work.

  • Loading branch information...
cyrusdaboo committed Jun 18, 2015
1 parent ace9691 commit cb3f08fb2822ea456067500563704edefd4e87ec
Showing with 15 additions and 15 deletions.
  1. +5 −2 calendarserver/webcal/resource.py
  2. +1 −4 requirements-stable.txt
  3. +9 −9 twistedcaldav/localization.py
@@ -201,10 +201,13 @@ def queryValue(arg):


try:
from Foundation import NSTimeZone
from twext.platform.osx.utils import CFTimeZoneRef

def lookupSystemTimezone():
return NSTimeZone.localTimeZone().name().encode("utf-8")
try:
return CFTimeZoneRef.defaultTimeZoneName()
except:
return ""

except ImportError:
def lookupSystemTimezone():
@@ -36,7 +36,7 @@
#pyOpenSSL
pycrypto==2.6.1

--editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@14808#egg=twextpy
--editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/branches/users/cdaboo/cfod@14899#egg=twextpy
cffi==1.1.0
pycparser==2.13
#twisted
@@ -48,9 +48,6 @@
# [DAL] extra
sqlparse==0.1.14 # Compat issue in 0.1.15; fix before updating

# [OpenDirectory] extra
#pyobjc-framework-OpenDirectory # Use system module

# [Postgres] extra
pg8000==1.10.2

@@ -24,12 +24,12 @@
from locale import normalize

from twext.python.log import Logger

from pycalendar.duration import Duration

try:
from Foundation import (
NSPropertyListImmutable, NSPropertyListSerialization, NSData, NSLocale
)
from twext.platform.osx.corefoundation import CFError
from twext.platform.osx.utils import CFLocaleRef, CFDataRef, CFPropertyListRef
foundationImported = True
except ImportError:
foundationImported = False
@@ -444,16 +444,16 @@ def convertStringsFile(src, dest):
return

# Parse the binary plist .strings file:
parser = NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription_
data = NSData.dataWithContentsOfMappedFile_(src)
strings, format, error = parser(data, NSPropertyListImmutable, None, None)
if error:
data = CFDataRef.fromString(open(src).read())
try:
parsed = CFPropertyListRef.createFromData(data)
strings = parsed.toDict()
except CFError as error:
raise ParseError(error)

# The format of GNUtext MO files is described here:
# http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html

strings = dict(strings)
originals = strings.keys()
originals.sort()

@@ -538,7 +538,7 @@ def getLanguage(config):
return config.Localization.Language

try:
language = NSLocale.preferredLanguages()[0]
language = CFLocaleRef.preferredLanguages()[0]
language = _remapLanguageCode(language)
except:
language = "en"

0 comments on commit cb3f08f

Please sign in to comment.
You can’t perform that action at this time.