##// 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 deform = super.buildPythonPackage {
574 deform = super.buildPythonPackage {
575 name = "deform-2.0a3.dev0";
575 name = "deform-2.0a2";
576 buildInputs = with self; [];
576 buildInputs = with self; [];
577 doCheck = false;
577 doCheck = false;
578 propagatedBuildInputs = with self; [Chameleon colander iso8601 peppercorn translationstring zope.deprecation];
578 propagatedBuildInputs = with self; [Chameleon colander peppercorn translationstring zope.deprecation];
579 src = fetchgit {
579 src = fetchurl {
580 url = "https://github.com/Pylons/deform";
580 url = "https://pypi.python.org/packages/8d/b3/aab57e81da974a806dc9c5fa024a6404720f890a6dcf2e80885e3cb4609a/deform-2.0a2.tar.gz";
581 rev = "08fb9de077c76951f6e70e28d4bf060a209d3d39";
581 md5 = "7a90d41f7fbc18002ce74f39bd90a5e4";
582 sha256 = "0nmhajc4pfgp4lbwhs5szqfzswpij1qyr69m7qkyhncl2g2d759r";
583 };
582 };
584 meta = {
583 meta = {
585 license = [ { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ];
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 import deform
44 import deform
45 import logging
46 import formencode
47
45 from pkg_resources import resource_filename
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 deform_templates = resource_filename('deform', 'templates')
60 deform_templates = resource_filename('deform', 'templates')
48 rhodecode_templates = resource_filename('rhodecode', 'templates/forms')
61 rhodecode_templates = resource_filename('rhodecode', 'templates/forms')
49 search_path = (rhodecode_templates, deform_templates)
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
72 form_renderer = RhodecodeFormZPTRendererFactory(search_path)
55
73 deform.Form.set_default_renderer(form_renderer)
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__)
65
74
66
75
67 def LoginForm():
76 def LoginForm():
@@ -38,7 +38,6 b''
38 </h2>
38 </h2>
39 </div>
39 </div>
40 <div class="panel-body">
40 <div class="panel-body">
41 ## TODO: dan: find way to put h in the deform context properly
41 ${form.render() | n}
42 ${form.render(h=h) | n}
43 </div>
42 </div>
44 </div>
43 </div>
General Comments 0
You need to be logged in to leave comments. Login now