示例#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)
示例#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.'}))
示例#3
0
文件: wiki.py 项目: cguardia/karl
    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)
示例#4
0
文件: advanced.py 项目: lslaz1/karl
    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."})
        )
示例#5
0
文件: advanced.py 项目: cguardia/karl
    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.'}))
示例#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))
示例#7
0
文件: wiki.py 项目: cguardia/karl
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))
示例#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))
示例#9
0
文件: wiki.py 项目: cguardia/karl
 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))
示例#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))
示例#11
0
文件: test_lock.py 项目: iotest3/new
 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))