Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Fixed created date issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrollins committed Jul 28, 2018
1 parent 8750c0b commit 3a049fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions shareplum/shareplum.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ def __init__(self, session, listName, url, verify_ssl, users, huge_tree, timeout
# self._disp_cols = {i['DisplayName']: {'name': i['Name'], 'type': i['Type']} for i in self.fields \
# if i['StaticName'] == 'Title' or i['SourceID'] != standard_source}
self.last_request = None
self.date_format = re.compile('\d+-\d+-\d+ \d+:\d+:\d+')

def _url(self, service):
"""Full SharePoint Service URL"""
Expand Down Expand Up @@ -371,8 +372,14 @@ def _python_type(self, key, value):
if field_type in ['Number', 'Currency']:
return float(value)
elif field_type == 'DateTime':
# Need to round datetime object
return datetime.strptime(value, '%Y-%m-%d %H:%M:%S').date()


# Need to remove the '123;#' from created dates, but we will do it for all dates
# self.date_format = re.compile('\d+-\d+-\d+ \d+:\d+:\d+')
value = self.date_format.search(value).group(0)

# NOTE: I used to round this just date (7/28/2018)
return datetime.strptime(value, '%Y-%m-%d %H:%M:%S')
elif field_type == 'Boolean':
if value == '1':
return 'Yes'
Expand Down
2 changes: 1 addition & 1 deletion shareplum/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.1'
__version__ = '0.2.0'

0 comments on commit 3a049fc

Please sign in to comment.