Ejemplo n.º 1
0
 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__
Ejemplo n.º 2
0
    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)
 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)
     
Ejemplo n.º 4
0
 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()
 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())
Ejemplo n.º 6
0
    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()
    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())
    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())
Ejemplo n.º 9
0
    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')()
 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))
Ejemplo n.º 11
0
 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 = {}
Ejemplo n.º 12
0
    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() + "/"
Ejemplo n.º 13
0
    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()+"/"
Ejemplo n.º 14
0
    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() + "/"
Ejemplo n.º 15
0
    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)
Ejemplo n.º 16
0
    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() + "/"
Ejemplo n.º 17
0
    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
 def test_relative_path_query9(self):
     # Acquisition can mess us up, for example when a BrowserView
     # is in the acquisition chain, like in
     # plone.app.content.browser.foldercontents
     self.path_crit.setRelativePath('..')   # should give the parent==folderA1 
     from Products.Five import BrowserView
     view = BrowserView(self.topic, self.topic.REQUEST)
     criterion = view.context.getCriterion('path_ATRelativePathCriterion')
     self.failUnless(criterion.getCriteriaItems() == (('path', {'query': '/plone/folderA/folderA1', 'depth': 1}),))
Ejemplo n.º 19
0
 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
Ejemplo n.º 20
0
    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
Ejemplo n.º 21
0
    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
Ejemplo n.º 22
0
    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()
Ejemplo n.º 23
0
    def _data_to_portlet(self, manager, data):
        """Helper method to get the correct IPortletRenderer for the given
        data object.

        Adapted from plone.portlets/manager.py _dataToPortlet.
        """
        if self.show_global:
            target = api.portal.get_navigation_root(self.context)
            # Use dummy view for the target context.
            view = BrowserView(target, self.request)
        else:
            target = self.context
            view = self.view
        return getMultiAdapter((
            target,
            self.request,
            view,
            manager,
            data,
        ), IPortletRenderer)
Ejemplo n.º 24
0
 def __init__(self, context, request):
     #LOG.info("----- Init -----")
     BrowserView.__init__(self, context, request)
     self.context = context
     self.request = request
Ejemplo n.º 25
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.__loggedInUser = None
     self.acl_users = context.acl_users
     self.traverse_subpath = []
Ejemplo n.º 26
0
 def __init__(self, context, request, path=''):
     BrowserView.__init__(self, context, request)
     HTTPGitApplication.__init__(self, backend=self)
     self.path = '/' + path.strip('/')
     self.services = HTTPGitApplication.services.copy()
     self.services.update(self.services_overrides)
Ejemplo n.º 27
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.global_registry=_import_step_registry
     self.tool_registry=context.getImportStepRegistry()
Ejemplo n.º 28
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     request.RESPONSE.setHeader('Content-Type',"text/plain")
Ejemplo n.º 29
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.cat_map = ICategoryMapper(context)
Ejemplo n.º 30
0
 def test_CustomNamedTemplate(self):
     view = BrowserView(self.portal, self.req)
     custom_named_template = queryAdapter(view,
                                          INamedTemplate,
                                          name="datagridref_popup")
     self.assertNotEqual(custom_named_template, None)
Ejemplo n.º 31
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
Ejemplo n.º 32
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.catalog = getToolByName(self.context, 'portal_catalog')
     self.wftool = getToolByName(self.context, 'portal_workflow')
     self.normalizer = getUtility(IIDNormalizer)
Ejemplo n.º 33
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.context = context
     self.request = request
     self.request.set('disable_plone.rightcolumn', 1)
Ejemplo n.º 34
0
 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)
Ejemplo n.º 35
0
    def __init__(self, context, request):
        BrowserView.__init__(self, context, request)

        setUpWidgets(self, ISimpleContact, IInputWidget)
Ejemplo n.º 36
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     #super(BrowserView, self).__init__(context, request)
     self.token = aq_parent(aq_inner(self.context)).token
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.search = zapi.getUtility(ISearchableArchive)
     self._mailing_list = None
     self._can_post = None
     request.set('disable_border', True)
Ejemplo n.º 38
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     CoreError.__init__(self)
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.search = zapi.getUtility(ISearchableArchive)
     self._mailing_list = None
     self._can_post = None
     request.set('disable_border', True)
Ejemplo n.º 40
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.translation_service = getToolByName(self.context, "translation_service")
Ejemplo n.º 41
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
Ejemplo n.º 42
0
 def __init__(self, context, request):
     self.context = context
     BrowserView.__init__(self, context, request)
Ejemplo n.º 43
0
 def __init__(self, context, request, name):
     self.id = "++geoportlet++%s" % name
     countries, languages = name.split(';')
     self.countries = filter(None, countries.split(','))
     self.languages = filter(None, languages.split(','))
     BrowserView.__init__(self, context, request)
Ejemplo n.º 44
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
    #super(BrowserView, self).__init__(context, request)
     self.token = aq_parent(aq_inner(self.context)).token
Ejemplo n.º 45
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     request.RESPONSE.setHeader('Content-Type',"application/xml")
Ejemplo n.º 46
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.context = context
     self.request = request
Ejemplo n.º 47
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.global_registry = _import_step_registry
     self.tool_registry = context.getImportStepRegistry()
Ejemplo n.º 48
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.__loggedInUser = None
     self.acl_users = context.acl_users
     self.traverse_subpath = []
Ejemplo n.º 49
0
    def __init__(self, context, request):
        BrowserView.__init__(self, context, request)

        setUpWidgets(self, ISimpleContact, IInputWidget)
Ejemplo n.º 50
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.context = context
     self.request = request
Ejemplo n.º 51
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     self.__siteInfo = self.__groupsInfo = None
Ejemplo n.º 52
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     CoreError.__init__(self)