Esempio n. 1
0
 def test_delete_calfeed(self):
     save_calfeed('testfile2', b'hi')
     cf = get_calfeed('testfile2')
     self.assertEqual(cf, 'hi')
     delete_calfeed('testfile2')
     with self.assertRaises(ValueError):
         cf = get_calfeed('testfile2')
Esempio n. 2
0
def calfeed(request, pk):
    try:
        if settings.DYNAMIC_CALFEED:
            # if the dynamic calfeed is set, just create the calfeed right now and return it
            tf = prepare_calfeed(Member.objects.get(cal_feed_id=pk))
        else:
            # if using the task queue, get the calfeed from the disk cache
            tf = get_calfeed(pk)
    except (ValueError, ValidationError):
        hr = HttpResponse()
        hr.status_code = 404
        return hr

    return HttpResponse(tf)
Esempio n. 3
0
def band_calfeed(request, pk):
    try:
        if settings.DYNAMIC_CALFEED:
            # if the dynamic calfeed is set, just create the calfeed right now and return it
            tf = prepare_band_calfeed(Band.objects.get(pub_cal_feed_id=pk))
        else:
            # if using the task queue, get the calfeed from the disk cache
            tf = get_calfeed(pk)
    except (ValueError, ValidationError):
        hr = HttpResponse()
        hr.status_code = 404
        return hr

    response = HttpResponse(tf)
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response
Esempio n. 4
0
 def test_calfeed_save_content(self):
     save_calfeed('testfile2', b'hi')
     cf = get_calfeed('testfile2')
     self.assertEqual(cf, 'hi')
Esempio n. 5
0
 def test_calfeed_save_and_get(self):
     save_calfeed('testfile1', b'')
     cf = get_calfeed('testfile1')
     self.assertEqual(cf, '')