How to use the pyramid.renderers.render function in pyramid

To help you get started, we’ve selected a few pyramid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cseg-michigan / chez-betty / chezbetty / utility.py View on Github external
def notify_new_top_wall_of_shame(user):
    # First, double-check to make sure this user is in enough debt to be on the
    # wall of shame
    # TODO: This threshold should be a configurable parameter
    if user.balance > -5:
        print("Suppressed new wall of shame e-mail b/c user is under the limit")
        return
    send_email(
            TO=user.uniqname+'@umich.edu',
            SUBJECT='[Chez Betty] You are on top of the Wall of Shame! :(',
            body=render('templates/admin/email_new_top_wall_of_shame.jinja2',
                {'user': user})
            )
github mazvv / travelcrm / travelcrm / lib / scheduler / users.py View on Github external
def _render_mail(request, user, tmpl):
    user.password = gen_id()
    
    return render(
        'travelcrm:templates/users/%s' % tmpl,
        {
            'user': user, 
            'company_url': get_company_url(request)
        },
        request=request,
    )
github VoteIT / voteit.core / voteit / core / views / components / discussions.py View on Github external
meeting = find_interface(context, IMeeting)
    #FIXME: needs a way to set default value on this on creation of meeting
    truncate_length = meeting.get_field_value('truncate_discussion_length', 240)
        
    response = {}
    response['discussions'] = tuple(results)
    if limit and limit < count:
        response['over_limit'] = count - limit
    else:
        response['over_limit'] = 0
    response['limit'] = limit
    response['api'] = api
    response['show_delete'] = _show_delete
    response['truncate'] = truncate 
    response['truncate_length'] = truncate_length
    return render('../templates/discussions.pt', response, request = request)
github VoteIT / voteit.core / voteit / core / models / invite_ticket.py View on Github external
def render_invite_common(values, request):
    return render('voteit.core:templates/email/invite_common.pt', values, request = request)
github clld / clld / src / clld / web / adapters / csv.py View on Github external
def render(self, ctx, req):
        item = ctx.get_query(limit=1).first()
        fields = item.csv_head() if item else []
        cls = inspect(item).class_ if item else None
        doc = self.csvm_doc(
            req.url.replace('.csv-metadata.json', '.csv'),
            req,
            [(field, getattr(cls, field, None)) for field in fields])
        doc["dc:title"] = "{0} - {1}".format(req.dataset.name, ctx)
        return pyramid_render('json', doc, request=req)
github Pylons / shootout / shootout / views.py View on Github external
def latest_view(request):
    latest = Idea.ideas_bunch(Idea.idea_id.desc(), with_joinedload=False)
    return render('templates/latest.pt', {'latest': latest}, request)
github nive-cms / nive / nive / cms / cmsview / view.py View on Github external
def editBlockColumn(self, name=None, page=None, column=None):
        """
        Edit bar for columns
        if column is None the current context is used
        """
        if not page:
            page = self.context.page
        if not column:
            column=self.context
            if not IColumn.providedBy(column):
                if name:
                    column = page.GetColumn(name)
        if column != None:
            name = column.meta.get("title")
        return render("widgets/editblock_column.pt", 
                      {u"column":column, u"page": page, u"name": name, u"view":self}, 
                      request=self.request)
github VoteIT / voteit.core / voteit / core / models / invite_ticket.py View on Github external
""" Render invite ticket email html.
        Uses ticket as a context.
    """
    assert IInviteTicket.providedBy(ticket)
    #FIXME: Include meeting logo in mail?
    roles = dict(security.MEETING_ROLES)
    meeting = find_interface(ticket, IMeeting)
    root = find_root(meeting)
    assert IMeeting.providedBy(meeting)
    response = {'access_link': request.resource_url(meeting, 'ticket',
                                                    query={'email': ticket.email, 'token': ticket.token}),
                'message': message, 'meeting': meeting, 'context': ticket,
                'contact_mail': meeting.get_field_value('meeting_mail_address'),
                'sender_profile': root.users.get(ticket.sent_by), 'roles': [roles.get(x) for x in ticket.roles]}
    response['invite_common'] = render_invite_common(response, request)
    return render('voteit.core:templates/email/invite_ticket_email.pt', response, request = request)
github CCrypto / ccvpn2 / ccvpn / scripts / expire_mail.py View on Github external
def send_notice(user, mailer):
    body = render('mail/expiry.mako', {
        'user': user,
    })

    message = Message(subject='CCVPN: Account expiration',
                      recipients=[user.email],
                      body=body)
    mailer.send_immediately(message)

    user.last_expiry_notice = datetime.now()