Commit edda80d4 by Don Mitchell

New style base python classes and basestring type.

parent 2767610e
...@@ -12,7 +12,7 @@ import re ...@@ -12,7 +12,7 @@ import re
import logging import logging
class CourseDetails: class CourseDetails(object):
def __init__(self, location): def __init__(self, location):
self.course_location = location # a Location obj self.course_location = location # a Location obj
self.start_date = None # 'start' self.start_date = None # 'start'
...@@ -79,8 +79,7 @@ class CourseDetails: ...@@ -79,8 +79,7 @@ class CourseDetails:
descriptor = get_modulestore(course_location).get_item(course_location) descriptor = get_modulestore(course_location).get_item(course_location)
dirty = False dirty = False
## ??? Will this comparison work?
if 'start_date' in jsondict: if 'start_date' in jsondict:
converted = jsdate_to_time(jsondict['start_date']) converted = jsdate_to_time(jsondict['start_date'])
else: else:
......
...@@ -4,7 +4,7 @@ import re ...@@ -4,7 +4,7 @@ import re
from util import converters from util import converters
class CourseGradingModel: class CourseGradingModel(object):
""" """
Basically a DAO and Model combo for CRUD operations pertaining to grading policy. Basically a DAO and Model combo for CRUD operations pertaining to grading policy.
""" """
......
class CourseRelativeMember: class CourseRelativeMember(object):
def __init__(self, location, idx): def __init__(self, location, idx):
self.course_location = location # a Location obj self.course_location = location # a Location obj
self.idx = idx # which milestone this represents. Hopefully persisted # so we don't have race conditions self.idx = idx # which milestone this represents. Hopefully persisted # so we don't have race conditions
......
...@@ -15,7 +15,7 @@ def jsdate_to_time(field): ...@@ -15,7 +15,7 @@ def jsdate_to_time(field):
""" """
if field is None: if field is None:
return field return field
elif isinstance(field, unicode) or isinstance(field, str): # iso format but ignores time zone assuming it's Z elif isinstance(field, basestring): # iso format but ignores time zone assuming it's Z
d=datetime.datetime(*map(int, re.split('[^\d]', field)[:6])) # stop after seconds. Debatable d=datetime.datetime(*map(int, re.split('[^\d]', field)[:6])) # stop after seconds. Debatable
return d.utctimetuple() return d.utctimetuple()
elif isinstance(field, int) or isinstance(field, float): elif isinstance(field, int) or isinstance(field, float):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment