Fixed DC panel form. PersonListField was raising a TypeError.
authorŁukasz Rekucki <lrekucki@gmail.com>
Wed, 2 Sep 2009 12:24:10 +0000 (14:24 +0200)
committerŁukasz Rekucki <lrekucki@gmail.com>
Wed, 2 Sep 2009 12:24:10 +0000 (14:24 +0200)
apps/explorer/forms.py
apps/explorer/views.py

index d79bc74..4946be6 100644 (file)
@@ -19,7 +19,7 @@ class PersonListField(forms.Field):
         super(PersonListField, self).__init__(*args, **kwargs)
     
     def _get_initial(self):
         super(PersonListField, self).__init__(*args, **kwargs)
     
     def _get_initial(self):
-        return u'\n'.join( ( unicode(person) for person in self._initial) )
+        return self._initial and (u'\n'.join( ( unicode(person) for person in self._initial)))
 
     def _set_initial(self, value):
         if value is None:
 
     def _set_initial(self, value):
         if value is None:
index 6754930..1f53771 100644 (file)
@@ -210,10 +210,9 @@ def dceditor_panel(request, path, repo):
 
     try:
         doc_text = repo.get_file(path, user_branch)
 
     try:
         doc_text = repo.get_file(path, user_branch)
-
         document = parser.WLDocument.from_string(doc_text)
         form = forms.DublinCoreForm(info=document.book_info)       
         document = parser.WLDocument.from_string(doc_text)
         form = forms.DublinCoreForm(info=document.book_info)       
-
+        print "FORM: ", form
         return direct_to_template(request, 'explorer/panels/dceditor.html', extra_context={
             'fpath': path,
             'form': form,
         return direct_to_template(request, 'explorer/panels/dceditor.html', extra_context={
             'fpath': path,
             'form': form,