Python google.appengine.ext.ndb.DateProperty() Examples
The following are 30
code examples of google.appengine.ext.ndb.DateProperty().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
google.appengine.ext.ndb
, or try the search function
.
Example #1
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #2
Source File: ndb.py From jbox with MIT License | 5 votes |
def convert_DateProperty(self, model, prop, kwargs): """Returns a form field for a ``ndb.DateProperty``.""" if prop._auto_now or prop._auto_now_add: return None return f.DateField(format='%Y-%m-%d', **kwargs)
Example #3
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #4
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #5
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #6
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #7
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #8
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #9
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #10
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #11
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #12
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #13
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #14
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #15
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #16
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #17
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #18
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #19
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #20
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #21
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #22
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #23
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #24
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #25
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #26
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now
Example #27
Source File: manager.py From tekton with MIT License | 5 votes |
def parse_property(p): name, type_alias = p.split(':') types = {'string': 'ndb.StringProperty(required=True)', 'date': 'ndb.DateProperty(required=True)', 'datetime': 'ndb.DateTimeProperty(required=True)', 'int': 'ndb.IntegerProperty(required=True)', 'float': 'ndb.FloatProperty(required=True)', 'decimal': 'property.SimpleDecimal(required=True)', 'currency': 'property.SimpleCurrency(required=True)', 'bool': 'ndb.BooleanProperty(required=True)'} return ' %s = %s' % (name, types[type_alias])
Example #28
Source File: manager.py From tekton with MIT License | 5 votes |
def _to_default_model_value(descriptor, name, index): if isinstance(descriptor, (StringProperty, TextProperty)): return "'%s_string'" % name if isinstance(descriptor, DateProperty): return "date(2014, 1, %s)" % (index + 1) if isinstance(descriptor, DateTimeProperty): return "datetime(2014, 1, 1, 1, %s, 0)" % (index + 1) if isinstance(descriptor, (SimpleCurrency, SimpleDecimal)): return "Decimal('1.%s')" % (index + 1 if index >= 9 else '0%s' % (index + 1)) if isinstance(descriptor, IntegerProperty): return "%s" % (index + 1) if isinstance(descriptor, FloatProperty): return "1.%s" % (index + 1) if isinstance(descriptor, BooleanProperty): return "True"
Example #29
Source File: manager.py From tekton with MIT License | 5 votes |
def _to_default_reques_value(descriptor, name, index): if isinstance(descriptor, (StringProperty, TextProperty)): return "'%s_string'" % name if isinstance(descriptor, DateProperty): return "'1/%s/2014'" % (index + 1) if isinstance(descriptor, DateTimeProperty): return "'1/1/2014 01:%s:0'" % (index + 1) if isinstance(descriptor, (SimpleCurrency, SimpleDecimal)): return "'1.%s'" % (index + 1 if index >= 9 else '0%s' % (index + 1)) if isinstance(descriptor, IntegerProperty): return "'%s'" % (index + 1) if isinstance(descriptor, FloatProperty): return "'1.%s'" % (index + 1) if isinstance(descriptor, BooleanProperty): return "'True'"
Example #30
Source File: test_case.py From luci-py with Apache License 2.0 | 5 votes |
def mock_now(test, now, seconds): """Mocks utcnow() and ndb properties. In particular handles when auto_now and auto_now_add are used. """ now = now + datetime.timedelta(seconds=seconds) test.mock(utils, 'utcnow', lambda: now) test.mock(ndb.DateTimeProperty, '_now', lambda _: now) test.mock(ndb.DateProperty, '_now', lambda _: now.date()) return now