本文整理汇总了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
示例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
示例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
示例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()