本文整理汇总了Python中zkpylons.lib.helpers.signed_in_person函数的典型用法代码示例。如果您正苦于以下问题:Python signed_in_person函数的具体用法?Python signed_in_person怎么用?Python signed_in_person使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signed_in_person函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _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)
示例2: __before__
def __before__(self, **kwargs):
if h.signed_in_person():
c.can_edit = h.signed_in_person().has_role('organiser')
else:
c.can_edit = False
c.scheduled_dates = TimeSlot.find_scheduled_dates()
c.subsubmenu = [['/programme/schedule/' + scheduled_date.strftime('%A').lower(), scheduled_date.strftime('%A')] for scheduled_date in c.scheduled_dates]
示例3: __call__
def __call__(self, environ, start_response):
"""Invoke the Controller"""
# WSGIController.__call__ dispatches to the Controller method
# the request is routed to. This routing information is
# available in environ['pylons.routes_dict']
person = h.signed_in_person()
if person and not person.activated:
msg = ("Your account (%s) hasn't been confirmed. Check your email"
" for activation instructions. %s" %
(person.email_address, 'link-to-reset'))
h.flash(msg, category="warning")
# Moved here from index controller so that all views that import the news.mako template
# have access to c.db_content_news and c.db_content_press
news = DbContentType.find_by_name("News", abort_404 = False)
if news:
c.db_content_news = meta.Session.query(DbContent).filter_by(type_id=news.id).filter(DbContent.publish_timestamp <= datetime.datetime.now()).order_by(DbContent.creation_timestamp.desc()).limit(4).all()
c.db_content_news_all = meta.Session.query(DbContent).filter_by(type_id=news.id).filter(DbContent.publish_timestamp <= datetime.datetime.now()).order_by(DbContent.creation_timestamp.desc()).all() #use all to find featured items
press = DbContentType.find_by_name("In the press", abort_404 = False)
if press:
c.db_content_press = meta.Session.query(DbContent).filter_by(type_id=press.id).order_by(DbContent.creation_timestamp.desc()).filter(DbContent.publish_timestamp <= datetime.datetime.now()).limit(4).all()
try:
return WSGIController.__call__(self, environ, start_response)
finally:
meta.Session.remove()
示例4: _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)
示例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)
示例6: _review
def _review(self, id):
"""Review a proposal.
"""
c.proposal = Proposal.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)
c.review = Review.find_by_proposal_reviewer(id, c.signed_in_person.id, abort_404=False)
if c.review:
for key in self.form_result['review']:
setattr(c.review, key, self.form_result['review'][key])
# update the objects with the validated form data
meta.Session.commit()
h.flash("Review Updated Successfully")
return redirect_to(controller='review', action='view', id=c.review.id)
else:
results = self.form_result['review']
review = Review(**results)
meta.Session.add(review)
review.proposal = c.proposal
review.reviewer = c.signed_in_person
meta.Session.commit()
h.flash("Review Added Successfully")
if c.next_review_id:
return redirect_to(action='review', id=c.next_review_id)
h.flash("No more papers to review")
return redirect_to(action='review_index')
示例7: 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)
示例8: activate
def activate(self):
c.person = h.signed_in_person()
if c.person.activated:
# We've since activated, lets go back to where we were
self._redirect_user_optimally()
return render('/person/activate.mako')
示例9: _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')
示例10: _review
def _review(self, id):
"""Review a funding application.
"""
c.funding = Funding.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Funding.find_next_proposal(c.funding.id, c.funding.type.id, c.signed_in_person.id)
person = c.signed_in_person
if person in [ review.reviewer for review in c.funding.reviews]:
h.flash('Already reviewed')
return redirect_to(action='review', id=c.next_review_id)
results = self.form_result['review']
if results['score'] == 'null':
results['score'] = None
review = FundingReview(**results)
meta.Session.add(review)
c.funding.reviews.append(review)
review.reviewer = person
meta.Session.commit()
if c.next_review_id:
return redirect_to(action='review', id=c.next_review_id)
h.flash("No more funding applications to review")
return redirect_to(action='review_index')
示例11: review
def review(self, id):
c.funding = Funding.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Funding.find_next_proposal(c.funding.id, c.funding.type.id, c.signed_in_person.id)
return render('/funding/review.mako')
示例12: _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
示例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)
示例14: 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)
示例15: _revoke
def _revoke(self):
args = request.GET
eventid = int(args.get('eventid',0))
c.signed_in_person = h.signed_in_person()
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')