示例#1
0
 def wrap(cls, data):
     # If "Z" is missing because of the Aug 2014 migration, then add it.
     # cf. Group class
     last_modified = data.get('last_modified')
     if last_modified and dt_no_Z_re.match(last_modified):
         data['last_modified'] += 'Z'
     return super(Program, cls).wrap(data)
示例#2
0
 def wrap(cls, data):
     from corehq.apps.groups.models import dt_no_Z_re
     # If "Z" is missing because of the Aug 2014 migration, then add it.
     # cf. Group class
     last_modified = data.get('last_modified')
     if last_modified and dt_no_Z_re.match(last_modified):
         data['last_modified'] += 'Z'
     return super(Product, cls).wrap(data)
示例#3
0
 def wrap(cls, data):
     from corehq.apps.groups.models import dt_no_Z_re
     # If "Z" is missing because of the Aug 2014 migration, then add it.
     # cf. Group class
     last_modified = data.get('last_modified')
     if last_modified and dt_no_Z_re.match(last_modified):
         data['last_modified'] += 'Z'
     return super(Product, cls).wrap(data)
示例#4
0
 def wrap(cls, data):
     last_modified = data.get('last_modified')
     # if it's missing a Z because of the Aug. 2014 migration
     # that added this in iso_format() without Z, then add a Z
     # (See also Group class)
     from corehq.apps.groups.models import dt_no_Z_re
     if last_modified and dt_no_Z_re.match(last_modified):
         data['last_modified'] += 'Z'
     return super(Location, cls).wrap(data)
示例#5
0
 def wrap(cls, data):
     last_modified = data.get('last_modified')
     data.pop('location_type', None)  # Only store location type in SQL
     # if it's missing a Z because of the Aug. 2014 migration
     # that added this in iso_format() without Z, then add a Z
     # (See also Group class)
     from corehq.apps.groups.models import dt_no_Z_re
     if last_modified and dt_no_Z_re.match(last_modified):
         data['last_modified'] += 'Z'
     return super(Location, cls).wrap(data)
示例#6
0
    def wrap(cls, data):
        last_modified = data.get("last_modified")
        data.pop("location_type", None)  # Only store location type in SQL
        # if it's missing a Z because of the Aug. 2014 migration
        # that added this in iso_format() without Z, then add a Z
        # (See also Group class)
        from corehq.apps.groups.models import dt_no_Z_re

        if last_modified and dt_no_Z_re.match(last_modified):
            data["last_modified"] += "Z"
        return super(Location, cls).wrap(data)
示例#7
0
 def test_matches_seconds_no_z(self):
     matches = dt_no_Z_re.match("2019-11-25T09:26:19")
     self.assertIsNotNone(matches)
示例#8
0
 def test_not_matches_milliseconds_tz(self):
     matches = dt_no_Z_re.match("2019-11-25T09:26:19.357709+0530")
     self.assertIsNone(matches)