+
+ def save(self, document_author = 'anonymous'):
+ storage = getstorage()
+
+ document = Document(storage, name=self.cleaned_data['name'], text=self.cleaned_data['text'])
+
+ storage.put(document,
+ author = document_author,
+ comment = self.cleaned_data['comment'],
+ parent =self.cleaned_data['revision'] )
+
+ return storage.get(self.cleaned_data['name'])
+
+class DocumentTextSaveForm(forms.Form):
+ """
+ Form for saving document's text:
+
+ * name - document's storage identifier.
+ * parent_revision - revision which the modified text originated from.
+ * comment - user's verbose comment; will be used in commit.
+ * stage_completed - mark this change as end of given stage.
+
+ """
+ DOC_STAGES = (
+ ('', 'Nic konkretnego'),
+ ('tagging', 'Tagowanie'),
+ ('modernized', 'Uwspółcześnienia'),
+ ('editing', 'Redakcja'),
+ )
+
+ id = forms.CharField(widget=forms.HiddenInput)
+ parent_revision = forms.IntegerField(widget=forms.HiddenInput)