Beispiel #1
0
def init_state(terms=None, tilds=None, timestamp=None):
    import sys
    reload(sys)
    sys.setdefaultencoding('utf-8')

    date = models.get_current_date(tilds)

    return {
        'terms'         : terms or '',
        'terms_v'       : terms or '',

        'tilds'         : tilds or '',
        'tilds_v'       : tilds or '',

        'timestamp'     : tools.to_timestamp(date) or timestamp or '',
        'timestamp_v'   : tools.to_verbose(d=date) or tools.to_verbose(t=timestamp) or ''
    }
Beispiel #2
0
    def get_json(self, tilds):
        context = { }

        try:
            date = models.get_current_date(tilds)

            context = {
                'tilds'         : tilds,
                'timestamp'     : tools.to_timestamp(date) or '',
                'timestamp_v'   : tools.to_verbose(d=date) or ''
            }

        except Exception as e:
            context['error'] = str(e)

        finally:
            tools.json_response(self, context)