当前位置: 首页>>代码示例>>Python>>正文


Python tower._lazy函数代码示例

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


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

示例1: index

def index(request):
    """
    Display search results for Opinions on Firefox. Shows breakdown of
    Praise/Issues/Ideas, sites/themes, and search filters.

    If no search criteria are explicitly set, the page is considered the
    "Dashboard" (i.e. the home page of Firefox Input). Otherwise, the title
    of the page is "Search Results".
    """

    VERSIONS = VersionCount.objects.filter(active=1)

    VERSION_CHOICES = {
        FIREFOX: ([('--', _lazy(u'-- all --', 'version_choice'))] +
                  [(v.version, v.version) for v in VERSIONS
                  if v.product == FIREFOX.id]),
        MOBILE: ([('--', _lazy(u'-- all --', 'version_choice'))] +
                 [(v.version, v.version) for v in VERSIONS
                 if v.product == MOBILE.id]),
    }

    try:
        meta = ('type', 'locale', 'platform', 'day_sentiment', 'manufacturer',
                'device')
        (results, form, product, version, metas, type_filter) = _get_results(
                request, meta=meta)
    except SearchError, e:
        return render(request, 'search/unavailable.html', {'search_error': e},
                      status=500)
开发者ID:cturra,项目名称:input.mozilla.org,代码行数:29,代码来源:views.py

示例2: group_tier_choices

    def group_tier_choices(self):
        """Creates tier choices with optgroups based on payment methods"""
        price_choices = [("free", _("Free (with in-app payments)"))]
        card_billed = []
        operator_billed = []
        card_and_operator_billed = []

        for price in Price.objects.active():
            choice = (price.pk, unicode(price))
            # Special case price tier 0.
            if price.price == Decimal("0.00"):
                price_choices.append((price.pk, "%s (%s)" % (unicode(price), _("Promotional Pricing"))))
            # Tiers that can only be operator billed.
            elif price.method == PAYMENT_METHOD_OPERATOR:
                operator_billed.append(choice)
            # Tiers that can only be card billed.
            elif price.method == PAYMENT_METHOD_CARD:
                card_billed.append(choice)
            # Tiers that are can generally be billed by either
            # operator or card.
            elif price.method == PAYMENT_METHOD_ALL:
                card_and_operator_billed.append(choice)

        if operator_billed:
            price_choices.append((_lazy("Only supports carrier billing"), operator_billed))
        if card_billed:
            price_choices.append((_lazy("Only supports credit-card billing"), card_billed))
        if card_and_operator_billed:
            price_choices.append((_lazy("Supports all billing methods"), card_and_operator_billed))

        return price_choices
开发者ID:mattbasta,项目名称:zamboni,代码行数:31,代码来源:forms_payments.py

示例3: get_actions

 def get_actions(self):
     actions = SortedDict()
     actions['public'] = {'method': self.handler.process_public,
                          'minimal': False,
                          'label': _lazy('Push to public'),
                          'details': _lazy(
                             'This will approve the sandboxed app so it '
                             'appears on the public side.')}
     actions['reject'] = {'method': self.handler.process_sandbox,
                          'label': _lazy('Reject'),
                          'minimal': False,
                          'details': _lazy(
                             'This will reject the app and remove it '
                             'from the review queue.')}
     actions['info'] = {'method': self.handler.request_information,
                        'label': _lazy('Request more information'),
                        'minimal': True,
                        'details': _lazy(
                            'This will send the author(s) an email '
                            'requesting more information.')}
     actions['super'] = {'method': self.handler.process_super_review,
                         'label': _lazy('Request super-review'),
                         'minimal': True,
                         'details': _lazy(
                             'Flag this app for an admin to review')}
     actions['comment'] = {'method': self.handler.process_comment,
                           'label': _lazy('Comment'),
                           'minimal': True,
                           'details': _lazy(
                                 'Make a comment on this app.  The '
                                 'author won\'t be able to see this.')}
     return actions
开发者ID:beenishkhan,项目名称:zamboni,代码行数:32,代码来源:utils.py

示例4: get_actions

    def get_actions(self):
        labels, details = self._review_actions()

        actions = SortedDict()
        if self.review_type != "preliminary":
            actions["public"] = {
                "method": self.handler.process_public,
                "minimal": False,
                "label": _lazy("Push to public"),
            }

        actions["prelim"] = {"method": self.handler.process_preliminary, "label": labels["prelim"], "minimal": False}
        actions["reject"] = {"method": self.handler.process_sandbox, "label": _lazy("Reject"), "minimal": False}
        actions["info"] = {
            "method": self.handler.request_information,
            "label": _lazy("Request more information"),
            "minimal": True,
        }
        actions["super"] = {
            "method": self.handler.process_super_review,
            "label": _lazy("Request super-review"),
            "minimal": True,
        }
        for k, v in actions.items():
            v["details"] = details.get(k)

        return actions
开发者ID:LittleForker,项目名称:zamboni,代码行数:27,代码来源:helpers.py

示例5: get_actions

    def get_actions(self):
        labels, details = self._review_actions()

        actions = SortedDict()
        if self.review_type != 'preliminary':
            actions['public'] = {'method': self.handler.process_public,
                                 'minimal': False,
                                 'label': _lazy('Push to public')}

        actions['prelim'] = {'method': self.handler.process_preliminary,
                             'label': labels['prelim'],
                             'minimal': False}
        actions['reject'] = {'method': self.handler.process_sandbox,
                             'label': _lazy('Reject'),
                             'minimal': False}
        actions['info'] = {'method': self.handler.request_information,
                           'label': _lazy('Request more information'),
                           'minimal': True}
        actions['super'] = {'method': self.handler.process_super_review,
                            'label': _lazy('Request super-review'),
                            'minimal': True}
        actions['comment'] = {'method': self.handler.process_comment,
                              'label': _lazy('Comment'),
                              'minimal': True}
        for k, v in actions.items():
            v['details'] = details.get(k)

        return actions
开发者ID:aditbiswas1,项目名称:olympia,代码行数:28,代码来源:helpers.py

示例6: __init__

    def __init__(self, *args, **kwargs):
        """Override the __init__ method to change form labels"""
        super(PasswordChangeForm, self).__init__(*args, **kwargs)

        self.fields["old_password"].label = _lazy(u"Verify your old password")
        self.fields["new_password1"].label = _lazy(u"Enter a new password")
        self.fields["new_password2"].label = _lazy(u"Confirm new password")
开发者ID:evilpie,项目名称:mozillians,代码行数:7,代码来源:forms.py

示例7: render_additional_info

 def render_additional_info(self, row):
     info = []
     if row.is_site_specific:
         info.append(_lazy(u'Site Specific'))
     if row.external_software:
         info.append(_lazy(u'Requires External Software'))
     if row.binary or row.binary_components:
         info.append(_lazy(u'Binary Components'))
     return u', '.join([jinja2.escape(i) for i in info])
开发者ID:aditbiswas1,项目名称:olympia,代码行数:9,代码来源:helpers.py

示例8: promo_video_noir

def promo_video_noir(request):
    """Film Noir promo video."""
    d = dict(video_title=_lazy('Noir'),
             video_description=_lazy('The fox meets a damsel in distress, but '
                                     'can he help her? Get inspired for your '
                                     'Firefox Flicks entry by checking out '
                                     'our video.'),
             page_type='videos',
             video_embed=Markup(embedCode(promo_video_shortlink('noir'),
                                          width=600, height=337)))
    return render(request, 'videos/promo.html', d)
开发者ID:fwenzel,项目名称:firefox-flicks,代码行数:11,代码来源:views.py

示例9: promo_video_twilight

def promo_video_twilight(request):
    """Twilight parody promo video."""
    desc = _lazy('A teenage girl learns the truth about the fox. Get inspired '
                 'for your Firefox Flicks entry by checking out our video.')
    d = dict(video_title=_lazy('Twilight'),
             video_description=desc,
             tweet_text=desc,
             page_type='videos',
             video_embed=Markup(embedCode(promo_video_shortlink('twilight'),
                                          width=600, height=337)))
    return render(request, 'videos/promo.html', d)
开发者ID:pmclanahan,项目名称:firefox-flicks,代码行数:11,代码来源:views.py

示例10: __init__

 def __init__(self, *args, **kwargs):
     super(UsernameField, self).__init__(
         label=_lazy(u'Username'), max_length=30, min_length=3,
         regex=r'^[\[email protected]+-]+$',
         help_text=_lazy(u'Required. 30 characters or fewer. '
                         'Letters, digits and @/./+/-/_ only.'),
         error_messages={'invalid': USERNAME_INVALID,
                         'required': USERNAME_REQUIRED,
                         'min_length': USERNAME_SHORT,
                         'max_length': USERNAME_LONG},
         *args, **kwargs)
开发者ID:kaiquewdev,项目名称:kuma,代码行数:11,代码来源:forms.py

示例11: promo_video_dance

def promo_video_dance(request):
    """Dancing promo video."""
    d = dict(video_title=_lazy('Dance'),
             video_description=_lazy("He's got the moves, he's got ambition. "
                                     "How far can this fox's feet take him? "
                                     "Get inspired for your Firefox Flicks "
                                     "entry by checking out our video."),
             page_type='videos',
             video_embed=Markup(embedCode(promo_video_shortlink('dance'),
                                          width=600, height=337)))
    return render(request, 'videos/promo.html', d)
开发者ID:fwenzel,项目名称:firefox-flicks,代码行数:11,代码来源:views.py

示例12: __init__

 def __init__(self, *args, **kwargs):
     super(UsernameField, self).__init__(
         label=_lazy(u'Username'), max_length=30, min_length=3,
         regex=r'^[\w.-]+$',
         help_text=_lazy(u'Required. 30 characters or fewer. '
                         'Letters, digits and ./-/_ only.'),
         widget=forms.TextInput(attrs={'placeholder': USERNAME_PLACEHOLDER}),
         error_messages={'invalid': USERNAME_INVALID,
                         'required': USERNAME_REQUIRED,
                         'min_length': USERNAME_SHORT,
                         'max_length': USERNAME_LONG},
         *args, **kwargs)
开发者ID:gerv,项目名称:kuma,代码行数:12,代码来源:forms.py

示例13: flags

    def flags(self):
        props = (
            ('admin_review', 'admin-review', _lazy('Admin Review')),
            ('is_jetpack', 'jetpack', _lazy('Jetpack Add-on')),
            ('is_traditional_restartless', 'restartless',
             _lazy('Restartless Add-on')),
            ('has_info_request', 'info', _lazy('More Information Requested')),
            ('has_editor_comment', 'editor', _lazy('Contains Editor Comment')),
        )

        return [(cls, title) for (prop, cls, title) in props
                if getattr(self, prop)]
开发者ID:abhiii5459,项目名称:olympia,代码行数:12,代码来源:models.py

示例14: render_additional_info

 def render_additional_info(self, row):
     info = []
     if row.is_site_specific:
         info.append(_lazy(u"Site Specific"))
     if len(row.file_platform_ids) == 1 and row.file_platform_ids != [amo.PLATFORM_ALL.id]:
         k = row.file_platform_ids[0]
         # L10n: first argument is the platform such as Linux, Mac OS X
         info.append(_lazy(u"{0} only").format(amo.PLATFORMS[k].name))
     if row.external_software:
         info.append(_lazy(u"Requires External Software"))
     if row.binary:
         info.append(_lazy(u"Binary Components"))
     return u", ".join([jinja2.escape(i) for i in info])
开发者ID:LittleForker,项目名称:zamboni,代码行数:13,代码来源:helpers.py

示例15: data

 def data(self):
     topics = super(RootTopicSerializer, self).data
     return {
         'subtopics': topics,
         'documents': [],
         'title': _lazy('All Topics'),
         'slug': '',
         'description': _lazy('All Topics'),
         'parent': None,
         'visible': True,
         'product': None,
         'path': '/',
     }
开发者ID:rbillings,项目名称:kitsune,代码行数:13,代码来源:api.py


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