##// END OF EJS Templates
deform: use pypi deform library and add helpers to deform scope directly...
dan -
r519:aa445e7e default
parent child Browse files
Show More
@@ -572,14 +572,13 b''
572 572 };
573 573 };
574 574 deform = super.buildPythonPackage {
575 name = "deform-2.0a3.dev0";
575 name = "deform-2.0a2";
576 576 buildInputs = with self; [];
577 577 doCheck = false;
578 propagatedBuildInputs = with self; [Chameleon colander iso8601 peppercorn translationstring zope.deprecation];
579 src = fetchgit {
580 url = "https://github.com/Pylons/deform";
581 rev = "08fb9de077c76951f6e70e28d4bf060a209d3d39";
582 sha256 = "0nmhajc4pfgp4lbwhs5szqfzswpij1qyr69m7qkyhncl2g2d759r";
578 propagatedBuildInputs = with self; [Chameleon colander peppercorn translationstring zope.deprecation];
579 src = fetchurl {
580 url = "https://pypi.python.org/packages/8d/b3/aab57e81da974a806dc9c5fa024a6404720f890a6dcf2e80885e3cb4609a/deform-2.0a2.tar.gz";
581 md5 = "7a90d41f7fbc18002ce74f39bd90a5e4";
583 582 };
584 583 meta = {
585 584 license = [ { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ];
@@ -42,26 +42,35 b' for SELECT use formencode.All(OneOf(list'
42 42 """
43 43
44 44 import deform
45 import logging
46 import formencode
47
45 48 from pkg_resources import resource_filename
49 from formencode import All, Pipe
50
51 from pylons.i18n.translation import _
52
53 from rhodecode import BACKENDS
54 from rhodecode.lib import helpers
55 from rhodecode.model import validators as v
56
57 log = logging.getLogger(__name__)
58
46 59
47 60 deform_templates = resource_filename('deform', 'templates')
48 61 rhodecode_templates = resource_filename('rhodecode', 'templates/forms')
49 62 search_path = (rhodecode_templates, deform_templates)
50 63
51 deform.Form.set_zpt_renderer(search_path)
64
65 class RhodecodeFormZPTRendererFactory(deform.ZPTRendererFactory):
66 """ Subclass of ZPTRendererFactory to add rhodecode context variables """
67 def __call__(self, template_name, **kw):
68 kw['h'] = helpers
69 return self.load(template_name)(**kw)
52 70
53 71
54 import logging
55
56 import formencode
57 from formencode import All, Pipe
58
59 from pylons.i18n.translation import _
60
61 from rhodecode import BACKENDS
62 from rhodecode.model import validators as v
63
64 log = logging.getLogger(__name__)
72 form_renderer = RhodecodeFormZPTRendererFactory(search_path)
73 deform.Form.set_default_renderer(form_renderer)
65 74
66 75
67 76 def LoginForm():
@@ -38,7 +38,6 b''
38 38 </h2>
39 39 </div>
40 40 <div class="panel-body">
41 ## TODO: dan: find way to put h in the deform context properly
42 ${form.render(h=h) | n}
41 ${form.render() | n}
43 42 </div>
44 43 </div>
General Comments 0
You need to be logged in to leave comments. Login now