コード例 #1
0
ファイル: forms.py プロジェクト: n1mh/gecoscc-ui
import deform

from pkg_resources import resource_filename

from pyramid.threadlocal import get_current_registry

from chef.exceptions import ChefServerError
from deform.template import ZPTRendererFactory

from gecoscc import messages
from gecoscc.i18n import gettext as _
from gecoscc.utils import get_chef_api, create_chef_admin_user

default_dir = resource_filename('deform', 'templates/')
gecoscc_dir = resource_filename('gecoscc', 'templates/deform/')
gecos_renderer = ZPTRendererFactory((gecoscc_dir, default_dir))


class GecosButton(deform.Button):
    def __init__(self,
                 name='_submit',
                 title=None,
                 type='submit',
                 value=None,
                 disabled=False,
                 css_class=None,
                 attrs=None):
        super(GecosButton, self).__init__(name=name,
                                          title=title,
                                          type=type,
                                          value=value,
コード例 #2
0
ファイル: renderer.py プロジェクト: lluc/autonomie
 def __call__(self, template_name, **kw):
     if "request" not in kw:
         kw['request'] = get_current_request()
     return ZPTRendererFactory.__call__(self, template_name, **kw)
コード例 #3
0
    def _makeOne(self, dirs, **kw):
        # Deform
        from deform.template import ZPTRendererFactory

        return ZPTRendererFactory(dirs, **kw)
コード例 #4
0
 def __call__(self, template_name, **kw):
     if "request" not in kw:
         kw['request'] = get_current_request()
     return ZPTRendererFactory.__call__(self, template_name, **kw)
コード例 #5
0
ファイル: __init__.py プロジェクト: timgates42/substanced
def get_deform_renderer(search_paths):
    return ZPTRendererFactory(search_paths, translator=translator)
コード例 #6
0
from horus.forms import SubmitForm
from horus.resources import RootFactory
import deform
from pyramid.httpexceptions import HTTPFound
from jobinator.models import DBSession, UserFilter, _, FACT_LIST, FactData, ScrapedData
from pyramid.i18n import get_locale_name
from pyramid_rpc.jsonrpc import jsonrpc_method

from pkg_resources import resource_filename
from deform.template import ZPTRendererFactory

import webhelpers.paginate as paginate
from sqlalchemy.orm import joinedload

dir = resource_filename('jobinator', 'templates/')
renderer = ZPTRendererFactory((dir, ))


def i18n_aware(func):
    def wrapper(request, *kv, **kw):
        get_locale_name(request)
        return func(request, *kv, **kw)

    return wrapper


@view_config(
    route_name='filter_add',
    #permission='filter_add',
    renderer='jobinator:templates/filter_add.mako')
@view_config(