當前位置: 首頁>>代碼示例>>Python>>正文


Python ProductEnvironment.resolve_href方法代碼示例

本文整理匯總了Python中multiproduct.env.ProductEnvironment.resolve_href方法的典型用法代碼示例。如果您正苦於以下問題:Python ProductEnvironment.resolve_href方法的具體用法?Python ProductEnvironment.resolve_href怎麽用?Python ProductEnvironment.resolve_href使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在multiproduct.env.ProductEnvironment的用法示例。


在下文中一共展示了ProductEnvironment.resolve_href方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _process_doc

# 需要導入模塊: from multiproduct.env import ProductEnvironment [as 別名]
# 或者: from multiproduct.env.ProductEnvironment import resolve_href [as 別名]
    def _process_doc(self, doc):
        ui_doc = dict(doc)

        if doc.get('product'):
            env = ProductEnvironment(self.env, doc['product'])
            product_href = ProductEnvironment.resolve_href(env, self.env)
            ui_doc["href"] = product_href(doc['type'], doc['id'])
        else:
            ui_doc["href"] = self.env.href(doc['type'], doc['id'])

        ui_doc['title'] = str(doc['type'] + ": " + doc['_stored_name']).title()

        return ui_doc
開發者ID:ahorincar,項目名稱:bloodhound_solr_plugin,代碼行數:15,代碼來源:solr_backend.py

示例2: _process_doc

# 需要導入模塊: from multiproduct.env import ProductEnvironment [as 別名]
# 或者: from multiproduct.env.ProductEnvironment import resolve_href [as 別名]
    def _process_doc(self, doc):
        ui_doc = dict(doc)
        if doc.get('product'):
            env = ProductEnvironment(self.env, doc['product'])
            product_href = ProductEnvironment.resolve_href(env, self.env)
            # pylint: disable=too-many-function-args
            ui_doc["href"] = product_href(doc['type'], doc['id'])
        else:
            ui_doc["href"] = self.req.href(doc['type'], doc['id'])

        if doc['content']:
            ui_doc['content'] = shorten_result(doc['content'])

        if doc['time']:
            ui_doc['date'] = user_time(self.req, format_datetime, doc['time'])

        is_free_text_view = self.view is None
        if is_free_text_view:
            participant = self.allowed_participants[doc['type']]
            ui_doc['title'] = participant.format_search_results(doc)
        return ui_doc
開發者ID:mohsadki,項目名稱:dargest,代碼行數:23,代碼來源:web_ui.py

示例3: render_widget

# 需要導入模塊: from multiproduct.env import ProductEnvironment [as 別名]
# 或者: from multiproduct.env.ProductEnvironment import resolve_href [as 別名]
    def render_widget(self, name, context, options):
        """Gather product list and render data in compact view
        """
        data = {}
        req = context.req
        title = ''
        params = ('max', 'cols')
        max_, cols = self.bind_params(name, options, *params)

        if not isinstance(self.env, ProductEnvironment):
            for p in Product.select(self.env):
                if 'PRODUCT_VIEW' in req.perm(Neighborhood('product', p.prefix)):
                    penv = ProductEnvironment(self.env, p.prefix)
                    phref = ProductEnvironment.resolve_href(penv, self.env)
                    for resource in (
                        {'type': Milestone, 'name': 'milestone', 'hrefurl': True},
                        {'type': Component, 'name': 'component'},
                        {'type': Version, 'name': 'version'},
                    ):
                        setattr(p, resource['name'] + 's',
                                self._get_product_info(p, phref, resource, max_))
                    p.owner_link = Query.from_string(self.env,
                        'status!=closed&col=id&col=summary&col=owner'
                        '&col=status&col=priority&order=priority'
                        '&group=product&owner=%s' % (p._data['owner'] or '', )
                    ).get_href(phref)
                    p.href = phref()
                    data.setdefault('product_list', []).append(p)
            title = _('Products')

        data['colseq'] = itertools.cycle(xrange(cols - 1, -1, -1)) if cols \
            else itertools.repeat(1)

        return 'widget_product.html', {
            'title': title,
            'data': data,
            'ctxtnav': [tag.a(_('More'), href=req.href('products'))],
        }, context
開發者ID:mohsadki,項目名稱:dargest,代碼行數:40,代碼來源:product.py

示例4: admin_url

# 需要導入模塊: from multiproduct.env import ProductEnvironment [as 別名]
# 或者: from multiproduct.env.ProductEnvironment import resolve_href [as 別名]
 def admin_url(prefix):
     env = ProductEnvironment.lookup_env(self.env, prefix)
     href = ProductEnvironment.resolve_href(env, self.env)
     return href.admin()
開發者ID:mohsadki,項目名稱:dargest,代碼行數:6,代碼來源:theme.py


注:本文中的multiproduct.env.ProductEnvironment.resolve_href方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。