Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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})
)
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,
)
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)
def render_invite_common(values, request):
return render('voteit.core:templates/email/invite_common.pt', values, request = request)
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)
def latest_view(request):
latest = Idea.ideas_bunch(Idea.idea_id.desc(), with_joinedload=False)
return render('templates/latest.pt', {'latest': latest}, request)
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)
""" 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)
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()