Skip to content

Commit

Permalink
Resolved CMIS-309 so that cmislib maintains time zone info in dates r…
Browse files Browse the repository at this point in the history
…eturned from servers. Introduces a dependency on iso8601 module so the setup.py has been updated accordingly.

git-svn-id: https://svn.apache.org/repos/asf/chemistry/cmislib/trunk@1129927 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jpotts committed May 31, 2011
1 parent 3c1c6ce commit b7c91a4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .pydevproject
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ under the License.
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/cmislib/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH">
<path>/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/iso8601-0.1.4-py2.6.egg</path>
</pydev_pathproperty>
</pydev_project>
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
#

[egg_info]
tag_build =
tag_build = dev
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def read(fname):
name = "cmislib",
description = 'Apache Chemistry CMIS client library for Python',
version = version,
install_requires = [
'iso8601'
],
author = 'Apache Chemistry Project',
author_email = '[email protected]',
license = 'Apache License (2.0)',
Expand Down
2 changes: 1 addition & 1 deletion src/cmislib.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: cmislib
Version: 0.5
Version: 0.5dev
Summary: Apache Chemistry CMIS client library for Python
Home-page: http://chemistry.apache.org/
Author: Apache Chemistry Project
Expand Down
1 change: 1 addition & 0 deletions src/cmislib.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ src/cmislib.egg-info/NOTICE.txt
src/cmislib.egg-info/PKG-INFO
src/cmislib.egg-info/SOURCES.txt
src/cmislib.egg-info/dependency_links.txt
src/cmislib.egg-info/requires.txt
src/cmislib.egg-info/top_level.txt
src/data/checkedout.alfresco.xml
src/data/checkedout.filenet.xml
Expand Down
1 change: 1 addition & 0 deletions src/cmislib.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iso8601
12 changes: 2 additions & 10 deletions src/cmislib/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from xml.parsers.expat import ExpatError
import datetime
import time
import iso8601

# would kind of like to not have any parsing logic in this module,
# but for now I'm going to put the serial/deserialization in methods
Expand Down Expand Up @@ -81,10 +82,6 @@
UNFILED_COLL = 'unfiled'
ROOT_COLL = 'root'

# This seems to be the common pattern across known CMIS servers
# It is essentially ISO 8601 without the microseconds or time zone offset
timeStampPattern = re.compile('^(\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2})?')


class CmisClient(object):

Expand Down Expand Up @@ -3761,12 +3758,7 @@ def parseDateTimeValue(value):
"""
Utility function to return a datetime from a string.
"""
timeFormat = '%Y-%m-%dT%H:%M:%S'
match = timeStampPattern.match(value)
if match:
return datetime.datetime.fromtimestamp(time.mktime(time.strptime(
match.group(),
timeFormat)))
return iso8601.parse_date(value)


def parseBoolValue(value):
Expand Down

0 comments on commit b7c91a4

Please sign in to comment.