def _delete(self, id): c.rego_room = RegoRoom.find_by_id(id) meta.Session.delete(c.rego_room) meta.Session.commit() h.flash("Rego room has been deleted.") redirect_to('index')
def _delete(self, id): c.funding_type = FundingType.find_by_id(id) meta.Session.delete(c.funding_type) meta.Session.commit() h.flash("Funding type has been deleted.") redirect_to('index')
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()
def delete_folder(self): try: if request.GET['folder'] is not None: c.folder += request.GET['folder'] c.current_folder += request.GET['current_path'] except KeyError: abort(404) directory = get_path('public_path') defaults = dict(request.POST) if defaults: c.no_theme = 'false' if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = 'true' try: os.rmdir(directory + c.folder) except OSError: h.flash("Can not delete. The folder contains items.", 'error') redirect_to(action="list_files", folder=c.current_folder, no_theme=c.no_theme) h.flash("Folder deleted.") redirect_to(action="list_files", folder=c.current_folder, no_theme=c.no_theme) c.no_theme = False if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = True return render('/db_content/delete_folder.mako')
def _delete(self, id): c.special_offer = SpecialOffer.find_by_id(id) meta.Session.delete(c.special_offer) meta.Session.commit() h.flash("Special Offer has been deleted.") redirect_to('index')
def _delete(self, id): c.rego_note = RegoNote.find_by_id(id) meta.Session.delete(c.rego_note) meta.Session.commit() h.flash("Rego note has been deleted.") redirect_to('index')
def _delete(self, id): c.fulfilment = Fulfilment.find_by_id(id) meta.Session.delete(c.fulfilment) meta.Session.commit() h.flash("Fulfilment has been deleted.") redirect_to("index", id=None)
def _new(self): results = self.form_result['invoice'] del(results['item_count']) items = results['items'] results['items'] = [] c.invoice = Invoice(**results) for i in items: item = InvoiceItem() if i['description'] != "": item.description = i['description'] else: product = Product.find_by_id(i['product'].id) category = product.category item.product = i['product'] item.description = product.category.name + ' - ' + product.description item.cost = i['cost'] item.qty = i['qty'] c.invoice.items.append(item) c.invoice.manual = True c.invoice.void = None meta.Session.add(c.invoice) meta.Session.commit() h.flash("Manual invoice created") return redirect_to(action='view', id=c.invoice.id)
def _delete(self, id): c.proposal_type = ProposalType.find_by_id(id) meta.Session.delete(c.proposal_type) meta.Session.commit() h.flash("Proposal type has been deleted.") redirect_to('index')
def _delete(self, id): c.proposal_status = ProposalStatus.find_by_id(id) meta.Session.delete(c.proposal_status) meta.Session.commit() h.flash("Proposal Status has been deleted.") redirect_to('index')
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')
def _delete(self, id): c.db_content = DbContent.find_by_id(id) meta.Session.delete(c.db_content) meta.Session.commit() h.flash("Content Deleted.") redirect_to('index')
def void(self, id): if not h.auth.authorized( h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role)): # Raise a no_auth error h.auth.no_role() c.invoice = Invoice.find_by_id(id, True) if c.invoice.is_void: h.flash("Invoice was already voided.") return redirect_to(action='view', id=c.invoice.id) elif len(c.invoice.payment_received) and h.auth.authorized( h.auth.has_organiser_role): h.flash("Invoice has a payment applied to it, do you want to " + h.link_to('Refund', h.url_for(action='refund')) + " instead?") return redirect_to(action='view', id=c.invoice.id) elif len(c.invoice.payment_received): h.flash("Cannot void a paid invoice.") return redirect_to(action='view', id=c.invoice.id) elif h.auth.authorized(h.auth.has_organiser_role): c.invoice.void = "Administration Change" meta.Session.commit() h.flash("Invoice was voided.") return redirect_to(action='view', id=c.invoice.id) else: c.invoice.void = "User cancellation" c.person = c.invoice.person meta.Session.commit() email(lca_info['contact_email'], render('/invoice/user_voided.mako')) h.flash("Previous invoice was voided.") return redirect_to(controller='registration', action='pay', id=c.person.registration.id)
def delete_folder(self): try: if request.GET['folder'] is not None: c.folder += request.GET['folder'] c.current_folder += request.GET['current_path'] except KeyError: abort(404) directory = file_paths['public_path'] defaults = dict(request.POST) if defaults: c.no_theme = 'false' if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = 'true' try: os.rmdir(directory + c.folder) except OSError: h.flash("Can not delete. The folder contains items.", 'error') redirect_to(action="list_files", folder=c.current_folder, no_theme = c.no_theme) h.flash("Folder deleted.") redirect_to(action="list_files", folder=c.current_folder, no_theme = c.no_theme) c.no_theme = False if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = True return render('/db_content/delete_folder.mako')
def unvoid(self, id): c.invoice = Invoice.find_by_id(id, True) c.invoice.void = None c.invoice.manual = True meta.Session.commit() h.flash("Invoice was un-voided.") return redirect_to(action='view', id=c.invoice.id)
def _delete(self, id): c.social_network = SocialNetwork.find_by_id(id) meta.Session.delete(c.social_network) meta.Session.commit() h.flash("Social Network has been deleted.") redirect_to('index')
def _delete(self, id): c.travel = Travel.find_by_id(id) meta.Session.delete(c.travel) meta.Session.commit() h.flash("Travel has been deleted.") redirect_to('index')
def _delete(self, id): c.location = Location.find_by_id(id) meta.Session.delete(c.location) meta.Session.commit() h.flash("Location has been deleted.") redirect_to('index')
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)
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." % (person.email_address)) 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()
def delete_file(self): try: if request.GET['file'] is not None: c.file += request.GET['file'] c.current_folder += request.GET['folder'] except KeyError: abort(404) directory = get_path('public_path') defaults = dict(request.POST) if defaults: os.remove(directory + c.file) h.flash("File Removed") c.no_theme = 'false' if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = 'true' redirect_to(action="list_files", folder=c.current_folder, no_theme=c.no_theme) c.no_theme = False if request.GET.has_key('no_theme'): if request.GET['no_theme'] == 'true': c.no_theme = True return render('/db_content/delete_file.mako')
def pending(self, id): volunteer = Volunteer.find_by_id(id) volunteer.accepted = None volunteer.ticket_type = None meta.Session.commit() h.flash('Status Updated') redirect_to(action='index', id=None)
def _delete(self, id): c.proposal_type = ProposalType.find_by_id(id) meta.Session.delete(c.proposal_type) meta.Session.commit() h.flash("Proposal type has been deleted.") redirect_to("index")
def _delete(self, id): c.ceiling = Ceiling.find_by_id(id) meta.Session.delete(c.ceiling) meta.Session.commit() h.flash("Ceiling has been deleted.") redirect_to('index')
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')
def _delete(self, id): c.stream = Stream.find_by_id(id) meta.Session.delete(c.stream) meta.Session.commit() h.flash("Stream has been deleted.") redirect_to('index')
def _delete(self, id): c.schedule = Schedule.find_by_id(id) meta.Session.delete(c.schedule) meta.Session.commit() h.flash("Schedule has been deleted.") redirect_to('index')
def void(self, id): if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_attendee(id), h.auth.has_organiser_role)): # Raise a no_auth error h.auth.no_role() c.invoice = Invoice.find_by_id(id, True) if c.invoice.is_void: h.flash("Invoice was already voided.") return redirect_to(action='view', id=c.invoice.id) elif len(c.invoice.payment_received) and h.auth.authorized(h.auth.has_organiser_role): h.flash("Invoice has a payment applied to it, do you want to " + h.link_to('Refund', h.url_for(action='refund')) + " instead?") return redirect_to(action='view', id=c.invoice.id) elif len(c.invoice.payment_received): h.flash("Cannot void a paid invoice.") return redirect_to(action='view', id=c.invoice.id) elif h.auth.authorized(h.auth.has_organiser_role): c.invoice.void = "Administration Change" meta.Session.commit() h.flash("Invoice was voided.") return redirect_to(action='view', id=c.invoice.id) else: c.invoice.void = "User cancellation" c.person = c.invoice.person meta.Session.commit() email(Config.get('contact_email'), render('/invoice/user_voided.mako')) h.flash("Previous invoice was voided.") return redirect_to(controller='registration', action='pay', id=c.person.registration.id)
def _delete(self, id): c.event = Event.find_by_id(id) meta.Session.delete(c.event) meta.Session.commit() h.flash("Event has been deleted.") redirect_to('index')
def _delete(self, id): c.fulfilment_type = FulfilmentType.find_by_id(id) meta.Session.delete(c.fulfilment_type) meta.Session.commit() h.flash("FulfilmentType has been deleted.") redirect_to('index', id=None)
def _delete(self, id): c.time_slot = TimeSlot.find_by_id(id) meta.Session.delete(c.time_slot) meta.Session.commit() h.flash("Time Slot has been deleted.") redirect_to('index')
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')
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)
def _delete(self, id): c.fulfilment = Fulfilment.find_by_id(id) meta.Session.delete(c.fulfilment) meta.Session.commit() h.flash("Fulfilment has been deleted.") redirect_to('index', id=None)
def _delete(self, id): c.fulfilment_group = FulfilmentGroup.find_by_id(id) meta.Session.delete(c.fulfilment_group) meta.Session.commit() h.flash("Fulfilment Group has been deleted.") redirect_to('index', id=None)
def _delete(self, id): c.travel = Travel.find_by_id(id) meta.Session.delete(c.travel) meta.Session.commit() h.flash("Travel has been deleted.") redirect_to("index")
def _delete(self, id): c.fulfilment_status = FulfilmentStatus.find_by_id(id) meta.Session.delete(c.fulfilment_status) meta.Session.commit() h.flash("Fulfilment Status has been deleted.") redirect_to('index', id=None)
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 Review') 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)
def signout(self): """ Sign the user out Authikit actually does the work after this finished """ # return home h.flash('You have signed out') redirect_to('home')
def new_proposals(self): for proposal in c.proposals: event = Event(type_id=1, proposal=proposal, publish=True, exclusive=False) meta.Session.add(event) meta.Session.commit() h.flash("Events successfully created from Proposals") redirect_to(action='index', id=None)
def finish_login(self, email): # Tell authkit we authenticated them request.environ['paste.auth_tkt.set_user'](email) h.check_for_incomplete_profile(c.person) h.flash('You have signed in') self._redirect_user_optimally()