def revise(self, new_revision): if new_revision == get_next_revision(get_next_revision(self.revision)): self.details += """ ---------------- hello easter egg ---------------- """ self.save() return super(SoftwareController, self).revise(new_revision)
def revise(self, new_revision): if new_revision == get_next_revision(get_next_revision(self.revision)): self.details += """ ---------------- hello easter egg ---------------- """ self.save() return super(BicycleController, self).revise(new_revision)
def display_object_revisions(request, obj_type, obj_ref, obj_revi): """ View that displays the revisions of the given object (a part or a document) and shows a form to make a new revision. :url: :samp:`/object/{obj_type}/{obj_ref}/{obj_revi}/revisions/` .. include:: views_params.txt This view returns the result of :func:`revise_document` if the object is a document and the result of :func:`revise_part` if the object is a part. """ obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) add_form = None if obj.is_revisable(): if request.method == "POST": add_form = forms.AddRevisionForm(obj, request.user, request.POST) else: initial = { "revision": get_next_revision(obj.revision) } add_form = forms.AddRevisionForm(obj, request.user, initial=initial) ctx["add_revision_form"] = add_form if obj.is_document: return revise_document(obj, ctx, request) else: return revise_part(obj, ctx, request)
def next_revision(request, doc_id): """ Returns a possible new revision for the :class:`.Document` identified by *doc_id*. :implements: :func:`http_api.next_revision` :param request: the request :param doc_id: id of a :class:`.Document` :returned fields: revision, the new revision (may be an empty string) .. seealso:: :func:`.utils.get_next_revision` for possible results """ doc = get_obj_by_id(doc_id, request.user) return {"revision" : get_next_revision(doc.revision)}
def next_revision(request, doc_id): """ Returns a possible new revision for the :class:`.Document` identified by *doc_id*. :implements: :func:`http_api.next_revision` :param request: the request :param doc_id: id of a :class:`.Document` :returned fields: revision, the new revision (may be an empty string) .. seealso:: :func:`.utils.get_next_revision` for possible results """ doc = get_obj_by_id(doc_id, request.user) return {"revision": get_next_revision(doc.revision)}
def display_object_revisions(request, obj_type, obj_ref, obj_revi): """ Manage html page which displays all revisions of the selected object. It computes a context dictionnary based on .. include:: views_params.txt """ obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) if obj.is_revisable(): if request.method == "POST" and request.POST: add_form = AddRevisionForm(request.POST) if add_form.is_valid(): obj.revise(add_form.cleaned_data["revision"]) else: add_form = AddRevisionForm({"revision" : get_next_revision(obj_revi)}) ctx["add_revision_form"] = add_form revisions = obj.get_all_revisions() ctx.update({'current_page' : 'revisions', 'revisions' : revisions, }) return r2r('DisplayObjectRevisions.htm', ctx, request)