Commits

Atsushi Odagiri committed 4ac09db

garden

  • Participants
  • Parent commits 2e5ba09

Comments (0)

Files changed (4)

     paster
     formalchemy
     test_fw
+    fanstatic
 develop = 
     models
     sprox
 scripts =
     paster
 
+[fanstatic]
+recipe = zc.recipe.egg
+eggs = 
+    webob
+    fanstatic
+    js.jqueryui
+interpreter = fanstapy

fanstatic_demo.py

+from fanstatic import Fanstatic
+from js.jqueryui import jqueryui
+from webob import Response
+from webob.dec import wsgify
+
+body = """\
+<html>
+<head>
+</head>
+<body>
+Hello
+</body>
+</html>
+"""
+@wsgify
+def app(request):
+    jqueryui.need()
+    return Response(body)
+
+app = Fanstatic(app)
+
+from wsgiref import simple_server
+
+httpd = simple_server.make_server('', 8081, app)
+httpd.serve_forever()
+

formalchemy/pyconjp2011/formalchemy_demo/__init__.py

 class UserForm(FieldSet):
     def __init__(self, **kw):
         super(UserForm, self).__init__(model=models.User, **kw)
-        self.user_name.required()
-        self.add(Field('password').password().required())
+        self.insert_after(self.user_name, 
+                Field('password').password().required())
         self.configure(exclude=[self._password])
 
 user_form = UserForm(session=models.DBSession)

sprox/pyconjp2011/sprox_demo/__init__.py

     __model__ = models.User
     __require_fields__ = ['user_name']
     __omit_fields__ = ['_password']
+    __field_order__ = ['user_name', 'password', 'groups']
 
-    user_image = tw.forms.FileField('user_image')
     password = tw.forms.PasswordField('password', 
                                       validator=tw.forms.validators.NotEmpty)