• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python renderers.get_renderer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyramid.renderers.get_renderer函数的典型用法代码示例。如果您正苦于以下问题:Python get_renderer函数的具体用法?Python get_renderer怎么用?Python get_renderer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_renderer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_base_template

def add_base_template(event):
    main = get_renderer('templates/main.pt').implementation()
    generic_macros = get_renderer('templates/macro/generic_macros.pt').implementation()
    base_search = get_renderer('templates/base/search.pt').implementation()
    event.update({'main': main})
    event.update({'generic_macros': generic_macros})
    event.update({'base_search': base_search})
开发者ID:puittenbroek,项目名称:cister.db,代码行数:7,代码来源:subscribers.py


示例2: add_renderer

    def add_renderer(self, delivery_format, renderer_name):
        """
        Adds a matching to the render proxy's matching dict. It is possible to overwrite an existing one. If you do, a
        notice (warning) is printed to your server logs.

        :param delivery_format: The format string to which the renderer should be bound to (e.g. "json", "xml", ...)
        :type delivery_format: str
        :param renderer_name: The name of the renderer which was used to assign it to the pyramid applications
        configuration.
        :type renderer_name: str
        :raises: ConfigurationError
        """
        try:
            get_renderer(renderer_name)
            self._format_to_renderer[delivery_format] = renderer_name
            log.warning('You overwrite the renderer for the "{format_name}" format'.format(format_name=delivery_format))
        except ValueError, e:
            text = 'Adding mapping from format "{format_name}" to renderer "{renderer_name}" could not be completed. ' \
                   'The renderer "{renderer_name}" does not exist. Original error was: {error_txt}'.format(
                        format_name=delivery_format,
                        renderer_name=renderer_name,
                        error_txt=e
                    )
            log.warning(text)
            raise ConfigurationError()
开发者ID:vvmruder,项目名称:pyramid_rest,代码行数:25,代码来源:renderer.py


示例3: get_document

def get_document(context, request):
    path = request.path.split('/')
    if path[-1] == 'edit':
        docid = path[-2]
        doc = IDatabase(context).get_document(docid)
        return render_to_response(
            "templates/editdocument.pt",
            {
                'title': doc.title,
                'body': doc.display(edit=True),
                'save_url': doc.url + '/save',
                'formid': doc.form.id,
                'master': get_renderer('templates/master.pt').implementation(),
            },
            request)

    elif path[-1] == 'save':
        docid = path[-2]
        doc = IDatabase(context).get_document(docid)
        doc.save(request.params)
        return HTTPFound(
            location=doc.url
            )

    else:
        docid = path[-1]
        doc = IDatabase(context).get_document(docid)
        return render_to_response(
            "templates/opendocument.pt",
            {
                'title': doc.title,
                'body': doc.display(),
                'master': get_renderer('templates/master.pt').implementation(),
            },
            request)
开发者ID:plomino,项目名称:rapidosubstanced,代码行数:35,代码来源:views.py


示例4: add_base_template

def add_base_template(event):
    """Add base templates.
    """
    main = get_renderer('templates/indexLTE.pt').implementation()
    test = get_renderer('templates/main.pt').implementation()
    email_main = get_renderer('templates/email/main.pt').implementation()
    event.update({'main': main, 'test': test, 'email_main': email_main})
开发者ID:CellulaProject,项目名称:icc.cellula,代码行数:7,代码来源:subscribers.py


示例5: swordfish

def swordfish(context,request):
    logged_in = authenticated_userid(request)
    main = get_renderer('../templates/register.pt').implementation()
    if not 'god' in context:
        context["god"] = User("god", hashlib.sha1("eden".encode('UTF-8')).digest(), 777777, firstName = "Jesus", lastName = "Christ", email = "[email protected]", phone = "777-777-7707", gradYear = 2013, inductionYear = 0, isofficer=True, isadvisor=True); context["god"].__parent__ = context
        return {'red':'','main':get_renderer('../templates/register.pt').implementation(),'content':'And on the eighth day, Man created God','logged_in':authenticated_userid(request),'name':'Apotheosis Sucessful (:'}
    return {'red':'','main':get_renderer('../templates/register.pt').implementation(),'content':'You already have a God','logged_in':authenticated_userid(request),'name':'Apotheosis Failed D:'}
开发者ID:ellimistd,项目名称:yhsnhs,代码行数:7,代码来源:userviews.py


示例6: site_layout

def site_layout(level):
    if level == 'min':
        renderer = get_renderer("arsenalweb:templates/min_layout.pt")
    else:
        renderer = get_renderer("arsenalweb:templates/global_layout.pt")
    layout = renderer.implementation().macros['layout']
    return layout
开发者ID:CityGrid,项目名称:arsenal,代码行数:7,代码来源:__init__.py


示例7: patient_list_view

def patient_list_view(request):
    # get other templates that will be included via macros
    footer = get_renderer('../templates/va-footer.pt').implementation()
    logo = get_renderer('../templates/va-logo.pt').implementation()
    nav = get_renderer('../templates/va-navigation.pt').implementation()
    patientidentification = get_renderer('../templates/patient-identification.pt').implementation()
    return {'project': 'mmpspupc', 'footer': footer, 'logo': logo, 'nav': nav, 'patientidentification': patientidentification}
开发者ID:VHAINNOVATIONS,项目名称:GE-Pressure-Ulcer,代码行数:7,代码来源:views.py


示例8: edit_group

def edit_group(context, request):
    if 'id' in request.matchdict:
        try:
            group = DBSession().query(Group).get(request.matchdict.get('id'))
            is_new = False
        except SQLAlchemyError:
            raise HTTPNotFound
        if not group:
            raise HTTPNotFound
    else:
        group = Group()
        is_new = True

    schema = GroupSchema(after_bind=maybe_remove_fields).bind(request=request, group=group)
    form = deform.Form(schema, buttons=('zapisz', 'anuluj'), css_class=u'form-horizontal', requirements = ( ('bootstrap', None), ))
    js.deform.auto_need(form)

    if request.POST:
        if not 'zapisz' in request.POST:
            return HTTPFound(location='/groups/only_mine')
        items = request.POST.items()
        try:
            appstruct = form.validate(items)
        except deform.ValidationFailure, e:
            return {'form': e.render(),
                    'group_nav':  get_renderer('templates/group_macros.pt').implementation(),
                    'group': group,
                    'main':  get_renderer('templates/master.pt').implementation()}

        if 'activation_code' in request.POST:
            group.state = u'aktywna'
            request.session.flash({'title': u'Gotowe!',
                                    'body': u'Grupa %s została aktywowana.' % group.name},
                                    queue='success')
            return HTTPFound(location='/groups/%s' % group.id)
        if appstruct['logo']:
            logo = File()
            logo.filename = appstruct['logo']['filename']
            logo.mimetype = appstruct['logo']['mimetype']
            appstruct['logo']['fp'].seek(0)
            logo.data = appstruct['logo']['fp'].read()
            appstruct['logo']['fp'].seek(0,2)
            logo.size = appstruct['logo']['fp'].tell()
            appstruct['logo']['fp'].close()
            appstruct['logo'] = logo

        group = merge_session_with_post(group, appstruct)
        session = DBSession()
        session.add(group)
        if is_new:
            group.add_member(request.user, 'owner')
            request.session.flash({'title': u'Gotowe!',
                                    'body': u'Grupa %s została stworzona.' % group.name},
                                    queue='success')
        else:
            request.session.flash({'title': u'Gotowe!',
                                    'body': u'Grupa %s została zaktualizowana.' % group.name},
                                    queue='success')
        return HTTPFound(location='/groups/only_mine')
开发者ID:SzkolaCzytania,项目名称:szcz.app,代码行数:59,代码来源:forms.py


示例9: bridal_party

def bridal_party(request):
  if (request.host.startswith('localhost') or
      request.host.startswith('suralka')):
    bridal_party_renderer = 'templates/surag_bridal_party.pt'
    main = get_renderer('templates/surag_index.pt').implementation()
  else:
    bridal_party_renderer = 'templates/bridal_party2.pt'
    main = get_renderer('templates/index.pt').implementation()
  args = {'main': main}
  return render_to_response(bridal_party_renderer, args, request=request)
开发者ID:manisha503,项目名称:My-Wedding-Website,代码行数:10,代码来源:views.py


示例10: add_base_template

def add_base_template(event):
    """
    Expose the base template as per the Pyramid cookbook:

    https://docs.pylonsproject.org/projects/pyramid_cookbook/dev/templates.html#using-a-beforerender-event-to-expose-chameleon-base-template
    """
    base = get_renderer('templates/base.pt').implementation()
    event.update({'base': base})
    base = get_renderer('templates/base_bare.pt').implementation()
    event.update({'basebare': base})
开发者ID:jpslav,项目名称:oerpub.rhaptoslabs.swordpushweb,代码行数:10,代码来源:subscribers.py


示例11: our_story

def our_story(request):
  if (request.host.startswith('localhost') or
      request.host.startswith('suralka')):
    story_renderer = 'templates/surag_our_story.pt'
    main = get_renderer('templates/surag_index.pt').implementation()
  else:
    story_renderer = 'templates/our_story.pt'
    main = get_renderer('templates/index.pt').implementation()
  args = {'main': main}
  return render_to_response(story_renderer, args, request=request)
开发者ID:manisha503,项目名称:My-Wedding-Website,代码行数:10,代码来源:views.py


示例12: __init__

 def __init__(self, request):
     self.request = request
     self.context = request.context
     self.site = find_root(request.context)
     ## FIXME: could be reified (?)
     self.admin_layout = get_renderer(
         'petrel:templates/admin_layout.pt').implementation()
     self.admin_toolbar = get_renderer(
         'petrel:templates/toolbar.pt').implementation().macros['toolbar']
     self.context_url = request.resource_url(request.context)
     self.user_md = get_user_metadata(self.request)
开发者ID:dbaty,项目名称:Petrel,代码行数:11,代码来源:utils.py


示例13: __init__

    def __init__(self, context, request):
        self.context = context
        self.request = request
        renderer = get_renderer("../../../templates/layout.pt")
        self.layout = renderer.implementation().macros['layout']
        
        renderer = get_renderer("../../../templates/main.pt")
        self.main = renderer.implementation().macros['main']

        renderer = get_renderer("../../../templates/pbbd/nav.pt")
        self.nav = renderer.implementation().macros['nav']
开发者ID:Omnimusha,项目名称:openSIPKD,代码行数:11,代码来源:spops.py


示例14: add_templates

def add_templates(event):
    base = get_renderer('templates/base.pt').implementation()
    frontend = get_renderer('templates/frontend.pt').implementation()
    backend = get_renderer('templates/backend.pt').implementation()
    macros = get_renderer('templates/macros.pt').implementation()
    event.update({
        'base': base,
        'frontend': frontend,
        'backend': backend,
        'm': macros
    })
开发者ID:C3S,项目名称:collecting_society.portal,代码行数:11,代码来源:config.py


示例15: __init__

 def __init__(self, context, request):
     self.context = context
     self.request = request
     self.response = dict(
         api = self,
         form_resources = {},
         main_tpl_macro = get_renderer('templates/main.pt').implementation().macros['master'],
         view_content_tpl_macro = get_renderer('templates/view.pt').implementation().macros['view'],            
         resource_url = resource_url,
     )
     progress_main_css.need()
开发者ID:robinharms,项目名称:Progress,代码行数:11,代码来源:base.py


示例16: my_view

def my_view(request):
    # get other templates that will be included via macros
    footer = get_renderer('../templates/va-footer.pt').implementation()
    logo = get_renderer('../templates/va-logo.pt').implementation()
    nav = get_renderer('../templates/va-navigation.pt').implementation()
    try:
#         one = DBSession.query(MyModel).filter(MyModel.name == 'one').first()
        one = None
    except DBAPIError:
        return Response(conn_err_msg, content_type='text/plain', status_int=500)
    return {'one': one, 'project': 'mmpspupc', 'footer': footer, 'logo': logo, 'nav': nav}
开发者ID:VHAINNOVATIONS,项目名称:GE-Pressure-Ulcer,代码行数:11,代码来源:views.py


示例17: render

    def render(self):
        result = {}
        result['main_template'] = get_renderer(
                'penelope.core:skins/main_template.pt').implementation()
        result['main'] = get_renderer(
                'penelope.core.forms:templates/master.pt').implementation()

        schema = WizardSchema().clone()
        wizard_fanstatic.need()
        form = WizardForm(schema,
                          action=self.request.current_route_url(),
                          formid='wizard',
                          method='POST',
                          buttons=[
                                 SubmitButton(title=u'Submit'),
                                 ResetButton(title=u'Reset'),
                          ])
        form['new_users'].widget = SequenceWidget()
        form['users'].widget = SequenceWidget(min_len=1)

        users = DBSession.query(User).order_by(User.fullname)
        form['users']['user']['usernames'].widget.values = [('', '')] + \
                                      [(str(u.id), u.fullname) for u in users]

        roles = DBSession.query(Role).order_by(Role.name)
        form['users']['user']['role'].widget.values = [('', '')] + \
                                 [(str(role.id), role.name) for role in roles]
        form['new_users']['new_user']['role'].widget.values = [('', '')] + \
                [(str(role.id), role.name) for role in roles]

        form['milestones'].widget = SequenceWidget(min_len=1)
        form['contracts'].title = ''
        form['contracts']['customer_requests'].widget = SequenceWidget(min_len=3)

        controls = self.request.POST.items()
        if controls != []:
            try:
                appstruct = form.validate(controls)
                self.handle_save(form, appstruct)
            except ValidationFailure as e:
                result['form'] = e.render()
                return result

        appstruct = {}
        appstruct['contracts'] ={'customer_requests': []}
        appstruct['contracts']['customer_requests'].append({'ticket': True,
                                                            'title': u'Project management'})
        appstruct['contracts']['customer_requests'].append({'ticket': True,
                                                            'title': u'Analisi'})
        appstruct['contracts']['customer_requests'].append({'ticket': True,
                                                            'title': u'Supporto'})
        result['form'] = form.render(appstruct=appstruct)
        return result
开发者ID:zhangqiang99,项目名称:penelope.core,代码行数:53,代码来源:wizard.py


示例18: rsvp

def rsvp(request):
  right_sidebar = get_renderer('templates/right_sidebar.pt').implementation()
  if (request.host.startswith('localhost') or
      request.host.startswith('suralka')):
    rsvp_renderer = 'templates/surag_rsvp.pt'
    main = get_renderer('templates/surag_index.pt').implementation()
  else:
    rsvp_renderer = 'templates/rsvp.pt'
    main = get_renderer('templates/index.pt').implementation()
  args = {'main': main,
          'right_sidebar': right_sidebar}
  return render_to_response(rsvp_renderer, args, request=request)
开发者ID:manisha503,项目名称:My-Wedding-Website,代码行数:12,代码来源:views.py


示例19: assessment_wound_view

def assessment_wound_view(request):
    # get other templates that will be included via macros
    footer = get_renderer('../templates/va-footer.pt').implementation()
    logo = get_renderer('../templates/va-logo.pt').implementation()
    nav = get_renderer('../templates/va-navigation.pt').implementation()
    try:
        algorithm_id = DBSession.query(Algorithm.id).filter(func.lower(Algorithm.algorithm_name)=='assessment measure').scalar()
        experiment_id = DBSession.query(Experiment.id).filter(and_(Experiment.algorithm_id==algorithm_id, Experiment.default_flag==True)).scalar()
        patients = DBSession.query(PatientIdentification).all()
    except DBAPIError:
        return Response(conn_err_msg, content_type='text/plain', status_int=500)
    return {'patients': patients, 'algorithm_id':algorithm_id, 'experiment_id':experiment_id, 'project': 'mmpspupc', 'footer': footer, 'logo': logo, 'nav': nav}
开发者ID:VHAINNOVATIONS,项目名称:GE-Pressure-Ulcer,代码行数:12,代码来源:views.py


示例20: get_base_params

def get_base_params(view=None,
                    event=None,
                    request=None,
                    breadcrumbs=True,
                    globaltabs=True,
                    main=True,
                    apex=True,
                    login=True,
                    services_portlet=True,
                    banner=True):
    if event is not None:
        req = event['request']
        view = event['view']
    elif request is not None:
        req = request
    else:
        req = getattr(view, 'request', get_current_request())
    p = {}
    qs = dict(req.GET)
    qs.update(req.POST)
    if apex:
        p['apex_form'] =   get_renderer('apex:templates/forms/tableform.pt').implementation()
        p['apex_template'] =   get_renderer('apex:templates/apex_template.pt').implementation()
    if banner:     p['banner'] =      get_renderer('../templates/includes/banner.pt').implementation()
    if globaltabs: p['globaltabs'] =  get_renderer('../templates/includes/globaltabs.pt').implementation()
    if breadcrumbs:p['breadcrumbs'] = get_renderer('../templates/includes/breadcrumbs.pt').implementation()
    if main:       p['main'] =        get_renderer('../templates/master.pt').implementation()
    ########################### PORTLETS STUFF
    if login:
        if not 'came_from' in req.GET:
            if request is not None:
                userid = unauthenticated_userid(req)
                if not userid:
                    req.GET['came_from'] = req.url
        login_params = apex_views.login(req)
        if not isinstance(login_params, HTTPFound):
            login_params['include_came_from'] = True
            login_params['self_register'] = authm.self_registration()
            p['login_params'] = login_params
        else:
            p['login_params'] = {}
        p['login_form'] = get_renderer('apex:templates/apex_template.pt').implementation()
        p['login'] = get_renderer('../templates/includes/login.pt').implementation()
    if services_portlet:
        p['services'] = get_renderer('../templates/includes/services.pt').implementation()
        p['classifications_service_treeview_url'] = req.resource_url(req.root) + '@@classifications_services_treeview'
        p['packages_service_treeview_url'] = req.resource_url(req.root) + '@@packages_services_treeview'
    p['u'] = req.resource_url
    p['root'] = getattr(req, 'root', None)
    p['get_globaltabs'] = get_globaltabs
    p['services_portlet'] = services_portlet
    p['get_breadcrumbs'] = get_breadcrumbs
    p['static'] = req.static_url('mobyle2.core:static/')[:-1]
    p['dstatic'] = req.static_url('deform:static/')[:-1]
    p['c'] = getattr(req, 'context', None)
    p['request'] = req
    return p
开发者ID:mobyle2-legacy,项目名称:mobyle2.core,代码行数:57,代码来源:__init__.py



注:本文中的pyramid.renderers.get_renderer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python renderers.render函数代码示例发布时间:2022-05-27
下一篇:
Python registry.Registry类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap