• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python base.render函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zookeepr.lib.base.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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_zookeepr_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:CarlFK,项目名称:zookeepr,代码行数:26,代码来源:funding.py


示例2: _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:CarlFK,项目名称:zookeepr,代码行数:32,代码来源:person.py


示例3: _check_invoice

    def _check_invoice(self, person, invoice, ignore_overdue = False):
        c.invoice = invoice
        if person.invoices:
            if invoice.paid() or invoice.bad_payments().count() > 0:
                c.status = []
                if invoice.total()==0:
                  c.status.append('zero balance')
                if invoice.good_payments().count() > 0:
                  c.status.append('paid')
                  if invoice.good_payments().count()>1:
                    c.status[-1] += ' (%d times)' % invoice.good_payments().count()
                if invoice.bad_payments().count() > 0:
                  c.status.append('tried to pay')
                  if invoice.bad_payments().count()>1:
                    c.status[-1] += ' (%d times)' % invoice.bad_payments().count()
                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.overdue():
            for ii in invoice.items:
                if ii.product and not ii.product.available():
                    return render('/invoice/expired.mako')

        return None # All fine
开发者ID:CarlFK,项目名称:zookeepr,代码行数:27,代码来源:invoice.py


示例4: _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_zookeepr_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:CarlFK,项目名称:zookeepr,代码行数:27,代码来源:funding.py


示例5: 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()

        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:CarlFK,项目名称:zookeepr,代码行数:25,代码来源:proposal.py


示例6: _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_zookeepr_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:CarlFK,项目名称:zookeepr,代码行数:35,代码来源:proposal.py


示例7: 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()

        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:CarlFK,项目名称:zookeepr,代码行数:25,代码来源:miniconf_proposal.py


示例8: _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:CarlFK,项目名称:zookeepr,代码行数:31,代码来源:miniconf_proposal.py


示例9: _new

    def _new(self):
        # Do we allow account creation?
        if lca_info['account_creation']:
            """Create a new person submit.
            """

            # Remove fields not in class
            results = self.form_result['person']
            del results['password_confirm']
            del results['email_address2']
            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 lca_rego['confirm_email_address'] == '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')
        else:
            return render('/not_allowed.mako')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:28,代码来源:person.py


示例10: 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:mikalstill,项目名称:zookeepr,代码行数:31,代码来源:vote.py


示例11: 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:mikalstill,项目名称:zookeepr,代码行数:55,代码来源:schedule.py


示例12: 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:cafuego,项目名称:zookeepr,代码行数:54,代码来源:photocomp.py


示例13: 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:mikalstill,项目名称:zookeepr,代码行数:12,代码来源:schedule.py


示例14: 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:CarlFK,项目名称:zookeepr,代码行数:14,代码来源:funding.py


示例15: _reset_password

    def _reset_password(self, url_hash):
        """Confirm a password change request, and let the user change
        their password.

        `url_hash` is a hash of the email address, with which we can
        look up the confuirmation record in the database.

        If `url_hash` doesn't exist, 404.

        If `url_hash` exists and the date is older than 24 hours,
        warn the user, offer to send a new confirmation, and delete the
        confirmation record.

        GET returns a form for setting their password, with their email
        address already shown.

        POST checks that the email address (in the session, not in the
        form) is part of a valid person record (again).  If the record
        exists, then update the password, hashed.  Report success to the
        user.  Delete the confirmation record.

        If the record doesn't exist, throw an error, delete the
        confirmation record.
        """
        c.conf_rec = PasswordResetConfirmation.find_by_url_hash(url_hash)

        now = datetime.datetime.now(c.conf_rec.timestamp.tzinfo)
        delta = now - c.conf_rec.timestamp
        if delta > datetime.timedelta(hours=24):
            # this confirmation record has expired
            meta.Session.delete(c.conf_rec)
            meta.Session.commit()
            return render('person/expired.mako')

        person = Person.find_by_email(c.conf_rec.email_address)
        if person is None:
            raise RuntimeError, "Person doesn't exist %s" % c.conf_rec.email_address

        # set the password
        person.password = self.form_result['password']
        # also make sure the person is activated
        person.activated = True

        # delete the conf rec
        meta.Session.delete(c.conf_rec)
        meta.Session.commit()

        return render('person/success.mako')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:48,代码来源:person.py


示例16: index

    def index(self):
        # Check access and redirect
        if not h.auth.authorized(h.auth.has_organiser_role):
            redirect_to(action="new")

        c.volunteer_collection = Volunteer.find_all()
        return render("volunteer/list.mako")
开发者ID:cafuego,项目名称:zookeepr,代码行数:7,代码来源:volunteer.py


示例17: edit

    def edit(self, id):
        c.rego_note = RegoNote.find_by_id(id)

        defaults = h.object_to_defaults(c.rego_note, "rego_note")

        form = render("rego_note/edit.mako")
        return htmlfill.render(form, defaults)
开发者ID:timClicks,项目名称:zookeepr,代码行数:7,代码来源:rego_note.py


示例18: _pay

    def _pay(self, id):
        payment = Payment.find_by_id(self.form_result['payment_id'])
        c.invoice = payment.invoice
        person = c.invoice.person

        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_user(person.id), h.auth.has_organiser_role, h.auth.has_unique_key())):
            # Raise a no_auth error
            h.auth.no_role()

        error = self._check_invoice(person, c.invoice)
        if error is not None:
            return error

        client_ip = request.environ['REMOTE_ADDR']
        if 'HTTP_X_FORWARDED_FOR' in request.environ:
            client_ip = request.environ['HTTP_X_FORWARDED_FOR']

        # Prepare fields for PxPay
        params = {
            'payment_id': payment.id,
            'amount': "%#.*f" % (2, payment.amount / 100.0),
            'invoice_id': payment.invoice.id,
            'email_address': payment.invoice.person.email_address,
            'client_ip' : client_ip,
            'return_url' : 'https://conf.linux.org.au/payment/new',
        }

        (valid, uri) = pxpay.generate_request(params)
        if valid != '1':
            c.error_msg = "PxPay Generate Request error: " + uri
            return render("/payment/gateway_error.mako")
        else:
            redirect(uri)
开发者ID:CarlFK,项目名称:zookeepr,代码行数:33,代码来源:invoice.py


示例19: void

    def void(self, id):
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zookeepr_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)

        if 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:
            if c.invoice.paid():
                h.flash("Cannot void a paid invoice.")
                return redirect_to(action='view', id=c.invoice.id)
            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)
开发者ID:CarlFK,项目名称:zookeepr,代码行数:25,代码来源:invoice.py


示例20: edit

    def edit(self, id):
        c.special_offer = SpecialOffer.find_by_id(id)

        defaults = h.object_to_defaults(c.special_offer, 'special_offer')

        form = render('/special_offer/edit.mako')
        return htmlfill.render(form, defaults)
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:special_offer.py



注:本文中的zookeepr.lib.base.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.flash函数代码示例发布时间:2022-05-26
下一篇:
Python conf.CLUSTERS类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap