Exemple #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')
Exemple #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)
Exemple #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
Exemple #4
0
 def test_calfeed_save_content(self):
     save_calfeed('testfile2', b'hi')
     cf = get_calfeed('testfile2')
     self.assertEqual(cf, 'hi')
Exemple #5
0
 def test_calfeed_save_and_get(self):
     save_calfeed('testfile1', b'')
     cf = get_calfeed('testfile1')
     self.assertEqual(cf, '')