Ejemplo n.º 1
0
    def handle_submit(self, converted):
        if lock.owns_lock(self.context, self.userid):
            lock.clear(self.context)

        context = self.context
        request = self.request
        workflow = self.workflow
        # *will be* modified event
        objectEventNotify(ObjectWillBeModifiedEvent(context))
        if workflow is not None:
            if 'security_state' in converted:
                workflow.transition_to_state(context, request,
                                             converted['security_state'])

        context.text = converted['text']
        context.description = extract_description(converted['text'])
        newtitle = converted['title']
        if newtitle != context.title:
            context.change_title(newtitle)

        # Save the tags on it
        set_tags(context, request, converted['tags'])

        # Modified
        context.modified_by = authenticated_userid(request)
        objectEventNotify(ObjectModifiedEvent(context))

        location = resource_url(context, request)
        msg = "?status_message=Wiki%20Page%20edited"
        return HTTPFound(location=location + msg)
Ejemplo n.º 2
0
    def handle_submit(self, params):
        context = self.context
        objectEventNotify(ObjectWillBeModifiedEvent(context))

        if self.use_folder_options:
            noLongerProvides(context, IReferencesFolder)
            noLongerProvides(context, INetworkNewsMarker)
            noLongerProvides(context, INetworkEventsMarker)
            marker = params.get('marker')
            if marker == 'reference_manual':
                alsoProvides(context, IReferencesFolder)
            elif marker == 'network_news':
                alsoProvides(context, INetworkNewsMarker)
            elif marker == 'network_events':
                alsoProvides(context, INetworkEventsMarker)

        keywords = params.get('keywords')
        if keywords is not None:
            context.search_keywords = keywords

        weight = params.get('weight')
        if weight is not None:
            context.search_weight = weight

        if self.use_unlock and params.get('unlock'):
            lock.clear(context)

        objectEventNotify(ObjectModifiedEvent(context))
        return HTTPFound(location=resource_url(
            self.context,
            self.request,
            query={'status_message': 'Advanced settings changed.'}))
Ejemplo n.º 3
0
    def handle_submit(self, converted):
        if lock.owns_lock(self.context, self.userid):
            lock.clear(self.context)

        context = self.context
        request = self.request
        workflow = self.workflow
        # *will be* modified event
        objectEventNotify(ObjectWillBeModifiedEvent(context))
        if workflow is not None:
            if 'security_state' in converted:
                workflow.transition_to_state(context, request,
                                             converted['security_state'])

        context.text = converted['text']
        context.description = extract_description(converted['text'])
        newtitle = converted['title']
        if newtitle != context.title:
            context.change_title(newtitle)

        # Save the tags on it
        set_tags(context, request, converted['tags'])

        # Modified
        context.modified_by = authenticated_userid(request)
        objectEventNotify(ObjectModifiedEvent(context))

        location = model_url(context, request)
        msg = "?status_message=Wiki%20Page%20edited"
        return HTTPFound(location=location+msg)
Ejemplo n.º 4
0
    def handle_submit(self, params):
        context = self.context
        objectEventNotify(ObjectWillBeModifiedEvent(context))

        if self.use_folder_options:
            noLongerProvides(context, IReferencesFolder)
            noLongerProvides(context, INetworkNewsMarker)
            noLongerProvides(context, INetworkEventsMarker)
            marker = params.get("marker")
            if marker == "reference_manual":
                alsoProvides(context, IReferencesFolder)
            elif marker == "network_news":
                alsoProvides(context, INetworkNewsMarker)
            elif marker == "network_events":
                alsoProvides(context, INetworkEventsMarker)

        keywords = params.get("keywords")
        if keywords is not None:
            context.search_keywords = keywords

        weight = params.get("weight")
        if weight is not None:
            context.search_weight = weight

        if self.use_unlock and params.get("unlock"):
            lock.clear(context)

        objectEventNotify(ObjectModifiedEvent(context))
        return HTTPFound(
            location=resource_url(self.context, self.request, query={"status_message": "Advanced settings changed."})
        )
Ejemplo n.º 5
0
    def handle_submit(self, params):
        context = self.context
        objectEventNotify(ObjectWillBeModifiedEvent(context))

        if self.use_folder_options:
            noLongerProvides(context, IReferencesFolder)
            noLongerProvides(context, INetworkNewsMarker)
            noLongerProvides(context, INetworkEventsMarker)
            marker = params.get('marker')
            if marker == 'reference_manual':
                alsoProvides(context, IReferencesFolder)
            elif marker == 'network_news':
                alsoProvides(context, INetworkNewsMarker)
            elif marker == 'network_events':
                alsoProvides(context, INetworkEventsMarker)

        keywords = params.get('keywords')
        if keywords is not None:
            context.search_keywords = keywords

        weight = params.get('weight')
        if weight is not None:
            context.search_weight = weight

        if self.use_unlock and params.get('unlock'):
            lock.clear(context)

        objectEventNotify(ObjectModifiedEvent(context))
        return HTTPFound(location=model_url(self.context, self.request,
                    query={'status_message': 'Advanced settings changed.'}))
Ejemplo n.º 6
0
def unlock_wiki_view(context, request, userid=None):
    if request.method.lower() == 'post':
        if userid is None:
            # for unit tests to override
            userid = authenticated_userid(request)
        if lock.owns_lock(context, userid):
            lock.clear(context)
        return HTTPOk(body='')
    return HTTPFound(location=resource_url(context, request))
Ejemplo n.º 7
0
def unlock_wiki_view(context, request, userid=None):
    if request.method.lower() == 'post':
        if userid is None:
            # for unit tests to override
            userid = authenticated_userid(request)
        if lock.owns_lock(context, userid):
            lock.clear(context)
        return HTTPOk(body='')
    return HTTPFound(location=model_url(context, request))
Ejemplo n.º 8
0
 def handle_cancel(self):
     if lock.owns_lock(self.context, self.userid):
         lock.clear(self.context)
     return HTTPFound(location=resource_url(self.context, self.request))
Ejemplo n.º 9
0
 def handle_cancel(self):
     if lock.owns_lock(self.context, self.userid):
         lock.clear(self.context)
     return HTTPFound(location=model_url(self.context, self.request))
Ejemplo n.º 10
0
 def test_clear(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     lock.lock(context, 'foo')
     lock.clear(context)
     self.failIf(lock.is_locked(context))
Ejemplo n.º 11
0
 def test_clear(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     lock.lock(context, 'foo')
     lock.clear(context)
     self.failIf(lock.is_locked(context))