예제 #1
0
    def test_add(self):
        from models import Image
        Image.add(name="Hallo.img")

        img = Image.by_id(1)
        self.assertEqual(1, img.id)
        self.assertEqual("Hallo.img", img.name)
        self.assertEqual("hallo.img", img.route)
예제 #2
0
파일: views.py 프로젝트: daymien/pymyblog
 def view(self):
     request = self.request
     id = request.matchdict['id']
     image = Image.by_id(id)
     if image is None:
         return HTTPNotFound("No such image")
     return dict(
         image=image,
         pages=Page.all(),
         logged_in=authenticated_userid(self.request),
         )