本文整理汇总了Python中zkpylons.lib.base.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: new
def new(self):
if c.cfp_status == 'closed':
if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
return render("proposal/closed.mako")
elif c.cfp_status == 'not_open':
return render("proposal/not_open.mako")
c.person = h.signed_in_person()
h.check_for_incomplete_profile(c.person)
defaults = {
'proposal.type': 1,
'proposal.video_release': 1,
'proposal.slides_release': 1,
'proposal.travel_assistance' : 1,
'proposal.accommodation_assistance' : 1,
'person.name': c.person.firstname + " " + c.person.lastname,
'person.mobile': c.person.mobile,
'person.experience': c.person.experience,
'person.bio': c.person.bio,
'person.url': c.person.url,
}
defaults['person_to_edit'] = c.person.id
defaults['name'] = c.person.firstname + " " + c.person.lastname
form = render("proposal/new.mako")
return htmlfill.render(form, defaults)
开发者ID:PaulWay,项目名称:zookeepr,代码行数:26,代码来源:proposal.py
示例2: _edit
def _edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.paper_editing == 'closed' and not h.auth.authorized(h.auth.has_late_submitter_role):
return render("proposal/editing_closed.mako")
elif c.paper_editing == 'not_open':
return render("proposal/editing_not_open.mako")
c.proposal = Proposal.find_by_id(id)
for key in self.form_result['proposal']:
setattr(c.proposal, key, self.form_result['proposal'][key])
c.proposal.abstract = self.clean_abstract(c.proposal.abstract)
c.person = self.form_result['person_to_edit']
if (c.person.id == h.signed_in_person().id or
h.auth.authorized(h.auth.has_organiser_role)):
for key in self.form_result['person']:
setattr(c.person, key, self.form_result['person'][key])
p_edit = "and author"
else:
p_edit = "(but not author)"
meta.Session.commit()
if lca_info['proposal_update_email'] != '':
body = "Subject: %s Proposal Updated\n\nID: %d\nTitle: %s\nType: %s\nURL: %s" % (h.lca_info['event_name'], c.proposal.id, c.proposal.title, c.proposal.type.name.lower(), "http://" + h.host_name() + h.url_for(action="view"))
email(lca_info['proposal_update_email'], body)
h.flash("Proposal %s edited!"%p_edit)
return redirect_to('/proposal')
开发者ID:PaulWay,项目名称:zookeepr,代码行数:35,代码来源:proposal.py
示例3: new
def new(self):
# call for miniconfs has closed
if c.cfmini_status == 'closed':
return render("proposal/closed_mini.mako")
elif c.cfmini_status == 'not_open':
return render("proposal/not_open_mini.mako")
c.proposal_type = ProposalType.find_by_name('Miniconf')
c.person = h.signed_in_person()
h.check_for_incomplete_profile(c.person)
defaults = {
'proposal.type': c.proposal_type.id,
'proposal.technical_requirements': "",
'proposal.accommodation_assistance': 1,
'proposal.travel_assistance': 1,
'proposal.video_release': 0,
'proposal.slides_release': 0,
'person.name' : c.person.firstname + " " + c.person.lastname,
'person.mobile' : c.person.mobile,
'person.experience' : c.person.experience,
'person.bio' : c.person.bio,
}
form = render("proposal/new_mini.mako")
return htmlfill.render(form, defaults)
开发者ID:Secko,项目名称:zookeepr,代码行数:26,代码来源:miniconf_proposal.py
示例4: _new
def _new(self):
person_results = self.form_result['person']
proposal_results = self.form_result['proposal']
attachment_results = self.form_result['attachment']
proposal_results['status'] = ProposalStatus.find_by_name('Pending')
c.proposal = Proposal(**proposal_results)
meta.Session.add(c.proposal)
if not h.signed_in_person():
c.person = model.Person(**person_results)
meta.Session.add(c.person)
email(c.person.email_address, render('/person/new_person_email.mako'))
else:
c.person = h.signed_in_person()
for key in person_results:
setattr(c.person, key, self.form_result['person'][key])
c.person.proposals.append(c.proposal)
if attachment_results is not None:
c.attachment = Attachment(**attachment_results)
c.proposal.attachments.append(c.attachment)
meta.Session.add(c.attachment)
meta.Session.commit()
email(c.person.email_address, render('proposal/thankyou_mini_email.mako'))
h.flash("Proposal submitted!")
return redirect_to(controller='proposal', action="index", id=None)
开发者ID:Secko,项目名称:zookeepr,代码行数:31,代码来源:miniconf_proposal.py
示例5: new
def new(self):
c.signed_in_person = h.signed_in_person()
c.events = Event.find_all()
c.schedule = Schedule.find_all()
c.time_slot = TimeSlot.find_all()
if not c.signed_in_person.registration:
return render('/vote/no_rego.mako')
c.votes = Vote.find_by_rego(c.signed_in_person.registration.id)
defaults = {
'vote.vote_value': 1
}
args = request.GET
eventid = args.get('eventid',0)
revoke = args.get('revoke',0)
c.eventid = eventid
if int(eventid) != 0 and c.votes.count() < 4 and revoke == 0:
c.vote = Vote()
c.vote.rego_id = c.signed_in_person.registration.id
c.vote.vote_value = 1
c.vote.event_id = eventid
meta.Session.add(c.vote)
meta.Session.commit()
if int(eventid) != 0 and int(revoke) != 0:
c.vote = Vote.find_by_event_rego(eventid,c.signed_in_person.registration.id)
meta.Session.delete(c.vote)
meta.Session.commit()
redirect_to('new')
form = render('/vote/new.mako')
return htmlfill.render(form, defaults)
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:31,代码来源:vote.py
示例6: _new
def _new(self):
if c.funding_status == 'closed':
return render("funding/closed.mako")
elif c.funding_status == 'not_open':
return render("funding/not_open.mako")
funding_results = self.form_result['funding']
attachment_results1 = self.form_result['attachment']
c.person = h.signed_in_person()
c.funding = Funding(**funding_results)
c.funding.status = FundingStatus.find_by_name('Pending')
c.funding.person = c.person
if not c.funding.type.available():
return render("funding/type_unavailable.mako")
meta.Session.add(c.funding)
if attachment_results1 is not None:
attachment = FundingAttachment(**attachment_results1)
c.funding.attachments.append(attachment)
meta.Session.add(attachment)
meta.Session.commit()
email(c.funding.person.email_address, render('funding/thankyou_email.mako'))
h.flash("Funding submitted!")
return redirect_to(controller='funding', action="index", id=None)
开发者ID:noisymime,项目名称:zookeepr,代码行数:30,代码来源:funding.py
示例7: _new
def _new(self):
# Do we allow account creation?
if Config.get('account_creation'):
"""Create a new person submit.
"""
# Remove fields not in class
results = self.form_result['person']
del results['password_confirm']
c.person = Person(**results)
c.person.email_address = c.person.email_address.lower()
meta.Session.add(c.person)
#for sn in self.form_result['social_network']:
# network = SocialNetwork.find_by_name(sn['name'])
# if sn['account_name']:
# c.person.social_networks[network] = sn['account_name']
meta.Session.commit()
if Config.get('confirm_email_address', category='rego') == 'no':
redirect_to(controller='person', action='confirm', confirm_hash=c.person.url_hash)
else:
email(c.person.email_address, render('/person/new_person_email.mako'))
# return render('/person/thankyou.mako')
return self.finish_login(c.person.email_address)
else:
return render('/not_allowed.mako')
开发者ID:iseppi,项目名称:zookeepr,代码行数:28,代码来源:person.py
示例8: edit
def edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_funding_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.funding_editing == 'closed':
return render("funding/editing_closed.mako")
elif c.funding_editing == 'not_open':
return render("funding/editing_not_open.mako")
c.funding = Funding.find_by_id(id)
defaults = {}
defaults.update(h.object_to_defaults(c.funding, 'funding'))
# This is horrible, don't know a better way to do it
if c.funding.type:
defaults['funding.type'] = defaults['funding.funding_type_id']
if c.funding.male:
defaults['funding.male'] = 1
else:
defaults['funding.male'] = 0
form = render('/funding/edit.mako')
return htmlfill.render(form, defaults)
开发者ID:Ivoz,项目名称:zookeepr,代码行数:26,代码来源:funding.py
示例9: _forgotten_password
def _forgotten_password(self):
"""Action to let the user request a password change.
GET returns a form for emailing them the password change
confirmation.
POST checks the form and then creates a confirmation record:
date, email_address, and a url_hash that is a hash of a
combination of date, email_address, and a random nonce.
The email address must exist in the person database.
The second half of the password change operation happens in
the ``confirm`` action.
"""
c.email = self.form_result['email_address']
c.person = Person.find_by_email(c.email)
if c.person is not None:
# Check if there is already a password recovery in progress
reset = PasswordResetConfirmation.find_by_email(c.email)
if reset is not None:
return render('person/in_progress.mako')
# Ok kick one off
c.conf_rec = PasswordResetConfirmation(email_address=c.email)
meta.Session.add(c.conf_rec)
meta.Session.commit()
email(c.email, render('person/confirmation_email.mako'))
return render('person/password_confirmation_sent.mako')
开发者ID:iseppi,项目名称:zookeepr,代码行数:32,代码来源:person.py
示例10: _edit
def _edit(self, id):
# We need to recheck auth in here so we can pass in the id
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_funding_submitter(id), h.auth.has_organiser_role)):
# Raise a no_auth error
h.auth.no_role()
if not h.auth.authorized(h.auth.has_organiser_role):
if c.funding_editing == 'closed':
return render("funding/editing_closed.mako")
elif c.funding_editing == 'not_open':
return render("funding/editing_not_open.mako")
if self.form_result['funding']['male'] == 1:
self.form_result['funding']['male'] = True
elif self.form_result['funding']['male'] == 0:
self.form_result['funding']['male'] = False
c.funding = Funding.find_by_id(id)
for key in self.form_result['funding']:
setattr(c.funding, key, self.form_result['funding'][key])
c.person = c.funding.person
meta.Session.commit()
h.flash("Funding for %s edited!"%c.person.firstname)
return redirect_to('/funding')
开发者ID:Ivoz,项目名称:zookeepr,代码行数:27,代码来源:funding.py
示例11: _check_invoice
def _check_invoice(self, person, invoice, ignore_overdue = False):
c.invoice = invoice
if person.invoices:
if invoice.is_paid or len(invoice.bad_payments) > 0:
c.status = []
if invoice.total==0:
c.status.append('zero balance')
if len(invoice.good_payments) > 0:
c.status.append('paid')
if len(invoice.good_payments)>1:
c.status[-1] += ' (%d times)' % len(invoice.good_payments)
if len(invoice.bad_payments) > 0:
c.status.append('tried to pay')
if len(invoice.bad_payments)>1:
c.status[-1] += ' (%d times)' % len(invoice.bad_payments)
c.status = ' and '.join(c.status)
return render('/invoice/already.mako')
if invoice.is_void:
c.signed_in_person = h.signed_in_person()
return render('/invoice/invalid.mako')
if not ignore_overdue and invoice.is_overdue:
for ii in invoice.items:
if ii.product and not ii.product.available():
return render('/invoice/expired.mako')
return None # All fine
开发者ID:n6151h,项目名称:pyconau2016,代码行数:27,代码来源:invoice.py
示例12: pay
def pay(self, id):
"""Request confirmation from user
"""
invoice = Invoice.find_by_id(id, True)
person = invoice.person
if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_user(person.id), h.auth.has_organiser_role, h.auth.has_unique_key())):
# Raise a no_auth error
h.auth.no_role()
#return render('/registration/really_closed.mako')
error = self._check_invoice(person, invoice)
if error is not None:
return error
c.payment = Payment()
c.payment.amount = invoice.total
c.payment.invoice = invoice
meta.Session.commit()
if c.payment.gateway == 'securepay':
return render("/invoice/securepay.mako")
else:
return render("/invoice/payment.mako")
开发者ID:noisymime,项目名称:zookeepr,代码行数:25,代码来源:invoice.py
示例13: new
def new(self):
if c.cfp_status == 'closed':
if not h.auth.authorized(h.auth.Or(h.auth.has_organiser_role, h.auth.has_late_submitter_role)):
return render("proposal/closed.mako")
elif c.cfp_status == 'not_open':
return render("proposal/not_open.mako")
c.person = h.signed_in_person()
h.check_for_incomplete_profile(c.person)
defaults = {
'proposal.type': 1,
'proposal.video_release': 1,
'proposal.slides_release': 1,
'proposal.travel_assistance' : 1,
'proposal.accommodation_assistance' : 1,
'person.name': c.person.fullname,
'person.phone': c.person.phone,
'person.experience': c.person.experience,
'person.bio': c.person.bio,
'person.url': c.person.url,
}
defaults['person_to_edit'] = c.person.id
defaults['name'] = c.person.fullname
defaults['proposal.event_targets'] = [et.id for et in ProposalEventTarget.find_all()]
log.debug("new eventtar: {}".format(defaults['proposal.event_targets']))
form = render("proposal/new.mako")
return htmlfill.render(form, defaults)
开发者ID:n6151h,项目名称:pyconau2016,代码行数:29,代码来源:proposal.py
示例14: table
def table(self, day=None):
filter = dict(request.GET)
if len(c.scheduled_dates) == 0:
return render('/schedule/no_schedule_available.mako')
c.display_date = None
available_days = {}
for scheduled_date in c.scheduled_dates:
available_days[scheduled_date.strftime('%A').lower()] = scheduled_date
if day in available_days:
c.display_date = available_days[day]
if c.display_date is None:
if date.today() in c.scheduled_dates:
c.display_date = date.today()
else:
c.display_date = c.scheduled_dates[0]
c.time_slots = TimeSlot.find_by_date(c.display_date)
c.primary_times = {}
for time_slot in TimeSlot.find_by_date(c.display_date, primary=True):
c.primary_times[time_slot.start_time] = time_slot
event_type = EventType.find_by_name('presentation')
c.locations = Location.find_scheduled_by_date_and_type(c.display_date, event_type)
event_type = EventType.find_by_name('mini-conf')
c.locations = c.locations + Location.find_scheduled_by_date_and_type(c.display_date, event_type)
c.schedule_collection = Schedule.find_by_date(c.display_date)
c.time_increment = timedelta(minutes=5)
c.programme = OrderedDict()
for time_slot in c.time_slots:
time = time_slot.start_time
while time < time_slot.end_time:
c.programme[time] = {}
time = time + c.time_increment
for schedule in c.schedule_collection:
exclusive_event = schedule.time_slot.exclusive_event()
time = schedule.time_slot.start_time
if exclusive_event:
c.programme[time]['exclusive'] = exclusive_event
else:
c.programme[time][schedule.location] = schedule
if filter.has_key('raw'):
return render('/schedule/table_raw.mako')
else:
return render('/schedule/table.mako')
开发者ID:Secko,项目名称:zookeepr,代码行数:55,代码来源:schedule.py
示例15: index
def index(self):
c.DAYS_OPEN = DAYS_OPEN
c.open_date = lca_info.lca_info['date']
days_open = (datetime.date.today() - c.open_date.date()).days
photo_db = PhotoCompEntry.read_db()
photos = [
photo
for days in photo_db.values()
for entries in days
for photo in entries
if photo is not None and photo.day < days_open]
c.no_photos = not photos
day_filter = request.GET.get('day', 'All')
if day_filter and day_filter != 'All':
photos = [p for p in photos if str(p.day) == day_filter]
person_filter = request.GET.get('person', 'All')
if person_filter and person_filter != 'All':
photos = [p for p in photos if str(p.person_id) == person_filter]
submitted = request.GET.get('s', None)
randomise = not submitted or 'randomise' in request.GET
if randomise:
random.shuffle(photos)
else:
photos.sort(key=lambda p: (p.day, p.person_id, p.entry_id))
person_map = {}
for photo in photos:
photo.write_scaled()
person_map[photo.person_id] = None
c.all_person = []
for person_id in person_map:
person = Person.find_by_id(person_id)
person_map[person_id] = person
c.all_person.append(person)
c.all_person.sort(key=lambda person: (person.firstname + " " + person.lastname).lower())
c.photos = photos
def photo_title(photo):
return "%s %s, %s entry %s, %s" % (
person_map[photo.person_id].firstname,
person_map[photo.person_id].lastname,
(c.open_date + datetime.timedelta(photo.day)).strftime('%A'),
ENTRY_NAMES[photo.entry_id],
photo.image_name,)
c.photo_title = photo_title
field_values = {
'day': day_filter,
'person': person_filter,
}
if randomise:
field_values['randomise'] = '1'
if submitted == 'Full Screen' and photos:
html = render('/photocomp/index-fullscreen.mako')
else:
html = render('/photocomp/index.mako')
return htmlfill.render(html, field_values)
开发者ID:gracz120,项目名称:zookeepr,代码行数:54,代码来源:photocomp.py
示例16: view_talk
def view_talk(self, id):
try:
c.day = request.GET['day']
except:
c.day = 'all'
try:
c.talk = Proposal.find_accepted_by_id(id)
except:
c.talk_id = id
c.webmaster_email = lca_info['webmaster_email']
return render('/schedule/invalid_talkid.mako')
return render('/schedule/table_view.mako')
开发者ID:Secko,项目名称:zookeepr,代码行数:12,代码来源:schedule.py
示例17: new
def new(self):
if c.funding_status == 'closed':
if not h.auth.authorized(h.auth.has_late_submitter_role):
return render("funding/closed.mako")
elif c.funding_status == 'not_open':
return render("funding/not_open.mako")
c.person = h.signed_in_person()
defaults = {
'funding.type': 1,
}
form = render("funding/new.mako")
return htmlfill.render(form, defaults)
开发者ID:Ivoz,项目名称:zookeepr,代码行数:14,代码来源:funding.py
示例18: table
def table(self, day=None):
# Check if we have any schedule information to display and tell people if we don't
if len(c.scheduled_dates) == 0:
return render('/schedule/no_schedule_available.mako')
# Which day should we be showing now?
c.display_date = None
available_days = { scheduled_date.strftime('%A').lower(): scheduled_date for scheduled_date in c.scheduled_dates }
if day in available_days:
c.display_date = available_days[day]
if c.display_date is None:
if date.today() in c.scheduled_dates:
c.display_date = date.today()
else:
c.display_date = c.scheduled_dates[0]
# Work out which times we should be displaying on the left hand time scale
c.time_slots = TimeSlot.find_by_date(c.display_date)
c.primary_times = { time_slot.start_time: time_slot for time_slot in TimeSlot.find_by_date(c.display_date, primary=True) }
# Find all locations that have non-exclusive events
start = datetime.combine(c.display_date, time.min)
end = datetime.combine(c.display_date, time.max)
c.locations = Location.query().join(Schedule).join(Event).join(TimeSlot).filter(TimeSlot.start_time.between(start, end)).filter(Event.exclusive != True).all()
# Find the list of scheduled items for the required date
c.schedule_collection = Schedule.find_by_date(c.display_date)
# What time period will we break the time scale on the left into
c.time_increment = timedelta(minutes=5)
# Build up the programme for the requested day
c.programme = OrderedDict()
for time_slot in c.time_slots:
mytime = time_slot.start_time
while mytime < time_slot.end_time:
c.programme[mytime] = {}
mytime = mytime + c.time_increment
for schedule in c.schedule_collection:
exclusive_event = schedule.time_slot.exclusive_event()
mytime = schedule.time_slot.start_time
if exclusive_event:
c.programme[mytime]['exclusive'] = exclusive_event
else:
c.programme[mytime][schedule.location] = schedule
if 'raw' in request.GET:
c.raw = True
return render('/schedule/table.mako')
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:50,代码来源:schedule.py
示例19: edit
def edit(self, id):
c.location = Location.find_by_id(id)
defaults = h.object_to_defaults(c.location, 'location')
form = render('/location/edit.mako')
return htmlfill.render(form, defaults)
开发者ID:SharifulAlamSourav,项目名称:zookeepr,代码行数:7,代码来源:location.py
示例20: summary
def summary(self):
for ft in c.funding_types:
stuff = Funding.find_all_by_funding_type_id(ft.id, include_withdrawn=False)
stuff.sort(self._score_sort)
setattr(c, '%s_collection' % ft.name, stuff)
return render('funding/summary.mako')
开发者ID:Ivoz,项目名称:zookeepr,代码行数:7,代码来源:funding.py
注:本文中的zkpylons.lib.base.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论