Beispiel #1
0
    def test_day_on_num(self):
        start_day = datetime.date(2008, 8, 8)
        days = []
        for day in day_on_num(start_day, 30):
            days.append(day)

        assert days[0] == '20080808'
        assert days[-1] == '20080709'
Beispiel #2
0
def show(request):
    from mongoengine.queryset import Q
    import re

    timeline = {"type":"default"}
    date = []

    k = 'timeline'
    if cache.get(k) is None:
        for day in day_on_num(datetime.date.today(), 30):
            count = Minutely.by_day_count(day)

            year = day[:4]
            month = day[4:6]
            day = day[6:]

            starttime = '%s-%s-%s' % (year, month, day)
            endtime = starttime
            url = '%s?starttime=%s&endtime=%s' % (reverse('loggit_newdomain_show'), starttime, endtime)

            date.append({
                "startDate":"%s,%s,%s" % (year, month, day),
                "endDate":"",
                "headline":'newdomain %s' % str(count),
                "text":"<p>newdomain</p>",
                "asset": {
                    "media":"<a href=%s>%s</a>" % (url, str(count)),
                    "credit":"",
                    "caption":""
                }
            })
        cache.set(k, date, settings.LOGGIT_TIMEOUT)

    timeline['date'] = cache.get(k)

    return {'timeline':timeline}