コード例 #1
0
def fetch_icals_test(request):


    set_namespace(get_namespace())
    logging.warning('namespace: %s'% get_namespace())
    try:
        logging.warning("Starting New Ical fetch thing")
        q=ICalendarSource.all().filter('status = ', 'approved')
        logging.warning(str(q))

        for cal in q:
                cal.fetch()
                logging.warning(str(cal))
    except Exception,e:
                logging.error("AHHHHHHHHHHHHHH Ical ting failed - %s in \n%s"% (traceback.format_exc(),str(request.POST)))
コード例 #2
0
ファイル: tasks.py プロジェクト: pombredanne/eventgrinder
def fetch_icals(request):
    try:
        if request.method == 'POST':
            cursor=request.POST.get('cursor')
            started=request.POST.get('started')
            parsed_started=parse(started)
            q=ICalendarSource.all().filter('status = ', 'approved').filter('last_fetch < ', parsed_started- relativedelta(hours=+3))
            if cursor:
                q=q.with_cursor(cursor)
            cals= q.fetch(1)
            if cals: 
                params={'cursor': q.cursor(),
                        'started': started}
                taskqueue.add(url='/sources/fetch/', params=params,)
            for ical in cals:
                try:
                    ical.fetch(started)
                except:
                    logging.warning("failed fetching %s" % ical.ical_href)
                    raise
                
    except Exception,e:
                logging.error("%s in \n%s"% (traceback.format_exc(),str(request.POST)))
コード例 #3
0
def fetch_icals(request):
    try:
        if request.method == 'POST':
            cursor=request.POST.get('cursor')
            started=request.POST.get('started')
            parsed_started=parse(started)
            q=ICalendarSource.all().filter('status = ', 'approved').filter('last_fetch < ', parsed_started- relativedelta(hours=+3))
            if cursor:
                q=q.with_cursor(cursor)
            cals= q.fetch(1)
            if cals:
                params={'cursor': q.cursor(),
                        'started': started}
                taskqueue.add(url='/sources/fetch/', params=params,)
            for ical in cals:
                try:
                    ical.fetch(started)
                except:
                    logging.warning("failed fetching %s" % ical.ical_href)
                    raise

    except Exception,e:
                logging.error("%s in \n%s"% (traceback.format_exc(),str(request.POST)))