From: Łukasz Rekucki Date: Tue, 20 Oct 2009 12:42:45 +0000 (+0200) Subject: Merge branch 'master' of stigma:platforma X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/0e5e4a0d816add3c0c13559fbed4f79eb295baf8?ds=sidebyside;hp=-c Merge branch 'master' of stigma:platforma Conflicts: platforma/urls.py --- 0e5e4a0d816add3c0c13559fbed4f79eb295baf8 diff --combined apps/api/forms.py index 7532e179,c5e0b670..22cadb9e --- a/apps/api/forms.py +++ b/apps/api/forms.py @@@ -11,6 -11,7 +11,6 @@@ from django.contrib.auth.models import import re from django.utils import simplejson as json - class MergeRequestForm(forms.Form): # should the target document revision be updated or shared type = forms.ChoiceField(choices=(('update', 'Update'), ('share', 'Share')) ) @@@ -62,9 -63,9 +62,9 @@@ PRQ_USER_RE = re.compile(r"^\$prq-(\d{1 class DocumentRetrieveForm(forms.Form): revision = forms.RegexField(regex=r'latest|[0-9a-z]{40}', required=False) user = forms.CharField(required=False) - + def clean_user(self): - # why, oh why does django doesn't implement this!!! + # why, oh why doesn't django implement this!!! # value = super(DocumentRetrieveForm, self).clean_user() value = self.cleaned_data['user'] @@@ -88,39 -89,18 +88,39 @@@ class TextRetrieveForm(DocumentRetrieveForm): - part = forms.CharField(required=False) + chunk = forms.CharField(required=False) + format = forms.CharField(required=False) + + def clean_format(self): + value = self.cleaned_data['format'] + if not value: + return 'raw' + + if value not in ('nl', 'raw'): + raise forms.ValidationError("Invalid text format") + return value class TextUpdateForm(DocumentRetrieveForm): message = forms.CharField(required=False) contents = forms.CharField(required=False) chunks = forms.CharField(required=False) + format = forms.CharField(required=False) + + def clean_format(self): + value = self.cleaned_data['format'] + if not value: + return 'raw' + + if value not in ('nl', 'raw'): + raise forms.ValidationError("Invalid text format") + return value + def clean_message(self): value = self.cleaned_data['message'] if value: - return u"$USER$ " + request.POST['message'] + return u"$USER$ " + value else: return u"$AUTO$ XML content update." diff --combined platforma/urls.py index 03056c88,5ff1b6af..786a6538 --- a/platforma/urls.py +++ b/platforma/urls.py @@@ -13,37 -13,21 +13,20 @@@ urlpatterns = patterns('' url(r'^$', 'explorer.views.file_list', name='file_list'), url(r'^file/upload', 'explorer.views.file_upload', name='file_upload'), -- - url(r'^managment/pull-requests$', 'explorer.views.pull_requests'), - + url(r'^management/pull-requests$', 'explorer.views.pull_requests'), - - # url(r'^images/(?P[^/]+)/$', 'explorer.views.folder_images', name='folder_image'), - # url(r'^images/$', 'explorer.views.folder_images', {'folder': '.'}, name='folder_image_ajax'), - ++ # Editor panels - # url(r'^editor/'+PATH_SEC+'/panel/(?P[a-z]+)/$', 'explorer.views.panel_view', name='panel_view'), url(r'^editor/'+PATH_END, 'explorer.views.display_editor', name='editor_view'), url(r'^editor/$', 'explorer.views.file_list', name='editor_base'), - # url(r'^editor/'+PATH_SEC+'/split$', 'explorer.views.split_text'), - # url(r'^editor/'+PATH_SEC+'/split-success', - # 'explorer.views.split_success', name='split-success'), - - # url(r'^editor/'+PATH_SEC+'/print/html$', 'explorer.views.print_html'), - # url(r'^editor/'+PATH_SEC+'/print/xml$', 'explorer.views.print_xml'), - url(r'^file/(?P[^/]+)/print$', 'explorer.views.print_html', name="file_print"), - # Task managment - # url(r'^manager/pull-requests$', 'explorer.views.pull_requests'), # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/(.*)', admin.site.root), - # Prototypes - # url(r'^wysiwyg-proto/', include('wysiwyg.urls')), - # Our über-restful api - url(r'^api/', include('api.urls') ), + url(r'^api/', include('api.urls')), )