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)
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)
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))
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))
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))
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))
def test_lock_owner(self): context = karltesting.DummyModel() from karl.utilities import lock lock.lock(context, 'foo') self.failUnless(lock.owns_lock(context, 'foo')) self.failIf(lock.owns_lock(context, 'bar'))