示例#1
0
文件: views.py 项目: coriteh/pasto
    def get(self, request, identifier):
        note_id = utils.url_hash_decode(identifier)
        note = get_object_or_404(Note, pk=note_id)
        if note.is_private and note.user != request.user:
            return HttpResponseForbidden()

        context = dict(note=note)
        return render(request, 'pastoapp/note_view.html', context)
示例#2
0
文件: tests.py 项目: coriteh/pasto
 def test_decode_hash_to_int(self):
     self.assertEqual(int(utils.url_hash_decode('GeA')), 52615)
示例#3
0
文件: tests.py 项目: coriteh/pasto
 def test_decode_hash_to_string(self):
     self.assertEqual(utils.url_hash_decode('HTh'), '55372')