MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / _convert_from_string

Method _convert_from_string

mongoengine/fields.py:655–666  ·  view source on GitHub ↗

Convert a string representation to a `datetime` object (the object you will manipulate). This is the reverse function of `_convert_from_datetime`. >>> a = '2011,06,08,20,26,24,092284' >>> ComplexDateTimeField()._convert_from_string(a) datetime.dateti

(self, data)

Source from the content-addressed store, hash-verified

653 return val.strftime(self.format)
654
655 def _convert_from_string(self, data):
656 """
657 Convert a string representation to a `datetime` object (the object you
658 will manipulate). This is the reverse function of
659 `_convert_from_datetime`.
660
661 >>> a = '2011,06,08,20,26,24,092284'
662 >>> ComplexDateTimeField()._convert_from_string(a)
663 datetime.datetime(2011, 6, 8, 20, 26, 24, 92284)
664 """
665 values = [int(d) for d in data.split(self.separator)]
666 return datetime.datetime(*values)
667
668 def __get__(self, instance, owner):
669 if instance is None:

Callers 2

__get__Method · 0.95
to_pythonMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected