本文整理汇总了Python中Products.Five.BrowserView.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BrowserView.__init__方法的具体用法?Python BrowserView.__init__怎么用?Python BrowserView.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.Five.BrowserView
的用法示例。
在下文中一共展示了BrowserView.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.catalog = getToolByName(context, 'portal_catalog')
portal_properties = getToolByName(context, 'portal_properties')
self.fp = getattr(portal_properties, 'frontpage_properties')
self.promotions = []
self.portal_url = getToolByName(aq_inner(context), 'portal_url')()
self.noOfHigh = self.fp.getProperty('noOfHigh', 3)
self.noOfMedium = self.fp.getProperty('noOfMedium', 4)
self.noOfLow = self.fp.getProperty('noOfLow', 10)
self.noOfArticles = self.fp.getProperty('noOfArticles', 6)
self.noOfNews = self.fp.getProperty('noOfNews', 6)
self.noOfMultimedia = self.fp.getProperty(
'noOfMultimedia', 6)
self.noOfPromotions = self.fp.getProperty(
'noOfPromotions', 7)
self.noOfEachProduct = self.fp.getProperty(
'noOfEachProduct', 3)
self.getProducts = self.fp.getProperty('getProducts', [])
self.effectiveDateMonthsAgo = self.fp.getProperty(
'effectiveDateMonthsAgo', 18)
self.now = DateTime()
示例2: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, *args, **kwargs):
BrowserView.__init__(self, *args, **kwargs)
tool = getToolByName(self.context, 'portal_url')
portal = tool.getPortalObject()
self.sm = SubscriptionManager(portal)
obj = self.context.aq_explicit
self.contenttype = obj.__class__.__name__
示例3: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.request.set('disable_border', 1)
# following two only on Plone 4+
self.request.set('disable_plone.leftcolumn', 1)
self.request.set('disable_plone.rightcolumn', 1)
示例4: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.catalog = getToolByName(self.context, 'portal_catalog')
self.portal_state = getMultiAdapter((context, request),
name=u'plone_portal_state')
self.navigation_root_url = self.portal_state.navigation_root_url()
示例5: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, *args, **kw):
BrowserView.__init__(self, *args, **kw)
tr = Transmogrifier(self.context)
print "Iniciando importações"
#Name "import" as registered in this packages configure.zcml
tr("import")
self.request.RESPONSE.redirect(self.context.absolute_url())
示例6: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
pdict = facetParameters(context, request)
self.facet_fields = pdict['fields']
self.facet_types = pdict['types']
self.facet_range_gap = 7 # days
self.friendly_type_names = \
component.queryUtility(
IVocabularyFactory,
name=u'plone.app.vocabularies.ReallyUserFriendlyTypes')(self)
standard = filter(lambda f: self.facet_types[f] == 'standard', self.facet_fields)
ranges = filter(lambda f: self.facet_types[f] == 'range', self.facet_fields)
self.default_query = {'facet': 'true',
'facet.field': standard,
'b_size': 10}
if ranges:
# TODO: need config for these values
self.default_query.update({
'facet.range': ranges,
'facet.range.start': 'NOW/DAY-6MONTHS',
'facet.range.end': 'NOW/DAY',
'facet.range.gap': '+%sDAYS' % self.facet_range_gap,
'facet.range.other': 'all', })
self.submenus = [dict(title=field, id=field) for field in self.facet_fields]
self.queryparam = 'fq'
BrowserView.__init__(self, context, request)
示例7: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.membership = getToolByName(self.context, 'portal_membership')
self.catalog = getToolByName(self.context, 'portal_catalog')
self.portal_url = getToolByName(self.context, 'portal_url')()
self.context_path = '/'.join(self.context.getPhysicalPath())
示例8: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.catalog = getToolByName(context, 'portal_catalog')
portal_properties = getToolByName(context, 'portal_properties')
#gallery_properties = getattr(portal_properties,
# 'gallery_properties')
self.portal_url = getToolByName(aq_inner(context), 'portal_url')()
示例9: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
alsoProvides(request, IDisableCSRFProtection)
BrowserView.__init__(self, context, request)
self.context = context
self.request = request
self.filepath = os.environ.get('DATA_ANALYSIS_PATH')
self.outpath = os.environ.get('TESTRUN_RESULTS_OUTPUT_PATH')
self.threshold = int(
os.environ.get('DATA_ANALYSIS_AGE_THRESHOLD', 12000))
示例10: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self._request_fixups()
self.load_filter_state()
query = self.compose_from_query_state()
self.include_subfolders = 'include_subfolders' in request
self.provider = FacetedListing(self.context,
query,
self.include_subfolders)
self._sorted_filters = {}
示例11: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
sp=getToolByName(context, "portal_properties").site_properties
plone=getMultiAdapter((self.context, self.request), name="plone")
def crop(text):
return plone.cropText(text,
sp.search_results_description_length, sp.ellipsis)
self.crop=crop
self.normalize=getUtility(IIDNormalizer).normalize
self.icons=plone.icons_visible()
self.portal=getMultiAdapter((context, request),
name="plone_portal_state").portal_url()+"/"
示例12: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.mt=getToolByName(self.context, "portal_membership")
self.tool=getToolByName(self.context, TIMETOOLNAME)
self.period=self.request.get("period", "week")
self.person=self.request.get("person", "all")
self.group_by=self.request.get("group_by", "day")
self.today=DateTime()
start = self.request.get("start")
if start is not None:
start = DateTime(start)
else:
start = DateTime()
(self.start, self.end)=DateToPeriod(period=self.period, date=start)
示例13: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
portal_properties = getToolByName(
context,
"portal_properties"
)
self.site_properties = portal_properties.site_properties
plone = getMultiAdapter((self.context, self.request), name="plone")
self.normalize = getUtility(IIDNormalizer).normalize
self.icons = plone.icons_visible()
portal_state = getMultiAdapter(
(context, request),
name="plone_portal_state"
)
self.portal = portal_state.portal_url() + "/"
示例14: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.exporter = getUtility(IBookingExporter)
self.catalog = getToolByName(self.context, "portal_catalog")
if request.form.get("export_type") == "csv":
self.__call__ = self.exportToCsv
elif request.form.get("export_type") == "html":
self.values = self.getValues()
if len(self.values) < 1:
self.context.plone_utils.addPortalMessage(
_(
'info_no_results',
"There is no booking matching your criteria."
),
"info",
)
else:
self.values = None
示例15: __init__
# 需要导入模块: from Products.Five import BrowserView [as 别名]
# 或者: from Products.Five.BrowserView import __init__ [as 别名]
def __init__(self, context, request):
BrowserView.__init__(self, context, request)
self.groupid = request.get('groupid', None)
# Some private attributes which are here for performance reasons.
props = getToolByName(context, 'portal_properties', None)
if props is not None:
stp = getattr(props, 'site_properties', None)
if stp is not None:
self._publicGroups = stp.getProperty('allowedPublicGroups', ())
# If no id is given, use the first one in the allowed list
if self.groupid is None and len(self._publicGroups) > 0:
self.groupid = self._publicGroups[0]
self._groupinfo = {}
self._group = None
self._gtool = getToolByName(context, 'portal_groups', None)
if self._gtool is not None:
self._groupinfo = self._gtool.getGroupInfo(self.groupid) or {}
self._group = self._gtool.getGroupById(self.groupid) or None