Merge branch 'master' of stigma:platforma
authorŁukasz Rekucki <lrekucki@gmail.com>
Tue, 20 Oct 2009 12:42:45 +0000 (14:42 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Tue, 20 Oct 2009 12:42:45 +0000 (14:42 +0200)
Conflicts:
platforma/urls.py

1  2 
apps/api/forms.py
platforma/urls.py

diff --combined 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']        
          
             
  
  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
@@@ -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<folder>[^/]+)/$', '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<name>[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<docid>[^/]+)/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')),
      
  )