我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用google.appengine.ext.ndb.TimeProperty()。
def from_json(self, request_data): """ Update entity with new data from json. check for data to transform, if needed, perform operations and assign values to respective properties in entity. :param request_data: :return: """ for property, value in request_data.iteritems(): prop_type = self._properties.get(property) if prop_type: prop_value = value if isinstance(prop_type, (ndb.DateProperty, ndb.DateTimeProperty, ndb.TimeProperty)): prop_value = utils.date_from_str(prop_type, prop_value) elif isinstance(prop_type, ndb.KeyProperty): prop_value = ndb.Key(urlsafe=prop_value) setattr(self, property, prop_value)
def encode_time_property(obj, prop, value): # PyAMF supports datetime.datetime objects and won't decide what date to # add to this time value. Users will have to figure it out themselves raise pyamf.EncodeError('ndb.TimeProperty is not supported by PyAMF')
def convert_TimeProperty(self, model, prop, kwargs): """Returns a form field for a ``ndb.TimeProperty``.""" if prop._auto_now or prop._auto_now_add: return None return f.DateTimeField(format='%H:%M:%S', **kwargs)
def convert_TimeProperty(self, model, prop, kwargs): """Returns a form field for a ``ndb.TimeProperty``.""" if prop._auto_now or prop._auto_now_add: return None kwargs.setdefault('format', '%H:%M:%S') return f.DateTimeField(**kwargs)