Exemplo n.º 1
0
 def setUp(self):
     """
     We create objects before initializing solr settings, so solr core is
     always empty on setUp.
     """
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     set_registry_record(
         'enabled_types',
         ['Document', 'News Item'],
         interface=IRerSolrpushSettings,
     )
     get_registry_record('enabled_types', interface=IRerSolrpushSettings)
     init_solr_push()
     commit()
     self.document = api.content.create(container=self.portal,
                                        type='Document',
                                        title='Document foo')
     api.content.transition(obj=self.document, transition='publish')
     commit()
     self.news = api.content.create(container=self.portal,
                                    type='News Item',
                                    title='News bar')
     api.content.transition(obj=self.news, transition='publish')
     commit()
Exemplo n.º 2
0
    def test_get_invalid_registry_record_msg(self):
        """Test that the error message from trying to get a
        nonexistant registry record produces an error message which
        lists known registry records.
        """
        from plone.api.exc import InvalidParameterError
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='nonexistent.sharepoint.power')

        self.assertTrue(
            str(cm.exception).startswith(
                "Cannot find a record with name "
                "'nonexistent.sharepoint.power'.\n"
            )
        )

        # A selection of records which should exist in all plone versions
        should_be_theres = (
            "plone.app.discussion.interfaces.IDiscussionSettings.captcha",
            "plone.app.querystring.field.Creator.title",
            "plone.app.querystring.operation.int.largerThan.description",
            "plone.app.querystring.operation.selection.is.widget",
        )

        for should_be_there in should_be_theres:
            self.assertIn((should_be_there + '\n'), str(cm.exception))
Exemplo n.º 3
0
def get_inline_style(context, tile_type):
    sizes = {
        'default':
        None,
        'small':
        get_registry_record(
            'castle.font_size_small',
            default=DEFAULT_FONT_SIZE_SMALL,
        ),
        'medium':
        get_registry_record(
            'castle.font_size_medium',
            default=DEFAULT_FONT_SIZE_MEDIUM,
        ),
        'large':
        get_registry_record(
            'castle.font_size_large',
            default=DEFAULT_FONT_SIZE_LARGE,
        ),
        'custom':
        getattr(
            context,
            'font_size_custom_{}'.format(tile_type),
            None,
        )
    }
    font_size_choice_value = getattr(
        context,
        'font_size_choice_{}'.format(tile_type),
        'default',
    )
    custom_font_size = sizes[font_size_choice_value]
    return ('' if not custom_font_size else
            'font-size: {};'.format(custom_font_size))
Exemplo n.º 4
0
 def setUp(self):
     """
     We create objects before initializing solr settings, so solr core is
     always empty on setUp.
     """
     self.portal = self.layer["portal"]
     self.request = self.layer["request"]
     setRoles(self.portal, TEST_USER_ID, ["Manager"])
     set_registry_record("active", False, interface=IRerSolrpushSettings)
     set_registry_record("enabled_types", [u"Document"],
                         interface=IRerSolrpushSettings)
     get_registry_record("enabled_types", interface=IRerSolrpushSettings)
     self.published_doc = api.content.create(container=self.portal,
                                             type="Document",
                                             title="Published Document")
     api.content.transition(obj=self.published_doc, transition="publish")
     self.unpublished_doc = api.content.create(
         container=self.portal,
         type="Document",
         title="Unpublished Document",
     )
     self.news = api.content.create(container=self.portal,
                                    type="News Item",
                                    title="Unpublished News")
     # flush catalog queue
     api.portal.get_tool("portal_catalog")()  # or commit()
     init_solr_push()
     set_registry_record("active", True, interface=IRerSolrpushSettings)
Exemplo n.º 5
0
    def test_get_invalid_registry_record_msg(self):
        """Test that the error message from trying to get a
        nonexistant registry record produces an error message which
        lists known registry records.
        """
        from plone.api.exc import InvalidParameterError
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='nonexistent.sharepoint.power')

        self.assertTrue(
            str(cm.exception).startswith(
                "Cannot find a record with name "
                "'nonexistent.sharepoint.power'.\n"
            )
        )

        # A selection of records which should exist in all plone versions
        should_be_theres = (
            "plone.app.discussion.interfaces.IDiscussionSettings.captcha",
            "plone.app.querystring.field.Creator.title",
            "plone.app.querystring.operation.int.largerThan.description",
            "plone.app.querystring.operation.selection.is.widget",
        )

        for should_be_there in should_be_theres:
            self.assertIn((should_be_there + '\n'), str(cm.exception))
Exemplo n.º 6
0
 def test_get_invalid_interface_for_registry_record(self):
     """Test that passing an invalid interface raises an Exception."""
     from plone.api.exc import InvalidParameterError
     with self.assertRaises(InvalidParameterError):
         portal.get_registry_record(
             'something',
             interface=ImNotAnInterface,
         )
Exemplo n.º 7
0
 def test_get_invalid_interface_for_registry_record(self):
     """Test that passing an invalid interface raises an Exception."""
     from plone.api.exc import InvalidParameterError
     with self.assertRaises(InvalidParameterError):
         portal.get_registry_record(
             'something',
             interface=ImNotAnInterface
         )
Exemplo n.º 8
0
    def test_get_existing_registry_record(self):
        """Test that existing registry records are returned correctly."""
        registry = getUtility(IRegistry)
        registry.records["plone.api.norris_power"] = Record(field.TextLine(title=u"Chuck Norris' Power"))
        registry.records["plone.api.unset"] = Record(field.TextLine(title=u"An unset field"))
        registry["plone.api.norris_power"] = u"infinite"

        self.assertEqual(portal.get_registry_record("plone.api.norris_power"), u"infinite")

        self.assertEqual(portal.get_registry_record("plone.api.unset"), None)
Exemplo n.º 9
0
    def test_get_invalid_interface_for_registry_record_msg(self):
        """Test that a helpful message is shown when passing an invalid
        interface.
        """
        from plone.api.exc import InvalidParameterError
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record('something', interface=ImNotAnInterface)
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith('The interface parameter has to '))
Exemplo n.º 10
0
    def test_get_invalid_record_in_interface_for_registry_record(self):
        """Test that trying to get an invalid field from an interface raises
        an Exception.
        """
        from plone.api.exc import InvalidParameterError
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        with self.assertRaises(InvalidParameterError):
            portal.get_registry_record('non_existing_field',
                                       interface=IMyRegistrySettings)
Exemplo n.º 11
0
    def test_get_invalid_record_with_default(self):
        """ If get_registry_record is called with a default parameter
        and the record cannot be resolved
        the default will be returned instead of raising InvalidParameterError
        """
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        self.assertEqual(
            portal.get_registry_record('non_existing_field',
                                       interface=IMyRegistrySettings,
                                       default=1), 1)
        self.assertEqual(portal.get_registry_record('something', default=2), 2)
Exemplo n.º 12
0
    def test_get_invalid_registry_record_msg(self):
        """Test that the error message from trying to get a
        nonexistant registry record produces an error message which
        lists suggested registry records.
        """
        from plone.api.exc import InvalidParameterError

        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='nonexistent.sharepoint.power')
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith("Cannot find a record with name"))
Exemplo n.º 13
0
    def test_get_invalid_registry_record_msg(self):
        """Test that the error message from trying to get a
        nonexistant registry record produces an error message which
        lists suggested registry records.
        """
        from plone.api.exc import InvalidParameterError

        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='nonexistent.sharepoint.power')
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith('Cannot find a record with name'))
Exemplo n.º 14
0
    def test_get_invalid_record_in_interface_for_registry_record(self):
        """Test that trying to get an invalid field from an interface raises
        an Exception.
        """
        from plone.api.exc import InvalidParameterError
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        with self.assertRaises(InvalidParameterError):
            portal.get_registry_record(
                'non_existing_field',
                interface=IMyRegistrySettings
            )
Exemplo n.º 15
0
    def test_get_invalid_interface_for_registry_record_msg(self):
        """Test that a helpful message is shown when passing an invalid
        interface.
        """
        from plone.api.exc import InvalidParameterError
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(
                'something',
                interface=ImNotAnInterface
            )
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith('The interface parameter has to '))
Exemplo n.º 16
0
 def get_description(self, taxonomy_term=None):
     if not taxonomy_term:
         taxonomy_term = self.request.form.get("taxonomy_term")
     if not taxonomy_term:
         return " "
     current_lang = api.portal.get_current_language()[:2]
     normalizer = getUtility(IIDNormalizer)
     if IIAmFolder.providedBy(self.context):
         taxonomy_id = "collective.taxonomy.iam"
         record_id = "iam_taxonomy_description"
     elif IISearchFolder.providedBy(self.context):
         taxonomy_id = "collective.taxonomy.isearch"
         record_id = "isearch_taxonomy_description"
     else:
         return " "
     mapping = get_registry_record("{0}.{1}".format(
         "collective.iamisearch.interfaces.IIamIsearchSettings",
         record_id,
     ))
     if mapping is None:
         return " "
     taxonomy = getUtility(ITaxonomy, name=taxonomy_id)
     data = taxonomy.inverted_data.get(current_lang)
     for key, value in data.items():
         normalized_value = normalizer.normalize(value)
         if taxonomy_term == key or taxonomy_term == normalized_value:
             for line in mapping:
                 if key == line["term"] and current_lang == line["lang"]:
                     return line["text"]
     return " "
Exemplo n.º 17
0
 def get_resource_view_url(self, resource):
     view_types = get_registry_record(
         'plone.types_use_view_action_in_listings') or []
     url = resource.absolute_url()
     if resource.portal_type in view_types:
         url += '/view'
     return url
Exemplo n.º 18
0
    def _get_recently_touched(self, user_id):
        """Get the list of recently touched objects, minus checked out docs.

        This list is compiled by reading recently touched log for the given
        user_id, subtracting any checked out documents (because those are
        already displayed in the other list), and combining them with
        catalog brains (by UID) for any information other than the timestamp.

        Timestamps used for display and ordering are fully based on the
        recently touched log, the catalog's 'modified' timestamp isn't being
        used here.

        This is because 'modified' is a very technical timestamp,
        and it's very hard to control when it does or does not get updated.
        Therefore we use our separate timestamp when an object gets tagged
        as "touched" so we control the semantics.
        """
        portal = api.portal.get()
        catalog = api.portal.get_tool('portal_catalog')

        recently_touched_log = IAnnotations(portal).get(
            RECENTLY_TOUCHED_KEY, {}).get(user_id, [])

        # Subtract checked out docs from recently touched list
        checked_out_brains = self._get_checked_out_brains(user_id)
        checked_out_uids = [b.UID for b in checked_out_brains]
        touched_only_uids = [m['uid'] for m in recently_touched_log
                             if m['uid'] not in checked_out_uids]

        touched_brains = catalog(
            UID=touched_only_uids,
            object_provides=[i.__identifier__
                             for i in RECENTLY_TOUCHED_INTERFACES_TO_TRACK],
        )

        touched_brains_by_uid = {b.UID: b for b in touched_brains}

        entries = []
        for entry in recently_touched_log:
            brain = touched_brains_by_uid.get(entry['uid'])
            if brain is None:
                # Might have checked out docs in storage, or items that don't
                # match the currently tracked types
                continue

            data = {
                "icon_class": get_css_class(brain),
                "last_touched": entry['last_touched'].isoformat(),
                "target_url": brain.getURL(),
                "title": brain.Title,
            }
            entries.append(data)

        # Truncate list to currently configured limit (storage might still
        # contain more entries until they get rotated out).
        limit = get_registry_record('limit', IRecentlyTouchedSettings)
        entries = entries[:limit]

        return entries
Exemplo n.º 19
0
 def getAuthUrl(self):
     portal_url = portal.get().absolute_url()
     clientid = portal.get_registry_record(interface=IPFGSharePointConfig,
                                           name='clientid')
     auth_url = "https://login.microsoftonline.com/common"
     auth_url += '/adminconsent?client_id=' + clientid
     auth_url += '&redirect_uri=' + portal_url + '/@@sharepoint-permissions'
     return auth_url
Exemplo n.º 20
0
 def __call__(self, context, query=None):
     tenants = get_registry_record(interface=IPFGSharePointConfig,
                                   name="tenants")
     tenants = [
         SimpleTerm(t, t, props.get('displayName', t))
         for t, props in tenants.items()
     ]
     return SimpleVocabulary(tenants)
Exemplo n.º 21
0
def create(email=None, username=None, password=None, roles=("Member",), properties=None):
    """Create a user.

    :param email: [required] Email for the new user.
    :type email: string
    :param username: Username for the new user. This is required if email
        is not used as a username.
    :type username: string
    :param password: Password for the new user. If it's not set we generate
        a random 8-char alpha-numeric one.
    :type password: string
    :param properties: User properties to assign to the new user. The list of
        available properties is available in ``portal_memberdata`` through ZMI.
    :type properties: dict
    :returns: Newly created user
    :rtype: MemberData object
    :raises:
        MissingParameterError
        InvalidParameterError
    :Example: :ref:`user_create_example`
    """
    if properties is None:
        # Never use a dict as default for a keyword argument.
        properties = {}

    # it may happen that someone passes email in the properties dict, catch
    # that and set the email so the code below this works fine
    if not email and properties.get("email"):
        email = properties.get("email")

    if not email:
        raise MissingParameterError("You need to pass the new user's email.")

    try:
        use_email_as_username = portal.get_registry_record("plone.use_email_as_login")
    except InvalidParameterError:
        site = portal.get()
        props = site.portal_properties
        use_email_as_username = props.site_properties.use_email_as_login

    if not use_email_as_username and not username:
        raise InvalidParameterError(
            "The portal is configured to use username " "that is not email so you need to pass a username."
        )

    registration = portal.get_tool("portal_registration")
    user_id = use_email_as_username and email or username

    # Generate a random 8-char password
    if not password:
        chars = string.ascii_letters + string.digits
        password = "".join(random.choice(chars) for x in range(8))

    properties.update(username=user_id)
    properties.update(email=email)

    registration.addMember(user_id, password, roles, properties=properties)
    return get(username=user_id)
    def _get_recently_touched(self, user_id):
        """Get the list of recently touched objects, minus checked out docs.

        This list is compiled by reading recently touched log for the given
        user_id, subtracting any checked out documents (because those are
        already displayed in the other list), and combining them with
        catalog brains (by UID) for any information other than the timestamp.

        Timestamps used for display and ordering are fully based on the
        recently touched log, the catalog's 'modified' timestamp isn't being
        used here.

        This is because 'modified' is a very technical timestamp,
        and it's very hard to control when it does or does not get updated.
        Therefore we use our separate timestamp when an object gets tagged
        as "touched" so we control the semantics.
        """
        portal = api.portal.get()
        catalog = api.portal.get_tool('portal_catalog')

        recently_touched_log = IAnnotations(portal).get(
            RECENTLY_TOUCHED_KEY, {}).get(user_id, [])

        # Subtract checked out docs from recently touched list
        checked_out_brains = self._get_checked_out_brains(user_id)
        checked_out_uids = [b.UID for b in checked_out_brains]
        touched_only_uids = [
            m['uid'] for m in recently_touched_log
            if m['uid'] not in checked_out_uids
        ]

        touched_brains = catalog(
            UID=touched_only_uids,
            object_provides=[
                i.__identifier__ for i in RECENTLY_TOUCHED_INTERFACES_TO_TRACK
            ],
        )

        touched_brains_by_uid = {b.UID: b for b in touched_brains}

        entries = []
        for entry in recently_touched_log:
            brain = touched_brains_by_uid.get(entry['uid'])
            if brain is None:
                # Might have checked out docs in storage, or items that don't
                # match the currently tracked types
                continue

            entries.append(
                self.serialize_brain(brain, entry['last_touched'].isoformat()))

        # Truncate list to currently configured limit (storage might still
        # contain more entries until they get rotated out).
        limit = get_registry_record('limit', IRecentlyTouchedSettings)
        entries = entries[:limit]

        return entries
Exemplo n.º 23
0
    def test_get_existing_registry_record(self):
        """Test that existing registry records are returned correctly."""
        registry = getUtility(IRegistry)
        registry.records['plone.api.norris_power'] = Record(
            field.TextLine(title=u"Chuck Norris' Power"))
        registry.records['plone.api.unset'] = Record(
            field.TextLine(title=u"An unset field"))
        registry['plone.api.norris_power'] = u'infinite'

        self.assertEqual(
            portal.get_registry_record('plone.api.norris_power'),
            u'infinite',
        )

        self.assertEqual(
            portal.get_registry_record('plone.api.unset'),
            None,
        )
Exemplo n.º 24
0
    def test_get_invalid_record_in_interface_for_registry_record_msg(self):
        """Test that a helpful message is shown when trying to get an invalid
        field from an interface.
        """
        from plone.api.exc import InvalidParameterError
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record('non_existing_field',
                                       interface=IMyRegistrySettings)
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith('Cannot find a record with name '))
        self.assertTrue(exc_str.find(' on interface ') != -1)
        self.assertTrue(exc_str.find('field_one') != -1)
        self.assertTrue(exc_str.find('field_two') != -1)
Exemplo n.º 25
0
    def test_get_existing_registry_record(self):
        """Test that existing registry records are returned correctly."""
        registry = getUtility(IRegistry)
        registry.records['plone.api.norris_power'] = Record(
            field.TextLine(title=u"Chuck Norris' Power"))
        registry.records['plone.api.unset'] = Record(
            field.TextLine(title=u'An unset field'))
        registry['plone.api.norris_power'] = u'infinite'

        self.assertEqual(
            portal.get_registry_record('plone.api.norris_power'),
            u'infinite',
        )

        self.assertEqual(
            portal.get_registry_record('plone.api.unset'),
            None,
        )
Exemplo n.º 26
0
    def test_get_registry_record_from_interface(self):
        """Test that getting a record from an interface works."""
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        self.assertEqual(
            portal.get_registry_record('field_one',
                                       interface=IMyRegistrySettings),
            None,
        )
Exemplo n.º 27
0
 def uris(self):
     uris = portal.get_registry_record(
         name=self.uri_registry_key, interface=self.uri_registry_interface)
     result = []
     for uri in uris:
         if uri.startswith('http') or uri.startswith('/'):
             result.append(uri)
         else:
             dir_path = os.path.dirname(os.path.realpath(__file__))
             result.append(os.path.join(dir_path, uri))
     return result
Exemplo n.º 28
0
    def test_get_invalid_registry_record_suggestions(self):
        from plone.api.exc import InvalidParameterError

        # Check without suggestion
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='a random unique string')
        exc_str = str(cm.exception)

        # Check for an error, but no suggestions.
        self.assertTrue(exc_str.startswith('Cannot find a record with name'))
        self.assertFalse('Did you mean?:' in exc_str)

        # Check with suggestions
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='querystring')
        exc_str = str(cm.exception)

        # Check for an error with suggestions.
        self.assertTrue(exc_str.startswith('Cannot find a record with name'))
        self.assertTrue('Did you mean?:' in exc_str)
Exemplo n.º 29
0
    def test_get_invalid_record_in_interface_for_registry_record_msg(self):
        """Test that a helpful message is shown when trying to get an invalid
        field from an interface.
        """
        from plone.api.exc import InvalidParameterError
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(
                'non_existing_field',
                interface=IMyRegistrySettings
            )
        exc_str = str(cm.exception)

        # Check if there is an error message.
        self.assertTrue(exc_str.startswith('Cannot find a record with name '))
        self.assertTrue(exc_str.find(' on interface ') != -1)
        self.assertTrue(exc_str.find('field_one') != -1)
        self.assertTrue(exc_str.find('field_two') != -1)
Exemplo n.º 30
0
    def test_get_invalid_registry_record_suggestions(self):
        from plone.api.exc import InvalidParameterError

        # Check without suggestion
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='a random unique string')
        exc_str = str(cm.exception)

        # Check for an error, but no suggestions.
        self.assertTrue(exc_str.startswith("Cannot find a record with name"))
        self.assertFalse('Did you mean?:' in exc_str)

        # Check with suggestions
        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='querystring')
        exc_str = str(cm.exception)

        # Check for an error with suggestions.
        self.assertTrue(exc_str.startswith("Cannot find a record with name"))
        self.assertTrue('Did you mean?:' in exc_str)
Exemplo n.º 31
0
    def test_get_registry_record_from_interface(self):
        """Test that getting a record from an interface works."""
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        self.assertEqual(
            portal.get_registry_record(
                'field_one',
                interface=IMyRegistrySettings
            ),
            None,
        )
Exemplo n.º 32
0
    def test_set_registry_record_from_interface(self):
        """Test that setting a value on a record from an interface works."""
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        text = u'random text'
        portal.set_registry_record('field_one',
                                   text,
                                   interface=IMyRegistrySettings)
        self.assertEqual(
            portal.get_registry_record('field_one',
                                       interface=IMyRegistrySettings), text)
Exemplo n.º 33
0
 def handle_update_default(self, data, type):
     should_update_registy = data.get('update_default_{}'.format(type),
                                      False)
     form_value = data.get('view_more_{}'.format(type), None)
     if should_update_registy and form_value:
         record_name = 'castle.resource_slide_view_more_{}'.format(type)
         try:
             default_value = get_registry_record(record_name)
         except Exception:
             return
         if form_value != default_value:
             set_registry_record(record_name, form_value)
     data['update_default_{}'.format(type)] = False
Exemplo n.º 34
0
    def test_get_registry_record(self):
        registry = getUtility(IRegistry)
        registry.records['plone.api.norris_power'] = Record(
            field.TextLine(title=u"Chuck Norris' Power"))
        registry['plone.api.norris_power'] = u'infinite'

        self.assertRaises(KeyError, portal.get_registry_record,
                          name='nonexistent.sharepoint.power')
        self.assertRaises(MissingParameterError, portal.get_registry_record)
        self.assertRaises(InvalidParameterError, portal.get_registry_record,
                          name=dict({'foo': 'bar'}))
        self.assertEqual(portal.get_registry_record('plone.api.norris_power'),
                         u'infinite')
Exemplo n.º 35
0
    def test_get_invalid_record_with_default(self):
        """ If get_registry_record is called with a default parameter
        and the record cannot be resolved
        the default will be returned instead of raising InvalidParameterError
        """
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        self.assertEqual(
            portal.get_registry_record(
                'non_existing_field',
                interface=IMyRegistrySettings,
                default=1
            ),
            1
        )
        self.assertEqual(
            portal.get_registry_record(
                'something',
                default=2
            ),
            2
        )
Exemplo n.º 36
0
    def rotate(self, user_id):
        """Rotate recently touched log.

        We basically truncate it to the RECENTLY_TOUCHED_LIMIT.

        However, because the display limit only applies to recently touched
        items (not checked out docs), we need to take care to calculate the
        correct cutoff by "ignoring" checked out docs (adding them to the
        cutoff limit).
        """
        num_checked_out = len(self.catalog(checked_out=user_id))
        limit = get_registry_record('limit', IRecentlyTouchedSettings)
        cutoff = limit + num_checked_out
        truncated = self.get_recently_touched_log(user_id)[:cutoff]
        IAnnotations(self.portal)[RECENTLY_TOUCHED_KEY][user_id] = truncated
Exemplo n.º 37
0
    def rotate(self, user_id):
        """Rotate recently touched log.

        We basically truncate it to the RECENTLY_TOUCHED_LIMIT.

        However, because the display limit only applies to recently touched
        items (not checked out docs), we need to take care to calculate the
        correct cutoff by "ignoring" checked out docs (adding them to the
        cutoff limit).
        """
        num_checked_out = len(self.catalog(checked_out=user_id))
        limit = get_registry_record('limit', IRecentlyTouchedSettings)
        cutoff = limit + num_checked_out
        truncated = unprotected_write(self.get_recently_touched_log(user_id)[:cutoff])
        unprotected_write(IAnnotations(self.portal)[RECENTLY_TOUCHED_KEY])[user_id] = truncated
Exemplo n.º 38
0
 def __call__(self):
     tenant = self.request.form.get('tenant')
     tenant = unicode(tenant)
     consent = self.request.form.get('admin_consent')
     if tenant and consent and consent.lower() == "true":
         #tenant is GUID
         tenants = portal.get_registry_record(
             interface=IPFGSharePointConfig, name='tenants')
         if not tenants:
             tenants = {}
         if tenant not in tenants:
             tenants[tenant] = {}
             tenants[tenant][u'token'] = u''
             portal.set_registry_record(interface=IPFGSharePointConfig,
                                        name='tenants',
                                        value=tenants)
     return self.index()
Exemplo n.º 39
0
    def test_set_registry_record_from_interface(self):
        """Test that setting a value on a record from an interface works."""
        registry = getUtility(IRegistry)
        registry.registerInterface(IMyRegistrySettings)

        text = u'random text'
        portal.set_registry_record(
            'field_one',
            text,
            interface=IMyRegistrySettings
        )
        self.assertEqual(
            portal.get_registry_record(
                'field_one',
                interface=IMyRegistrySettings
            ),
            text
        )
Exemplo n.º 40
0
    def test_send_email_with_printingmailhost(self):
        """ Test that send_email does not raise an exception when
        Products.PrintingMailHost is installed and active.
        """
        old_flag = portal.PRINTINGMAILHOST_ENABLED

        if HAS_PLONE5:
            old_value = portal.get_registry_record('plone.email_from_address')
            portal.set_registry_record('plone.email_from_address', '')  # ASCII
        else:
            old_smtp_host = self.portal.MailHost.smtp_host
            self.portal.MailHost.smtp_host = None

        # PrintingMailHost disabled
        portal.PRINTINGMAILHOST_ENABLED = False
        with self.assertRaises(ValueError):
            portal.send_email(
                recipient='*****@*****.**',
                sender='*****@*****.**',
                subject='Trappist',
                body=u'One for you Bob!',
            )

        # PrintingMailHost enabled
        portal.PRINTINGMAILHOST_ENABLED = True
        portal.send_email(
            recipient='*****@*****.**',
            sender='*****@*****.**',
            subject='Trappist',
            body=u'One for you Bob!',
        )

        # Prevents sideeffects in other tests.
        if HAS_PLONE5:
            portal.set_registry_record('plone.email_from_address', old_value)
        else:
            self.portal.MailHost.smtp_host = old_smtp_host
        portal.PRINTINGMAILHOST_ENABLED = old_flag
Exemplo n.º 41
0
    def test_send_email_with_printingmailhost(self):
        """ Test that send_email does not raise an exception when
        Products.PrintingMailHost is installed and active.
        """
        old_flag = portal.PRINTINGMAILHOST_ENABLED

        if HAS_PLONE5:
            old_value = portal.get_registry_record('plone.email_from_address')
            portal.set_registry_record('plone.email_from_address', '')  # ASCII
        else:
            old_smtp_host = self.portal.MailHost.smtp_host
            self.portal.MailHost.smtp_host = None

        # PrintingMailHost disabled
        portal.PRINTINGMAILHOST_ENABLED = False
        with self.assertRaises(ValueError):
            portal.send_email(
                recipient='*****@*****.**',
                sender='*****@*****.**',
                subject='Trappist',
                body=u'One for you Bob!'
            )

        # PrintingMailHost enabled
        portal.PRINTINGMAILHOST_ENABLED = True
        portal.send_email(
            recipient='*****@*****.**',
            sender='*****@*****.**',
            subject='Trappist',
            body=u'One for you Bob!',
        )

        # Prevents sideeffects in other tests.
        if HAS_PLONE5:
            portal.set_registry_record('plone.email_from_address', old_value)
        else:
            self.portal.MailHost.smtp_host = old_smtp_host
        portal.PRINTINGMAILHOST_ENABLED = old_flag
Exemplo n.º 42
0
    def test_item_not_indexed_if_solrpush_is_not_ready(self):
        solr_url = get_registry_record('solr_url', IRerSolrpushSettings)
        api.content.create(container=self.portal, type='Document', title='foo')
        commit()
        res = requests.get('{}/select?q=*%3A*&wt=json'.format(solr_url)).json()
        self.assertEquals(res['response']['numFound'], 0)

        init_solr_push()

        api.content.create(container=self.portal, type='Document', title='bar')
        commit()
        res = requests.get('{}/select?q=*%3A*&wt=json'.format(solr_url)).json()

        # because initial state id private
        self.assertEquals(res['response']['numFound'], 0)

        # File types has no wf, so they are published
        api.content.create(container=self.portal,
                           type='File',
                           title='bar file')
        commit()
        res = requests.get('{}/select?q=*%3A*&wt=json'.format(solr_url)).json()
        self.assertEquals(res['response']['numFound'], 1)
Exemplo n.º 43
0
    def test_item_not_indexed_if_solrpush_is_not_ready(self):
        solr_url = get_registry_record("solr_url", IRerSolrpushSettings)
        api.content.create(container=self.portal, type="Document", title="foo")
        commit()
        res = requests.get("{}/select?q=*%3A*&wt=json".format(solr_url)).json()
        self.assertEqual(res["response"]["numFound"], 0)

        init_solr_push()

        api.content.create(container=self.portal, type="Document", title="bar")
        commit()
        res = requests.get("{}/select?q=*%3A*&wt=json".format(solr_url)).json()

        # because initial state id private
        self.assertEqual(res["response"]["numFound"], 0)

        # File types has no wf, so they are published
        api.content.create(
            container=self.portal, type="File", title="bar file"
        )
        commit()
        res = requests.get("{}/select?q=*%3A*&wt=json".format(solr_url)).json()
        self.assertEqual(res["response"]["numFound"], 1)
Exemplo n.º 44
0
    def test_send_email_without_configured_mailhost(self):
        """By default, the MailHost is not configured yet, so we cannot
        send email.
        """
        if HAS_PLONE5:
            old_value = portal.get_registry_record('plone.email_from_address')
            portal.set_registry_record('plone.email_from_address', '')  # ASCII
        else:
            old_smtp_host = self.portal.MailHost.smtp_host
            self.portal.MailHost.smtp_host = None

        with self.assertRaises(ValueError):
            portal.send_email(
                recipient="*****@*****.**",
                sender="*****@*****.**",
                subject="Trappist",
                body=u"One for you Bob!",
            )

        if HAS_PLONE5:
            portal.set_registry_record('plone.email_from_address', old_value)
        else:
            self.portal.MailHost.smtp_host = old_smtp_host
Exemplo n.º 45
0
    def test_send_email_without_configured_mailhost(self):
        """By default, the MailHost is not configured yet, so we cannot
        send email.
        """
        if HAS_PLONE5:
            old_value = portal.get_registry_record('plone.email_from_address')
            portal.set_registry_record('plone.email_from_address', '')  # ASCII
        else:
            old_smtp_host = self.portal.MailHost.smtp_host
            self.portal.MailHost.smtp_host = None

        with self.assertRaises(ValueError):
            portal.send_email(
                recipient='*****@*****.**',
                sender='*****@*****.**',
                subject='Trappist',
                body=u'One for you Bob!',
            )

        if HAS_PLONE5:
            portal.set_registry_record('plone.email_from_address', old_value)
        else:
            self.portal.MailHost.smtp_host = old_smtp_host
Exemplo n.º 46
0
def create(email=None,
           username=None,
           password=None,
           roles=('Member', ),
           properties=None):
    """Create a user.

    :param email: [required] Email for the new user.
    :type email: string
    :param username: Username for the new user. This is required if email
        is not used as a username.
    :type username: string
    :param password: Password for the new user. If it's not set we generate
        a random 8-char alpha-numeric one.
    :type password: string
    :param properties: User properties to assign to the new user. The list of
        available properties is available in ``portal_memberdata`` through ZMI.
    :type properties: dict
    :returns: Newly created user
    :rtype: MemberData object
    :raises:
        MissingParameterError
        InvalidParameterError
    :Example: :ref:`user_create_example`
    """
    if properties is None:
        # Never use a dict as default for a keyword argument.
        properties = {}

    # it may happen that someone passes email in the properties dict, catch
    # that and set the email so the code below this works fine
    if not email and properties.get('email'):
        email = properties.get('email')

    if not email:
        raise MissingParameterError("You need to pass the new user's email.")

    try:
        use_email_as_username = portal.get_registry_record(
            'plone.use_email_as_login')
    except InvalidParameterError:
        site = portal.get()
        props = site.portal_properties
        use_email_as_username = props.site_properties.use_email_as_login

    if not use_email_as_username and not username:
        raise InvalidParameterError(
            'The portal is configured to use username '
            'that is not email so you need to pass a username.')

    registration = portal.get_tool('portal_registration')
    user_id = use_email_as_username and email or username

    # Generate a random 8-char password
    if not password:
        chars = string.ascii_letters + string.digits
        password = ''.join(random.choice(chars) for x in range(8))

    properties.update(username=user_id)
    properties.update(email=email)

    registration.addMember(user_id, password, roles, properties=properties)
    return get(username=user_id)
Exemplo n.º 47
0
def getClient(tenantid):
    clientid = get_registry_record(interface=IPFGSharePointConfig,
                                   name='clientid')
    clientsecret = get_registry_record(interface=IPFGSharePointConfig,
                                       name='clientsecret')
    return Client(clientid, tenantid, clientsecret)
Exemplo n.º 48
0
 def test_get_invalid_registry_record(self):
     """Test that getting an invalid registry record raises an Exception."""
     from plone.api.exc import InvalidParameterError
     with self.assertRaises(InvalidParameterError):
         portal.get_registry_record(name=dict({'foo': 'bar'}))
Exemplo n.º 49
0
 def test_get_missing_registry_record(self):
     """Test that getting a missing registry record raises an Exception."""
     from plone.api.exc import MissingParameterError
     with self.assertRaises(MissingParameterError):
         portal.get_registry_record()
Exemplo n.º 50
0
    def test_get_registry_record(self):
        registry = getUtility(IRegistry)
        registry.records['plone.api.norris_power'] = Record(
            field.TextLine(title=u"Chuck Norris' Power"))
        registry.records['plone.api.unset'] = Record(
            field.TextLine(title=u"An unset field"))
        registry['plone.api.norris_power'] = u'infinite'

        self.assertEqual(
            portal.get_registry_record('plone.api.norris_power'),
            u'infinite',
        )
        self.assertEqual(
            portal.get_registry_record('plone.api.unset'),
            None,
        )

        with self.assertRaises(MissingParameterError):
            portal.get_registry_record()

        with self.assertRaises(InvalidParameterError):
            portal.get_registry_record(name=dict({'foo': 'bar'}))

        with self.assertRaises(InvalidParameterError) as cm:
            portal.get_registry_record(name='nonexistent.sharepoint.power')

        self.maxDiff = None  # to see assert diff
        self.assertMultiLineEqual(
            cm.exception.message,
            "Cannot find a record with name 'nonexistent.sharepoint.power'.\n"
            "Available records are:\n"
            "Products.ResourceRegistries.interfaces.settings.IResourceRegistriesSettings.resourceBundlesForThemes\n"
            "plone.api.norris_power\n"
            "plone.api.unset\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.anonymous_comments\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.captcha\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.globally_enabled\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.moderation_enabled\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.moderator_email\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.moderator_notification_enabled\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.show_commenter_image\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.text_transform\n"
            "plone.app.discussion.interfaces.IDiscussionSettings.user_notification_enabled\n"
            "plone.app.querystring.field.Creator.description\n"
            "plone.app.querystring.field.Creator.enabled\n"
            "plone.app.querystring.field.Creator.group\n"
            "plone.app.querystring.field.Creator.operations\n"
            "plone.app.querystring.field.Creator.sortable\n"
            "plone.app.querystring.field.Creator.title\n"
            "plone.app.querystring.field.Creator.vocabulary\n"
            "plone.app.querystring.field.Description.description\n"
            "plone.app.querystring.field.Description.enabled\n"
            "plone.app.querystring.field.Description.group\n"
            "plone.app.querystring.field.Description.operations\n"
            "plone.app.querystring.field.Description.sortable\n"
            "plone.app.querystring.field.Description.title\n"
            "plone.app.querystring.field.Description.vocabulary\n"
            "plone.app.querystring.field.SearchableText.description\n"
            "plone.app.querystring.field.SearchableText.enabled\n"
            "plone.app.querystring.field.SearchableText.group\n"
            "plone.app.querystring.field.SearchableText.operations\n"
            "plone.app.querystring.field.SearchableText.sortable\n"
            "plone.app.querystring.field.SearchableText.title\n"
            "plone.app.querystring.field.SearchableText.vocabulary\n"
            "plone.app.querystring.field.Subject.description\n"
            "plone.app.querystring.field.Subject.enabled\n"
            "plone.app.querystring.field.Subject.group\n"
            "plone.app.querystring.field.Subject.operations\n"
            "plone.app.querystring.field.Subject.sortable\n"
            "plone.app.querystring.field.Subject.title\n"
            "plone.app.querystring.field.Subject.vocabulary\n"
            "plone.app.querystring.field.Title.description\n"
            "plone.app.querystring.field.Title.enabled\n"
            "plone.app.querystring.field.Title.group\n"
            "plone.app.querystring.field.Title.operations\n"
            "plone.app.querystring.field.Title.sortable\n"
            "plone.app.querystring.field.Title.title\n"
            "plone.app.querystring.field.Title.vocabulary\n"
            "plone.app.querystring.field.created.description\n"
            "plone.app.querystring.field.created.enabled\n"
            "plone.app.querystring.field.created.group\n"
            "plone.app.querystring.field.created.operations\n"
            "plone.app.querystring.field.created.sortable\n"
            "plone.app.querystring.field.created.title\n"
            "plone.app.querystring.field.created.vocabulary\n"
            "plone.app.querystring.field.effective.description\n"
            "plone.app.querystring.field.effective.enabled\n"
            "plone.app.querystring.field.effective.group\n"
            "plone.app.querystring.field.effective.operations\n"
            "plone.app.querystring.field.effective.sortable\n"
            "plone.app.querystring.field.effective.title\n"
            "plone.app.querystring.field.effective.vocabulary\n"
            "plone.app.querystring.field.effectiveRange.description\n"
            "plone.app.querystring.field.effectiveRange.enabled\n"
            "plone.app.querystring.field.effectiveRange.group\n"
            "plone.app.querystring.field.effectiveRange.operations\n"
            "plone.app.querystring.field.effectiveRange.sortable\n"
            "plone.app.querystring.field.effectiveRange.title\n"
            "plone.app.querystring.field.effectiveRange.vocabulary\n"
            "plone.app.querystring.field.end.description\n"
            "plone.app.querystring.field.end.enabled\n"
            "plone.app.querystring.field.end.group\n"
            "plone.app.querystring.field.end.operations\n"
            "plone.app.querystring.field.end.sortable\n"
            "plone.app.querystring.field.end.title\n"
            "plone.app.querystring.field.end.vocabulary\n"
            "plone.app.querystring.field.expires.description\n"
            "plone.app.querystring.field.expires.enabled\n"
            "plone.app.querystring.field.expires.group\n"
            "plone.app.querystring.field.expires.operations\n"
            "plone.app.querystring.field.expires.sortable\n"
            "plone.app.querystring.field.expires.title\n"
            "plone.app.querystring.field.expires.vocabulary\n"
            "plone.app.querystring.field.getId.description\n"
            "plone.app.querystring.field.getId.enabled\n"
            "plone.app.querystring.field.getId.group\n"
            "plone.app.querystring.field.getId.operations\n"
            "plone.app.querystring.field.getId.sortable\n"
            "plone.app.querystring.field.getId.title\n"
            "plone.app.querystring.field.getId.vocabulary\n"
            "plone.app.querystring.field.getObjPositionInParent.description\n"
            "plone.app.querystring.field.getObjPositionInParent.enabled\n"
            "plone.app.querystring.field.getObjPositionInParent.group\n"
            "plone.app.querystring.field.getObjPositionInParent.operations\n"
            "plone.app.querystring.field.getObjPositionInParent.sortable\n"
            "plone.app.querystring.field.getObjPositionInParent.title\n"
            "plone.app.querystring.field.getObjPositionInParent.vocabulary\n"
            "plone.app.querystring.field.getRawRelatedItems.description\n"
            "plone.app.querystring.field.getRawRelatedItems.enabled\n"
            "plone.app.querystring.field.getRawRelatedItems.group\n"
            "plone.app.querystring.field.getRawRelatedItems.operations\n"
            "plone.app.querystring.field.getRawRelatedItems.sortable\n"
            "plone.app.querystring.field.getRawRelatedItems.title\n"
            "plone.app.querystring.field.getRawRelatedItems.vocabulary\n"
            "plone.app.querystring.field.isDefaultPage.description\n"
            "plone.app.querystring.field.isDefaultPage.enabled\n"
            "plone.app.querystring.field.isDefaultPage.group\n"
            "plone.app.querystring.field.isDefaultPage.operations\n"
            "plone.app.querystring.field.isDefaultPage.sortable\n"
            "plone.app.querystring.field.isDefaultPage.title\n"
            "plone.app.querystring.field.isDefaultPage.vocabulary\n"
            "plone.app.querystring.field.isFolderish.description\n"
            "plone.app.querystring.field.isFolderish.enabled\n"
            "plone.app.querystring.field.isFolderish.group\n"
            "plone.app.querystring.field.isFolderish.operations\n"
            "plone.app.querystring.field.isFolderish.sortable\n"
            "plone.app.querystring.field.isFolderish.title\n"
            "plone.app.querystring.field.isFolderish.vocabulary\n"
            "plone.app.querystring.field.modified.description\n"
            "plone.app.querystring.field.modified.enabled\n"
            "plone.app.querystring.field.modified.group\n"
            "plone.app.querystring.field.modified.operations\n"
            "plone.app.querystring.field.modified.sortable\n"
            "plone.app.querystring.field.modified.title\n"
            "plone.app.querystring.field.modified.vocabulary\n"
            "plone.app.querystring.field.path.description\n"
            "plone.app.querystring.field.path.enabled\n"
            "plone.app.querystring.field.path.group\n"
            "plone.app.querystring.field.path.operations\n"
            "plone.app.querystring.field.path.sortable\n"
            "plone.app.querystring.field.path.title\n"
            "plone.app.querystring.field.path.vocabulary\n"
            "plone.app.querystring.field.portal_type.description\n"
            "plone.app.querystring.field.portal_type.enabled\n"
            "plone.app.querystring.field.portal_type.group\n"
            "plone.app.querystring.field.portal_type.operations\n"
            "plone.app.querystring.field.portal_type.sortable\n"
            "plone.app.querystring.field.portal_type.title\n"
            "plone.app.querystring.field.portal_type.vocabulary\n"
            "plone.app.querystring.field.review_state.description\n"
            "plone.app.querystring.field.review_state.enabled\n"
            "plone.app.querystring.field.review_state.group\n"
            "plone.app.querystring.field.review_state.operations\n"
            "plone.app.querystring.field.review_state.sortable\n"
            "plone.app.querystring.field.review_state.title\n"
            "plone.app.querystring.field.review_state.vocabulary\n"
            "plone.app.querystring.field.sortable_title.description\n"
            "plone.app.querystring.field.sortable_title.enabled\n"
            "plone.app.querystring.field.sortable_title.group\n"
            "plone.app.querystring.field.sortable_title.operations\n"
            "plone.app.querystring.field.sortable_title.sortable\n"
            "plone.app.querystring.field.sortable_title.title\n"
            "plone.app.querystring.field.sortable_title.vocabulary\n"
            "plone.app.querystring.field.start.description\n"
            "plone.app.querystring.field.start.enabled\n"
            "plone.app.querystring.field.start.group\n"
            "plone.app.querystring.field.start.operations\n"
            "plone.app.querystring.field.start.sortable\n"
            "plone.app.querystring.field.start.title\n"
            "plone.app.querystring.field.start.vocabulary\n"
            "plone.app.querystring.operation.boolean.isFalse.description\n"
            "plone.app.querystring.operation.boolean.isFalse.operation\n"
            "plone.app.querystring.operation.boolean.isFalse.title\n"
            "plone.app.querystring.operation.boolean.isFalse.widget\n"
            "plone.app.querystring.operation.boolean.isTrue.description\n"
            "plone.app.querystring.operation.boolean.isTrue.operation\n"
            "plone.app.querystring.operation.boolean.isTrue.title\n"
            "plone.app.querystring.operation.boolean.isTrue.widget\n"
            "plone.app.querystring.operation.date.afterToday.description\n"
            "plone.app.querystring.operation.date.afterToday.operation\n"
            "plone.app.querystring.operation.date.afterToday.title\n"
            "plone.app.querystring.operation.date.afterToday.widget\n"
            "plone.app.querystring.operation.date.beforeToday.description\n"
            "plone.app.querystring.operation.date.beforeToday.operation\n"
            "plone.app.querystring.operation.date.beforeToday.title\n"
            "plone.app.querystring.operation.date.beforeToday.widget\n"
            "plone.app.querystring.operation.date.between.description\n"
            "plone.app.querystring.operation.date.between.operation\n"
            "plone.app.querystring.operation.date.between.title\n"
            "plone.app.querystring.operation.date.between.widget\n"
            "plone.app.querystring.operation.date.largerThan.description\n"
            "plone.app.querystring.operation.date.largerThan.operation\n"
            "plone.app.querystring.operation.date.largerThan.title\n"
            "plone.app.querystring.operation.date.largerThan.widget\n"
            "plone.app.querystring.operation.date.largerThanRelativeDate.description\n"
            "plone.app.querystring.operation.date.largerThanRelativeDate.operation\n"
            "plone.app.querystring.operation.date.largerThanRelativeDate.title\n"
            "plone.app.querystring.operation.date.largerThanRelativeDate.widget\n"
            "plone.app.querystring.operation.date.lessThan.description\n"
            "plone.app.querystring.operation.date.lessThan.operation\n"
            "plone.app.querystring.operation.date.lessThan.title\n"
            "plone.app.querystring.operation.date.lessThan.widget\n"
            "plone.app.querystring.operation.date.lessThanRelativeDate.description\n"
            "plone.app.querystring.operation.date.lessThanRelativeDate.operation\n"
            "plone.app.querystring.operation.date.lessThanRelativeDate.title\n"
            "plone.app.querystring.operation.date.lessThanRelativeDate.widget\n"
            "plone.app.querystring.operation.date.today.description\n"
            "plone.app.querystring.operation.date.today.operation\n"
            "plone.app.querystring.operation.date.today.title\n"
            "plone.app.querystring.operation.date.today.widget\n"
            "plone.app.querystring.operation.int.is.description\n"
            "plone.app.querystring.operation.int.is.operation\n"
            "plone.app.querystring.operation.int.is.title\n"
            "plone.app.querystring.operation.int.is.widget\n"
            "plone.app.querystring.operation.int.largerThan.description\n"
            "plone.app.querystring.operation.int.largerThan.operation\n"
            "plone.app.querystring.operation.int.largerThan.title\n"
            "plone.app.querystring.operation.int.largerThan.widget\n"
            "plone.app.querystring.operation.int.lessThan.description\n"
            "plone.app.querystring.operation.int.lessThan.operation\n"
            "plone.app.querystring.operation.int.lessThan.title\n"
            "plone.app.querystring.operation.int.lessThan.widget\n"
            "plone.app.querystring.operation.list.contains.description\n"
            "plone.app.querystring.operation.list.contains.operation\n"
            "plone.app.querystring.operation.list.contains.title\n"
            "plone.app.querystring.operation.list.contains.widget\n"
            "plone.app.querystring.operation.path.isWithin.description\n"
            "plone.app.querystring.operation.path.isWithin.operation\n"
            "plone.app.querystring.operation.path.isWithin.title\n"
            "plone.app.querystring.operation.path.isWithin.widget\n"
            "plone.app.querystring.operation.path.isWithinRelative.description\n"
            "plone.app.querystring.operation.path.isWithinRelative.operation\n"
            "plone.app.querystring.operation.path.isWithinRelative.title\n"
            "plone.app.querystring.operation.path.isWithinRelative.widget\n"
            "plone.app.querystring.operation.reference.is.description\n"
            "plone.app.querystring.operation.reference.is.operation\n"
            "plone.app.querystring.operation.reference.is.title\n"
            "plone.app.querystring.operation.reference.is.widget\n"
            "plone.app.querystring.operation.selection.is.description\n"
            "plone.app.querystring.operation.selection.is.operation\n"
            "plone.app.querystring.operation.selection.is.title\n"
            "plone.app.querystring.operation.selection.is.widget\n"
            "plone.app.querystring.operation.string.contains.description\n"
            "plone.app.querystring.operation.string.contains.operation\n"
            "plone.app.querystring.operation.string.contains.title\n"
            "plone.app.querystring.operation.string.contains.widget\n"
            "plone.app.querystring.operation.string.currentUser.description\n"
            "plone.app.querystring.operation.string.currentUser.operation\n"
            "plone.app.querystring.operation.string.currentUser.title\n"
            "plone.app.querystring.operation.string.currentUser.widget\n"
            "plone.app.querystring.operation.string.is.description\n"
            "plone.app.querystring.operation.string.is.operation\n"
            "plone.app.querystring.operation.string.is.title\n"
            "plone.app.querystring.operation.string.is.widget\n"
            "plone.app.querystring.operation.string.path.description\n"
            "plone.app.querystring.operation.string.path.operation\n"
            "plone.app.querystring.operation.string.path.title\n"
            "plone.app.querystring.operation.string.path.widget\n"
            "plone.app.querystring.operation.string.relativePath.description\n"
            "plone.app.querystring.operation.string.relativePath.operation\n"
            "plone.app.querystring.operation.string.relativePath.title\n"
            "plone.app.querystring.operation.string.relativePath.widget"
        )
Exemplo n.º 51
0
 def __call__(self, context):
     values = get_registry_record('immunarray.category_primary')
     items = [(i, normalize(i)) for i in values]
     return SimpleVocabulary.fromItems(items)
Exemplo n.º 52
0
 def is_clipboardjs_enabled(self):
     """Get the permalink info from the context"""
     return portal.get_registry_record(
         'collective.permalink.interfaces.'
         'IPermalinkControlPanel.enable_copytoclipboard',
     )