Esempio n. 1
0
 def getDefaultPreferenceGroup(self, id=''):
     group = zope.component.getUtility(interfaces.IPreferenceGroup, name=id)
     group = group.__bind__(self)
     default = DefaultPreferenceGroup(group, self)
     zope.interface.alsoProvides(default, IContainmentRoot)
     locate(default, self, 'preferences')
     return default
Esempio n. 2
0
def name_utility(obj, event):
    """\
    Writes the name of the utility when it is registered.  Used by
    subscriber.
    """

    locate(obj, None, event.object.name)
Esempio n. 3
0
 def locate_view(request, obj, name=""):
     view = func(request, obj, name=name)
     if view is not None:
         if not ILocation.providedBy(view):
             view = LocationProxy(view)
         locate(view, name=name, parent=obj)
     return view
Esempio n. 4
0
 def __init__(self, left, op, right):
     self.left = left
     self.op = op
     self.right = right
     locate(left, self, 'left')
     locate(right, self, 'right')
     self.children.extend([left, right])
Esempio n. 5
0
 def __init__(self, klass, coll1, coll2):
     self.klass = klass
     self.coll1 = coll1
     self.coll2 = coll2
     locate(coll1, self, 'coll1')
     locate(coll2, self, 'coll2')
     self.children.extend([coll1, coll2])
Esempio n. 6
0
 def getDefaultPreferenceGroup(self, id=''):
     group = zope.component.getUtility(interfaces.IPreferenceGroup, name=id)
     group = group.__bind__(self)
     default = DefaultPreferenceGroup(group, self)
     zope.interface.alsoProvides(default, IContainmentRoot)
     locate(default, self, 'preferences')
     return default
Esempio n. 7
0
def clone_action(wf, context):  # pylint: disable=invalid-name,unused-argument
    """Create new version"""
    result = copy(context)
    locate(result, context.__parent__)
    registry = get_pyramid_registry()
    registry.notify(ObjectClonedEvent(result, context))
    return result
Esempio n. 8
0
 def __init__(self, klass, func, coll):
     self.klass = klass
     self.func = func
     self.coll = coll
     locate(func, self, 'func')
     locate(coll, self, 'coll')
     self.children.extend([func, coll])
Esempio n. 9
0
 def __init__(self, klass, start, end):
     self.klass = klass
     self.start = start
     self.end = end
     locate(start, self, 'start')
     locate(end, self, 'end')
     self.children.extend([start, end])
Esempio n. 10
0
 def __init__(self, coll1, coll2, expr):
     self.expr = expr
     self.coll1 = coll1
     self.coll2 = coll2
     locate(expr, self, 'expr')
     #        locate(coll1, self, 'coll1')
     #        locate(coll2, self, 'coll2')
     self.children.append(expr)
Esempio n. 11
0
 def setLocalRegistry(self, reg, locate=locate):
     assert IRegistry.providedBy(reg)
     if locate is not None:
         if ILocation.providedBy(reg):
             locate(reg, self, '@registry')
         else:
             raise TypeError("Can't locate non ILocation registries.")
     self._registry = reg
Esempio n. 12
0
    def publishTraverse(self, request, name):
        '''See zope.publisher.interfaces.browser.IBrowserPublisher interface'''
        resource = queryAdapter(request, name=name)
        if resource is None:
            raise NotFound(self, name)

        locate(resource, self.context, name)
        return resource
Esempio n. 13
0
 def public_profile_callback(profile):
     """Public profile creation callback"""
     request = get_current_request()
     if request is not None:
         root = request.root
         intids = get_utility(IIntIds)
         locate(profile, root)  # avoid NotYet exception
         locate(profile, root, '++profile++{0}'.format(intids.register(profile)))
Esempio n. 14
0
    def publishTraverse(self, request, name):
        '''See zope.publisher.interfaces.browser.IBrowserPublisher interface'''
        resource = queryAdapter(request, name=name)
        if resource is None:
            raise NotFound(self, name)

        locate(resource, self.context, name)
        return resource
Esempio n. 15
0
def exception_view(request, exception):
    view = IView(exception, request)
    if view is not None:
        # Make sure it's properly located.
        if not ILocation.providedBy(view):
            view = LocationProxy(view)
        locate(view, parent=exception, name='exception')
        return IResponseFactory(view)
    return None
Esempio n. 16
0
 def _copy_history(self, translate):
     task = translate(self.context)
     task._internal_id = None  # pylint: disable=protected-access
     # create empty history
     history = task.history = TaskHistoryContainer()
     locate(history, task, '++history++')
     # disable task
     scheduling_mode = task.get_scheduling_info()
     scheduling_mode.active = False
Esempio n. 17
0
 def items(self):
     """See zope.container.interfaces.IReadContainer"""
     items = list(zope.component.getUtilitiesFor(IDocumentationModule))
     items.sort()
     utils = []
     for key, value in items:
         locate(value, self, key)
         utils.append((key, value))
     return utils
Esempio n. 18
0
 def create_and_add(self, data):
     """Create new content and add it to context"""
     obj = self.create(data.get(self, {}))
     self.request.registry.notify(ObjectCreatedEvent(obj))
     if IPersistent.providedBy(
             obj):  # temporary locate to fix raising of INotYet exceptions
         locate(obj, self.context)
     self.update_content(obj, data)
     self.add(obj)
     return obj
Esempio n. 19
0
    def getStudent(self, key):
        model = self.query_filters(self.session.query(self.model)).get(key)
        if model is None:
            raise KeyError(key)

        if not ILocation.providedBy(model):
            model = LocationProxy(model)

        locate(model, self, self.key_reverse(model))
        return model
Esempio n. 20
0
    def publishTraverse(self, request, name):
        '''See interface IBrowserPublisher'''

        resource = zope.component.queryAdapter(request, name=name)
        if resource is None:
            raise NotFound(self, name)

        sm = zope.component.getSiteManager()
        locate(resource, sm, name)
        return resource
Esempio n. 21
0
 def _create_document(registry, folder):
     """Create new document and version"""
     document = Document()
     registry.notify(ObjectCreatedEvent(document))
     locate(document, folder)
     version = DocumentVersion()
     registry.notify(ObjectCreatedEvent(version))
     # add version to document
     versions = IWorkflowVersions(document)
     versions.add_version(version, None)
     IWorkflowInfo(version).fire_transition('init')
     return document, version
Esempio n. 22
0
 def __set__(self, instance, value):  # pylint: disable=too-many-branches
     if value is NOT_CHANGED:
         return
     registry = get_current_registry()
     if (value is not None) and (value is not TO_BE_DELETED):
         filename = None
         # file upload data converter returns a tuple containing
         # filename and buffered IO stream extracted from FieldStorage...
         if isinstance(value, tuple):
             filename, value = value
         # initialize file through factory
         if not IFile.providedBy(value):
             factory = self.__klass or FileFactory
             file = factory(value, **self.__args)
             registry.notify(ObjectCreatedEvent(file))
             if not file.get_size():
                 value.seek(0)  # because factory may read until end of file...
                 file.data = value
             value = file
         if filename is not None:
             info = IFileInfo(value)
             if info is not None:
                 info.filename = filename
     field = self.__field.bind(instance)
     field.validate(value)
     if field.readonly and instance.__dict__.has_key(self.__name):
         raise ValueError(self.__name, "Field is readonly")
     old_value = instance.__dict__.get(self.__name, _MARKER)
     if old_value != value:
         # check for previous value
         if (old_value is not _MARKER) and (old_value is not None):
             registry.notify(ObjectRemovedEvent(old_value))
         if value is TO_BE_DELETED:
             if self.__name in instance.__dict__:
                 del instance.__dict__[self.__name]
             attributes = get_instance_attributes(instance)
             if attributes and (self.__name in attributes):
                 attributes.remove(self.__name)
         else:
             # set name of new value
             name = '++attr++{0}'.format(self.__name)
             if value is not None:
                 locate(value, instance, name)
             instance.__dict__[self.__name] = value
             # store file attributes of instance
             if not IFileFieldContainer.providedBy(instance):
                 alsoProvides(instance, IFileFieldContainer)
             attributes = get_instance_attributes(instance)
             attributes.add(self.__name)
             registry.notify(ObjectAddedEvent(value, instance, name))
Esempio n. 23
0
 def __getitem__(self, key):
     session = get_session('ukhvoucher')
     try:
         ret = session.query(Account).filter(Account.oid == key).all()
         if ret > 0:
             model = ret[0]
             proxy = ILocation(model, None)
             if proxy is None:
                 proxy = LocationProxy(model)
             locate(proxy, self, str(model.oid))
             return proxy
         else:
             raise KeyError
     except:
         raise KeyError
Esempio n. 24
0
    def update(self):
        """See pyams_form.interfaces.button.IActions."""
        # Create a unique prefix.
        prefix = expand_prefix(self.form.prefix)
        prefix += expand_prefix(self.form.buttons.prefix)
        # Walk through each field, making an action out of it.
        d = {}
        d.update(self)
        registry = self.request.registry
        for name, button in self.form.buttons.items():
            # Step 1: Only create an action for the button, if the condition is
            #         fulfilled.
            if button.condition is not None and not button.condition(self.form):
                # Step 1.1: If the action already existed, but now the
                #           condition became false, remove the old action.
                if name in d:
                    del d[name]
                continue
            # Step 2: Get the action for the given button.
            new_button = True
            if name in self:
                button_action = self[name]
                new_button = False
            elif button.action_factory is not None:
                button_action = button.action_factory(self.request, button)
            else:
                button_action = registry.getMultiAdapter((self.request, button), IButtonAction)
            # Step 3: Set the name on the button
            button_action.name = prefix + name
            # Step 4: Set any custom attribute values.
            title = registry.queryMultiAdapter((self.form, self.request, self.content,
                                                button, self),
                                               IValue, name='title')
            if title is not None:
                button_action.title = title.get()
            # Step 5: Set the form
            button_action.form = self.form
            if not IFormAware.providedBy(button_action):
                alsoProvides(button_action, IFormAware)
            # Step 6: Update the new action
            button_action.update()
            registry.notify(AfterWidgetUpdateEvent(button_action))
            # Step 7: Add the widget to the manager
            if new_button:
                d[name] = button_action
                locate(button_action, self, name)

        self.create_according_to_list(d, self.form.buttons.keys())
Esempio n. 25
0
 def __init__(self, users, clients, grants, tokens):
     locate(users, self, 'users')
     locate(clients, self, 'clients')
     locate(grants, self, 'grants')
     locate(tokens, self, 'tokens')
     self.users = users
     self.clients = clients
     self.grants = grants
     self.tokens = tokens
Esempio n. 26
0
    def __getitem__(self, id):
        if self.key_converter is not None:
            try:
                key = self.key_converter(id)
            except ValueError as e:
                raise KeyError(id)
        else:
            key = id

        session = get_session(DB_KEY)
        model = session.query(self.model).get(key)

        if model is None:
            raise KeyError(key)

        locate(model, self, unicode(id))
        return model
Esempio n. 27
0
 def publish_handle_errors(publisher, request, root, handle_errors=True):
     if handle_errors is True:
         try:
             response = func(publisher, request, root, handle_errors)
         except Exception, e:
             if not ILocation.providedBy(e):
                 # Make sure it's properly located.
                 e = LocationProxy(e)
                 locate(e, root, 'error')
             factory = queryMultiAdapter((request, e), IResponseFactory)
             if factory is not None:
                 if ITracebackAware.providedBy(factory):
                     exc_info = sys.exc_info()
                     factory.set_exc_info(exc_info)
                 response = factory()
             else:
                 raise
         return response
Esempio n. 28
0
 def update(self):
     super().update()
     unique_ordered_keys = list(self.keys())
     data = {}
     data.update(self)
     for name in self.form.content_providers:
         factory = self.form.content_providers[name]
         if factory.position is None:
             raise ValueError(
                 "Position of the following content provider should be an "
                 "integer: '%s'." % name)
         content_provider = factory(self)
         short_name = name
         content_provider.update()
         unique_ordered_keys.insert(factory.position, short_name)
         data[short_name] = content_provider
         locate(content_provider, self, short_name)
     self.create_according_to_list(data, unique_ordered_keys)
Esempio n. 29
0
 def __init__(self, klass, expr, func, aggreg, coll):
     self.klass = klass
     self.expr = expr
     self.func = func
     self.aggreg = aggreg
     self.coll = coll
     locate(expr, self, 'expr')
     locate(func, self, 'func')
     locate(aggreg, self, 'aggreg')
     locate(coll, self, 'coll')
     self.children.extend([expr, func, aggreg, coll])
Esempio n. 30
0
    def publishTraverse(self, request, name):
        """
        Query for the default adapter on *request* named *name* and return it.

        This is usually a `.IResource` as registered with `.IResourceDirective`.

        The resource object is `located <.locate>` beneath the context of this
        object with the given *name*.

        :raises NotFound: If no adapter can be found.

        .. seealso:: `zope.publisher.interfaces.browser.IBrowserPublisher`
        """
        resource = queryAdapter(request, name=name)
        if resource is None:
            raise NotFound(self, name)

        locate(resource, self.context, name)
        return resource
Esempio n. 31
0
 def publish_handle_errors(publisher, request, root, handle_errors=True):
     if handle_errors is True:
         try:
             response = func(publisher, request, root, handle_errors)
         except Exception as e:
             if not ILocation.providedBy(e):
                 # Make sure it's properly located.
                 error = LocationProxy(e)
                 locate(error, root, 'error')
             try:
                 factory = IResponseFactory(request, error)
                 if ITracebackAware.providedBy(factory):
                     exc_info = sys.exc_info()
                     factory.set_exc_info(exc_info)
                 response = factory()
             except ComponentLookupError:
                 raise e
         return response
     return func(publisher, request, root, handle_errors=handle_errors)
Esempio n. 32
0
 def updateFields(self):
     super(OAuthControlPanelForm, self).updateFields()
     # This is the place to add groups.
     #    superclass groups have been created now,
     #    and it won't mess with ours.
     #    we can also add GroupFactory here, because update
     #    will take care of it
     registry = getUtility(IRegistry)
     vocab = getUtility(IVocabularyFactory, 'org.bccvl.site.oauth.providers')(self.context)
     groups = []
     for term in vocab:
         coll = registry.collectionOfInterface(term.value, check=False)
         # how to check if coll is empty? -> if yes skip
         for rid, record in coll.items():
             subform = OAuthBaseGroup(record, self.request, self)
             subform.schema = term.value
             subform.label = record.title or term.title or record.id or rid
             locate(subform, self, record.id or rid)
             groups.append(subform)
     self.groups += tuple(groups)
Esempio n. 33
0
def iterPatternMatcher(metadata, tree):
    """Replaces the identified Iter tree pattern """
    coll = tree.klass
    single = tree.func.expr.expr1
    var = tree.func.var
    interface = tree.coll.expr.name
    cond = tree.func.expr.cond.left.name
    operator = tree.func.expr.cond.op.op
    if isinstance(tree.func.expr.cond.right, Constant):
        value = tree.func.expr.cond.right.value
    elif isinstance(tree.func.expr.cond.right, Identifier):
        value = tree.func.expr.cond.right.name
    else:
        return tree.__parent__

    if not metadata.hasPropertyIndex(interface, cond.split(".")[1]):
        return tree.__parent__

    #new algebra objects
    if operator:
        makeFromIndex = MakeFromIndex(coll,
                                      coll,
                                      interface,
                                      cond.split(".")[1],
                                      operator,
                                      value=value)
    else:
        return tree.__parent__

    newlambda = Lambda(var, single)
    newTree = Iter(coll, newlambda, makeFromIndex)
    parent = tree.__parent__
    if isinstance(parent, Head):
        return Head(newTree)
    else:
        for c in parent.children:
            if isinstance(c, Iter):
                del c
        parent.children.append(newTree)
        locate(newTree, parent, 'iter')
        return newTree
Esempio n. 34
0
 def updateFields(self):
     super(OAuthControlPanelForm, self).updateFields()
     # This is the place to add groups.
     #    superclass groups have been created now,
     #    and it won't mess with ours.
     #    we can also add GroupFactory here, because update
     #    will take care of it
     registry = getUtility(IRegistry)
     vocab = getUtility(IVocabularyFactory,
                        'org.bccvl.site.oauth.providers')(self.context)
     groups = []
     for term in vocab:
         coll = registry.collectionOfInterface(term.value, check=False)
         # how to check if coll is empty? -> if yes skip
         for rid, record in coll.items():
             subform = OAuthBaseGroup(record, self.request, self)
             subform.schema = term.value
             subform.label = record.title or term.title or record.id or rid
             locate(subform, self, record.id or rid)
             groups.append(subform)
     self.groups += tuple(groups)
Esempio n. 35
0
    def authentication_uri(self, request):
        if self.authtype == u"OAuth-1":
            return self.v1_authentication_uri(request)

        self.state = str(randint(0, 1000))
        self.token = V2TokenRequest(self.token_uri,
                                    client_id=self.client_id,
                                    client_secret=self.secret)
        location.locate(self.token, self, 'token')

        # exchange the code for a token
        redirect_uri = str(grok.url(request, self.token, name="@@tokenview"))
        if redirect_uri.find('/localhost') < 0:
            redirect_uri = redirect_uri.replace("http:", "https:")
        self.authorize = V2Authorization(self.auth_uri,
                                         redirect_uri=redirect_uri,
                                         client_id=self.client_id,
                                         scope=self.scope,
                                         state=self.state)
        location.locate(self.authorize, self, 'authorize')
        self.token.set_redirect_uri(redirect_uri)
        return self.authorize.get_uri()
Esempio n. 36
0
 def __init__(self, cond, expr1, expr2):
     self.cond = cond
     self.expr1 = expr1
     self.expr2 = expr2
     locate(cond, self, 'cond')
     locate(expr1, self, 'expr1')
     locate(expr2, self, 'expr2')
     self.children.extend([cond, expr1, expr2])
Esempio n. 37
0
 def get_selection(self, selection_name, format=None):
     # pylint: disable=redefined-builtin
     """Get thumbnail for given selection name"""
     LOGGER.debug(
         ">>> Requested thumbnail selection: {}".format(selection_name))
     if selection_name in self.thumbnails:
         return self.thumbnails[selection_name]
     geometry = self.get_geometry(selection_name)
     if geometry == IThumbnailer(self.image).get_default_geometry():
         return self.image
     registry = get_current_registry()
     thumbnailer = registry.queryAdapter(self.image,
                                         IThumbnailer,
                                         name=selection_name)
     if thumbnailer is not None:
         selection = thumbnailer.create_thumbnail(geometry, format)
         if selection is not None:
             if isinstance(selection, tuple):
                 selection, format = selection
             else:
                 format = 'jpeg'
             selection = FileFactory(selection)
             alsoProvides(selection, IThumbnailFile)
             registry.notify(ObjectCreatedEvent(selection))
             self.thumbnails[selection_name] = selection
             selection_size = selection.get_image_size()
             locate(
                 selection, self.image,
                 '++thumb++{0}:{1}x{2}.{3}'.format(selection_name,
                                                   selection_size[0],
                                                   selection_size[1],
                                                   format))
             LOGGER.debug("  > Generated thumbnail selection: {}".format(
                 selection.__name__))
             registry.notify(ObjectAddedEvent(selection))
             return selection
     return None
Esempio n. 38
0
 def updateFields(self):
     super(OAuthControlPanelForm, self).updateFields()
     # This is the place to add groups.
     #    superclass groups have been created now,
     #    and it won't mess with ours.
     #    we can also add GroupFactory here, because update
     #    will take care of it
     registry = getUtility(IRegistry)
     coll = registry.collectionOfInterface(IOAuth1Settings, check=False)
     groups = []
     for rid, record in coll.items():
         # TODO: prefix of record id?
         subform = OAuth1EditForm(record, self.request, self)
         subform.label = record.title or record.id or rid
         locate(subform, self, record.id or rid)
         groups.append(subform)
     coll = registry.collectionOfInterface(IOAuth2Settings, check=False)
     for rid, record in coll.items():
         # TODO: prefix of record id?
         subform = OAuth2EditForm(record, self.request, self)
         subform.label = record.title or record.id or rid
         locate(subform, self, record.id or rid)
         groups.append(subform)
     self.groups += tuple(groups)
Esempio n. 39
0
 def updateFields(self):
     super(OAuthControlPanelForm, self).updateFields()
     # This is the place to add groups.
     #    superclass groups have been created now,
     #    and it won't mess with ours.
     #    we can also add GroupFactory here, because update
     #    will take care of it
     registry = getUtility(IRegistry)
     coll = registry.collectionOfInterface(IOAuth1Settings, check=False)
     groups = []
     for rid, record in coll.items():
         # TODO: prefix of record id?
         subform = OAuth1EditForm(record, self.request, self)
         subform.label = record.title or record.id or rid
         locate(subform, self, record.id or rid)
         groups.append(subform)
     coll = registry.collectionOfInterface(IOAuth2Settings, check=False)
     for rid, record in coll.items():
         # TODO: prefix of record id?
         subform = OAuth2EditForm(record, self.request, self)
         subform.label = record.title or record.id or rid
         locate(subform, self, record.id or rid)
         groups.append(subform)
     self.groups += tuple(groups)
Esempio n. 40
0
 def __init__(self, var, expr):
     self.var = var
     self.expr = expr
     locate(expr, self, 'expr')
     self.children.append(expr)
Esempio n. 41
0
 def __init__(self, tree):
     __name__ = 'head'
     self.tree = tree
     locate(tree, self, 'tree')
Esempio n. 42
0
 def lookup_service(self, name):
     service = getMultiAdapter((self.context, self.request, self),
                               self.service_iface, name)
     locate(service, self, name)
     return service
Esempio n. 43
0
 def setProp(self, name, value):
     setattr(self, name, value)
     if ILocation.providedBy(value):
         locate(value, self, name)
         self.children.append(value)
Esempio n. 44
0
 def getLocalRegistry(self):
     reg = self._registry
     if not ILocation.providedBy(reg):
         reg = LocationProxy(reg)
         locate(reg, self, '@registry')
     return reg
Esempio n. 45
0
 def __init__(self, context):
     # must locate itself into context the very first thing, as the
     # vocabulary uses source adapter registered above.
     locate(self, context, '')
     self.docview_gensource = context.docview_gensource
     self.docview_generator = context.docview_generator
Esempio n. 46
0
 def __init__(self, klass, expr):
     self.klass = klass
     self.expr = expr
     locate(expr, self, 'expr')
     self.children.extend([klass, expr])
Esempio n. 47
0
 def __getitem__(self, key):
     item = dict.__getitem__(self, key)
     if item is not None:
         locate(item, self, key)
     return item
Esempio n. 48
0
 def __init__(self, tree):
     self.name = 'head'
     self.tree = tree
     locate(tree, self, 'tree')
Esempio n. 49
0
    def update(self):
        form = self.form
        content = self.content
        request = self.request
        formbuttons = form.buttons

        buttons = []

        allbuttons = [formbuttons]
        allbuttons.extend(
            [b for n, b in getAdapters(
                    (content, form, request), interfaces.IButtons)])

        prefix = util.expandPrefix(form.prefix)

        weight = 100

        for btns in allbuttons:
            bprefix = prefix + util.expandPrefix(btns.prefix)

            for name, button in btns.items():
                if button.condition is not None and not button.condition(form):
                    continue

                weight += 1
                bweight = getattr(button, 'weight', weight)
                buttons.append((bweight, bprefix + name, button))

        for name, button in getAdapters((content, form, request), IWizardButton):
            if not button.isAvailable():
                continue

            bprefix = prefix + util.expandPrefix(
                button.prefix or formbuttons.prefix)

            weight += 1
            bweight = button.weight or weight
            buttons.append((bweight, str(bprefix + name), button))

        buttons.sort()

        for weight, name, button in buttons:
            if button.actionFactory is not None:
                buttonAction = button.actionFactory(request, button)
            else:
                buttonAction = getMultiAdapter(
                    (request, button), interfaces.IButtonAction)

            # Step 3: Set the name on the button
            buttonAction.name = name

            # Step 4: Set any custom attribute values.
            title = queryMultiAdapter(
                (form, request, content, button, self),
                interfaces.IValue, name='title')

            if title is not None:
                buttonAction.title = title.get()

            # Step 5: Set the form
            buttonAction.form = form
            interface.alsoProvides(buttonAction, interfaces.IFormAware)

            # Step 6: Update the new action
            buttonAction.update()
            event.notify(AfterWidgetUpdateEvent(buttonAction))

            # Step 7: Add the widget to the manager
            self._data_keys.append(name)
            self._data_values.append(buttonAction)
            self._data[name] = buttonAction

            locate(buttonAction, self, name)
Esempio n. 50
0
 def setProperties(self, name, value):
     setattr(self, name, value)
     for term in value:
         if ILocation.providedBy(term):
             locate(term, self, 'term')
     self.children.extend(value)
Esempio n. 51
0
 def setProp(self, name, value):
     setattr(self, name, value)
     if ILocation.providedBy(value):
         locate(value, self, name)
         self.children.append(value)
Esempio n. 52
0
 def __init__(self, context):
     self.context = context
     locate(self, context.__parent__, context.__name__)
Esempio n. 53
0
 def traverse(self, name, ignored):
     location = (self.context, '++control++')
     ob = Control()
     locate(ob, *location)
     return LocationProxy(ob, *location)
Esempio n. 54
0
 def url(self):
     resource = getAdapter(self.request, name=self.rname)
     locate(resource, zope.component.hooks.getSite(), self.rname)
     return resource()
Esempio n. 55
0
 def get(self, key, default=None):
     """See zope.container.interfaces.IReadContainer"""
     utility = zope.component.queryUtility(IDocumentationModule, key, default)
     if utility != default:
         locate(utility, self, key)
     return utility
Esempio n. 56
0
 def update(self):
     locate(self.view.person, self.view, '') # The form needs this if person is the context
     self.form = CommentsForm(self.view.person, self.request)
     self.comments = self.view.person.get_comments()
Esempio n. 57
0
 def setProperties(self, name, value):
     setattr(self, name, value)
     for term in value:
         if ILocation.providedBy(term):
             locate(term, self, name)
     self.children.extend(value)