Exemple #1
0
    def _check_and_get_until(
        self,
        _request=None,
        ):
        if _request is None:
            _request = bottle.request

        until = _request.query.until
        if until != '':
            try:
                until = util.utc_from_iso8601(until)
                until = util.utc_to_local(until, naive=True)
            except ValueError:
                send_error(
                    code=400,
                    message='Invalid until parameter value',
                    )
            else:
                query = OrderedDict([
                        ('facebook.start_time', OrderedDict([
                                    ('$lte', until),
                                    ]),
                         ),
                        ])
                return query

        return None
Exemple #2
0
def test_utc_to_local_simple():
    dt = util.utc_to_local(
        datetime(2011, 11, 17, 2, 36, 06, 795119, tz.tzutc())
    )
    eq(dt,
       datetime(2011, 11, 16, 18, 36, 06, 795119, tz.tzlocal())
    )
Exemple #3
0
def test_utc_to_local_to_naive():
    dt = util.utc_to_local(
        datetime(2011, 11, 17, 2, 36, 06, 795119, tz.tzutc()),
        naive=True,
    )
    eq(dt,
       datetime(2011, 11, 16, 18, 36, 06, 795119)
    )