PEP8 and misc. cleanups

This commit is contained in:
Roberto Rosario
2014-05-19 20:31:01 -04:00
parent 5987a9ed53
commit c7e176a793
8 changed files with 61 additions and 67 deletions

View File

@@ -20,7 +20,7 @@ from .events import (HISTORY_DOCUMENT_CREATED,
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED) HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
from .links import (document_list, document_list_recent, from .links import (document_list, document_list_recent,
document_view_simple, document_view_advanced, document_view_simple, document_view_advanced,
document_delete, document_multiple_delete, document_edit, document_preview, document_delete, document_multiple_delete, document_edit,
document_download, document_multiple_download, document_version_download, document_download, document_multiple_download, document_version_download,
document_find_duplicates, document_find_all_duplicates, document_update_page_count, document_find_duplicates, document_find_all_duplicates, document_update_page_count,
document_clear_transformations, document_multiple_clear_transformations, document_clear_transformations, document_multiple_clear_transformations,
@@ -37,14 +37,11 @@ from .links import (document_list, document_list_recent,
from .models import (Document, DocumentPage, from .models import (Document, DocumentPage,
DocumentPageTransformation, DocumentType, DocumentTypeFilename, DocumentPageTransformation, DocumentType, DocumentTypeFilename,
DocumentVersion) DocumentVersion)
from .permissions import (PERMISSION_DOCUMENT_CREATE, from .permissions import (
PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW, PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW,
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD,
PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_TOOLS, PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_EDIT,
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_NEW_VERSION)
PERMISSION_DOCUMENT_TYPE_EDIT, PERMISSION_DOCUMENT_TYPE_DELETE,
PERMISSION_DOCUMENT_TYPE_CREATE, PERMISSION_DOCUMENT_TYPE_VIEW,
PERMISSION_DOCUMENT_NEW_VERSION)
from .widgets import document_thumbnail from .widgets import document_thumbnail
# History setup # History setup
@@ -95,7 +92,7 @@ register_diagnostic('documents', _(u'Documents'), document_missing_list)
register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents')) register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))
register_model_list_columns(Document, [ register_model_list_columns(Document, [
{'name':_(u'thumbnail'), 'attribute': {'name': _(u'thumbnail'), 'attribute':
encapsulate(lambda x: document_thumbnail(x)) encapsulate(lambda x: document_thumbnail(x))
}, },
]) ])
@@ -119,7 +116,7 @@ register_links(Document, [document_view_advanced], menu_name='form_header', posi
register_links(Document, [document_history_view], menu_name='form_header') register_links(Document, [document_history_view], menu_name='form_header')
register_links(Document, [document_version_list], menu_name='form_header') register_links(Document, [document_version_list], menu_name='form_header')
if (validate_path(document_settings.CACHE_PATH) == False) or (not document_settings.CACHE_PATH): if (not validate_path(document_settings.CACHE_PATH)) or (not document_settings.CACHE_PATH):
setattr(document_settings, 'CACHE_PATH', tempfile.mkdtemp()) setattr(document_settings, 'CACHE_PATH', tempfile.mkdtemp())
register_setup(document_type_setup) register_setup(document_type_setup)

View File

@@ -20,9 +20,9 @@ class DocumentVersionInline(admin.StackedInline):
extra = 1 extra = 1
classes = ('collapse-open',) classes = ('collapse-open',)
allow_add = True allow_add = True
#inlines = [ # inlines = [
# DocumentPageInline, # DocumentPageInline,
#] # ]
class DocumentTypeFilenameInline(admin.StackedInline): class DocumentTypeFilenameInline(admin.StackedInline):

View File

@@ -1,23 +1,24 @@
from __future__ import absolute_import from __future__ import absolute_import
from django import forms from django import forms
from django.core.urlresolvers import reverse
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext from django.utils.translation import ugettext
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe from common.conf.settings import DEFAULT_PAPER_SIZE, DEFAULT_PAGE_ORIENTATION
from django.utils.html import conditional_escape
from django.utils.encoding import force_unicode
from common.forms import DetailForm from common.forms import DetailForm
from common.literals import PAGE_SIZE_CHOICES, PAGE_ORIENTATION_CHOICES from common.literals import PAGE_SIZE_CHOICES, PAGE_ORIENTATION_CHOICES
from common.conf.settings import DEFAULT_PAPER_SIZE, DEFAULT_PAGE_ORIENTATION
from common.widgets import TextAreaDiv from common.widgets import TextAreaDiv
from .models import (Document, DocumentType, from .models import (Document, DocumentType,
DocumentPage, DocumentPageTransformation, DocumentTypeFilename, DocumentPage, DocumentPageTransformation, DocumentTypeFilename,
DocumentVersion) DocumentVersion)
from .literals import (RELEASE_LEVEL_FINAL, RELEASE_LEVEL_CHOICES,
DEFAULT_ZIP_FILENAME)
from .widgets import document_html_widget from .widgets import document_html_widget
from .literals import (RELEASE_LEVEL_FINAL, RELEASE_LEVEL_CHOICES, DEFAULT_ZIP_FILENAME)
# Document page forms # Document page forms
@@ -283,10 +284,10 @@ class DocumentTypeSelectForm(forms.Form):
class PrintForm(forms.Form): class PrintForm(forms.Form):
#page_size = forms.ChoiceField(choices=PAGE_SIZE_CHOICES, initial=DEFAULT_PAPER_SIZE, label=_(u'Page size'), required=False) # page_size = forms.ChoiceField(choices=PAGE_SIZE_CHOICES, initial=DEFAULT_PAPER_SIZE, label=_(u'Page size'), required=False)
#custom_page_width = forms.CharField(label=_(u'Custom page width'), required=False) # custom_page_width = forms.CharField(label=_(u'Custom page width'), required=False)
#custom_page_height = forms.CharField(label=_(u'Custom page height'), required=False) # custom_page_height = forms.CharField(label=_(u'Custom page height'), required=False)
#page_orientation = forms.ChoiceField(choices=PAGE_ORIENTATION_CHOICES, initial=DEFAULT_PAGE_ORIENTATION, label=_(u'Page orientation'), required=True) # page_orientation = forms.ChoiceField(choices=PAGE_ORIENTATION_CHOICES, initial=DEFAULT_PAGE_ORIENTATION, label=_(u'Page orientation'), required=True)
page_range = forms.CharField(label=_(u'Page range'), required=False) page_range = forms.CharField(label=_(u'Page range'), required=False)
@@ -315,16 +316,14 @@ class DocumentTypeFilenameForm_create(forms.ModelForm):
model = DocumentTypeFilename model = DocumentTypeFilename
fields = ('filename',) fields = ('filename',)
class DocumentDownloadForm(forms.Form): class DocumentDownloadForm(forms.Form):
compressed = forms.BooleanField(label=_(u'Compress'), required=False, help_text=_(u'Download the document in the original format or in a compressed manner. This option is selectable only when downloading one document, for multiple documents, the bundle will always be downloads as a compressed file.')) compressed = forms.BooleanField(label=_(u'Compress'), required=False, help_text=_(u'Download the document in the original format or in a compressed manner. This option is selectable only when downloading one document, for multiple documents, the bundle will always be downloads as a compressed file.'))
zip_filename = forms.CharField(initial=DEFAULT_ZIP_FILENAME, label=_(u'Compressed filename'), required=False, help_text=_(u'The filename of the compressed file that will contain the documents to be downloaded, if the previous option is selected.')) zip_filename = forms.CharField(initial=DEFAULT_ZIP_FILENAME, label=_(u'Compressed filename'), required=False, help_text=_(u'The filename of the compressed file that will contain the documents to be downloaded, if the previous option is selected.'))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.document_versions = kwargs.pop('document_versions', None) self.document_versions = kwargs.pop('document_versions', None)
super(DocumentDownloadForm, self).__init__(*args, **kwargs) super(DocumentDownloadForm, self).__init__(*args, **kwargs)
if len(self.document_versions) > 1: if len(self.document_versions) > 1:
self.fields['compressed'].initial = True self.fields['compressed'].initial = True
self.fields['compressed'].widget.attrs.update({'disabled': True}) self.fields['compressed'].widget.attrs.update({'disabled': True})

View File

@@ -5,14 +5,13 @@ from django.utils.translation import ugettext_lazy as _
from history.permissions import PERMISSION_HISTORY_VIEW from history.permissions import PERMISSION_HISTORY_VIEW
from .conf.settings import ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL from .conf.settings import ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL
from .permissions import (PERMISSION_DOCUMENT_CREATE, from .permissions import (PERMISSION_DOCUMENT_PROPERTIES_EDIT,
PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW, PERMISSION_DOCUMENT_VIEW, PERMISSION_DOCUMENT_DELETE,
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_TRANSFORM,
PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_TOOLS, PERMISSION_DOCUMENT_TOOLS, PERMISSION_DOCUMENT_EDIT,
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_TYPE_EDIT,
PERMISSION_DOCUMENT_TYPE_EDIT, PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_CREATE,
PERMISSION_DOCUMENT_TYPE_CREATE, PERMISSION_DOCUMENT_TYPE_VIEW, PERMISSION_DOCUMENT_TYPE_VIEW)
PERMISSION_DOCUMENT_NEW_VERSION)
# Document page links expressions # Document page links expressions

View File

@@ -370,7 +370,7 @@ class DocumentVersion(models.Model):
if not self.pk: if not self.pk:
self.timestamp = datetime.datetime.now() self.timestamp = datetime.datetime.now()
#Only do this for new documents # Only do this for new documents
transformations = kwargs.pop('transformations', None) transformations = kwargs.pop('transformations', None)
super(DocumentVersion, self).save(*args, **kwargs) super(DocumentVersion, self).save(*args, **kwargs)
@@ -378,7 +378,7 @@ class DocumentVersion(models.Model):
DocumentVersion._post_save_hooks[key](self) DocumentVersion._post_save_hooks[key](self)
if new_document: if new_document:
#Only do this for new documents # Only do this for new documents
self.update_checksum(save=False) self.update_checksum(save=False)
self.update_mimetype(save=False) self.update_mimetype(save=False)
self.save() self.save()
@@ -432,7 +432,7 @@ class DocumentVersion(models.Model):
return detected_pages return detected_pages
def apply_default_transformations(self, transformations): def apply_default_transformations(self, transformations):
#Only apply default transformations on new documents # Only apply default transformations on new documents
if reduce(lambda x, y: x + y, [page.documentpagetransformation_set.count() for page in self.pages.all()]) == 0: if reduce(lambda x, y: x + y, [page.documentpagetransformation_set.count() for page in self.pages.all()]) == 0:
for transformation in transformations: for transformation in transformations:
for document_page in self.pages.all(): for document_page in self.pages.all():

View File

@@ -22,7 +22,7 @@ class DocumentTestCase(unittest.TestCase):
description='description', description='description',
) )
self.document.save() self.document.save()
#return File(file(self.filepath, 'rb'), name=self.filename) # return File(file(self.filepath, 'rb'), name=self.filename)
file_object = open(os.path.join(settings.PROJECT_ROOT, 'contrib', 'mayan_11_1.pdf')) file_object = open(os.path.join(settings.PROJECT_ROOT, 'contrib', 'mayan_11_1.pdf'))
new_version = self.document.new_version(file=File(file_object, name='mayan_11_1.pdf')) new_version = self.document.new_version(file=File(file_object, name='mayan_11_1.pdf'))
@@ -71,7 +71,7 @@ class DocumentTestCase(unittest.TestCase):
self.failUnlessEqual(self.document.latest_version.get_formated_version(), '3.0') self.failUnlessEqual(self.document.latest_version.get_formated_version(), '3.0')
#GPGVerificationError # GPGVerificationError
self.failUnlessEqual(self.document.verify_signature(), None) self.failUnlessEqual(self.document.verify_signature(), None)
file_object = open(os.path.join(settings.PROJECT_ROOT, 'contrib', 'mayan_11_1.pdf.sig'), 'rb') file_object = open(os.path.join(settings.PROJECT_ROOT, 'contrib', 'mayan_11_1.pdf.sig'), 'rb')

View File

@@ -2,6 +2,7 @@ import os
from common.conf.settings import TEMPORARY_DIRECTORY from common.conf.settings import TEMPORARY_DIRECTORY
def document_save_to_temp_dir(document, filename, buffer_size=1024 * 1024): def document_save_to_temp_dir(document, filename, buffer_size=1024 * 1024):
temporary_path = os.path.join(TEMPORARY_DIRECTORY, filename) temporary_path = os.path.join(TEMPORARY_DIRECTORY, filename)
return document.save_to_file(temporary_path, buffer_size) return document.save_to_file(temporary_path, buffer_size)

View File

@@ -36,13 +36,11 @@ from history.api import create_history
from navigation.utils import resolve_to_name from navigation.utils import resolve_to_name
from permissions.models import Permission from permissions.models import Permission
from .events import (HISTORY_DOCUMENT_CREATED, from .events import HISTORY_DOCUMENT_EDITED
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
from .conf.settings import (PREVIEW_SIZE, STORAGE_BACKEND, ZOOM_PERCENT_STEP, from .conf.settings import (PREVIEW_SIZE, STORAGE_BACKEND, ZOOM_PERCENT_STEP,
ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL, ROTATION_STEP, PRINT_SIZE, ZOOM_MAX_LEVEL, ZOOM_MIN_LEVEL, ROTATION_STEP, PRINT_SIZE,
RECENT_COUNT) RECENT_COUNT)
from .forms import (DocumentTypeSelectForm, from .forms import (DocumentForm_edit, DocumentPropertiesForm,
DocumentForm_edit, DocumentPropertiesForm,
DocumentPreviewForm, DocumentPageForm, DocumentPreviewForm, DocumentPageForm,
DocumentPageTransformationForm, DocumentContentForm, DocumentPageTransformationForm, DocumentContentForm,
DocumentPageForm_edit, DocumentPageForm_text, PrintForm, DocumentPageForm_edit, DocumentPageForm_text, PrintForm,
@@ -51,13 +49,13 @@ from .forms import (DocumentTypeSelectForm,
from .models import (Document, DocumentType, DocumentPage, from .models import (Document, DocumentType, DocumentPage,
DocumentPageTransformation, RecentDocument, DocumentTypeFilename, DocumentPageTransformation, RecentDocument, DocumentTypeFilename,
DocumentVersion) DocumentVersion)
from .permissions import (PERMISSION_DOCUMENT_CREATE, from .permissions import (PERMISSION_DOCUMENT_PROPERTIES_EDIT,
PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW, PERMISSION_DOCUMENT_VIEW, PERMISSION_DOCUMENT_DELETE,
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_TRANSFORM,
PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_TOOLS, PERMISSION_DOCUMENT_TOOLS, PERMISSION_DOCUMENT_EDIT,
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_VERSION_REVERT, PERMISSION_DOCUMENT_TYPE_EDIT,
PERMISSION_DOCUMENT_TYPE_EDIT, PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_CREATE,
PERMISSION_DOCUMENT_TYPE_CREATE, PERMISSION_DOCUMENT_TYPE_VIEW) PERMISSION_DOCUMENT_TYPE_VIEW)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -96,7 +94,7 @@ def document_view(request, document_id, advanced=False):
except PermissionDenied: except PermissionDenied:
AccessEntry.objects.check_access(PERMISSION_DOCUMENT_VIEW, request.user, document) AccessEntry.objects.check_access(PERMISSION_DOCUMENT_VIEW, request.user, document)
#document = get_object_or_404(Document.objects.select_related(), pk=document_id) # document = get_object_or_404(Document.objects.select_related(), pk=document_id)
# Triggers a 404 error on documents uploaded via local upload # Triggers a 404 error on documents uploaded via local upload
# TODO: investigate # TODO: investigate
@@ -109,11 +107,11 @@ def document_view(request, document_id, advanced=False):
{'label': _(u'Filename'), 'field': 'filename'}, {'label': _(u'Filename'), 'field': 'filename'},
{'label': _(u'File mimetype'), 'field': lambda x: x.file_mimetype or _(u'None')}, {'label': _(u'File mimetype'), 'field': lambda x: x.file_mimetype or _(u'None')},
{'label': _(u'File mime encoding'), 'field': lambda x: x.file_mime_encoding or _(u'None')}, {'label': _(u'File mime encoding'), 'field': lambda x: x.file_mime_encoding or _(u'None')},
{'label': _(u'File size'), 'field':lambda x: pretty_size(x.size) if x.size else '-'}, {'label': _(u'File size'), 'field': lambda x: pretty_size(x.size) if x.size else '-'},
{'label': _(u'Exists in storage'), 'field': 'exists'}, {'label': _(u'Exists in storage'), 'field': 'exists'},
{'label': _(u'File path in storage'), 'field': 'file'}, {'label': _(u'File path in storage'), 'field': 'file'},
{'label': _(u'Date added'), 'field':lambda x: x.date_added.date()}, {'label': _(u'Date added'), 'field': lambda x: x.date_added.date()},
{'label': _(u'Time added'), 'field':lambda x: unicode(x.date_added.time()).split('.')[0]}, {'label': _(u'Time added'), 'field': lambda x: unicode(x.date_added.time()).split('.')[0]},
{'label': _(u'Checksum'), 'field': 'checksum'}, {'label': _(u'Checksum'), 'field': 'checksum'},
{'label': _(u'UUID'), 'field': 'uuid'}, {'label': _(u'UUID'), 'field': 'uuid'},
{'label': _(u'Pages'), 'field': 'page_count'}, {'label': _(u'Pages'), 'field': 'page_count'},
@@ -191,7 +189,7 @@ def document_delete(request, document_id=None, document_id_list=None):
messages.warning(request, warning) messages.warning(request, warning)
document.delete() document.delete()
#create_history(HISTORY_DOCUMENT_DELETED, data={'user': request.user, 'document': document}) # create_history(HISTORY_DOCUMENT_DELETED, data={'user': request.user, 'document': document})
messages.success(request, _(u'Document deleted successfully.')) messages.success(request, _(u'Document deleted successfully.'))
except Exception, e: except Exception, e:
messages.error(request, _(u'Document: %(document)s delete error: %(error)s') % { messages.error(request, _(u'Document: %(document)s delete error: %(error)s') % {
@@ -818,18 +816,18 @@ def document_print(request, document_id):
hard_copy_arguments['page_range'] = form.cleaned_data['page_range'] hard_copy_arguments['page_range'] = form.cleaned_data['page_range']
# Compute page width and height # Compute page width and height
#if form.cleaned_data['custom_page_width'] and form.cleaned_data['custom_page_height']: # if form.cleaned_data['custom_page_width'] and form.cleaned_data['custom_page_height']:
# page_width = form.cleaned_data['custom_page_width'] # page_width = form.cleaned_data['custom_page_width']
# page_height = form.cleaned_data['custom_page_height'] # page_height = form.cleaned_data['custom_page_height']
#elif form.cleaned_data['page_size']: # elif form.cleaned_data['page_size']:
# page_width, page_height = dict(PAGE_SIZE_DIMENSIONS)[form.cleaned_data['page_size']] # page_width, page_height = dict(PAGE_SIZE_DIMENSIONS)[form.cleaned_data['page_size']]
# Page orientation # Page orientation
#if form.cleaned_data['page_orientation'] == PAGE_ORIENTATION_LANDSCAPE: # if form.cleaned_data['page_orientation'] == PAGE_ORIENTATION_LANDSCAPE:
# page_width, page_height = page_height, page_width # page_width, page_height = page_height, page_width
#hard_copy_arguments['page_width'] = page_width # hard_copy_arguments['page_width'] = page_width
#hard_copy_arguments['page_height'] = page_height # hard_copy_arguments['page_height'] = page_height
new_url = [reverse('document_hard_copy', args=[document_id])] new_url = [reverse('document_hard_copy', args=[document_id])]
if hard_copy_arguments: if hard_copy_arguments:
@@ -837,8 +835,8 @@ def document_print(request, document_id):
new_window_url = u'?'.join(new_url) new_window_url = u'?'.join(new_url)
new_window_url_name = u'document_hard_copy' new_window_url_name = u'document_hard_copy'
#html_redirect = next # html_redirect = next
#messages.success(request, _(u'Preparing document hardcopy.')) # messages.success(request, _(u'Preparing document hardcopy.'))
else: else:
form = PrintForm() form = PrintForm()
@@ -853,7 +851,7 @@ def document_print(request, document_id):
def document_hard_copy(request, document_id): def document_hard_copy(request, document_id):
#TODO: FIXME # TODO: FIXME
document = get_object_or_404(Document, pk=document_id) document = get_object_or_404(Document, pk=document_id)
try: try:
@@ -863,10 +861,10 @@ def document_hard_copy(request, document_id):
RecentDocument.objects.add_document_for_user(request.user, document) RecentDocument.objects.add_document_for_user(request.user, document)
#arguments, warnings = calculate_converter_arguments(document, size=PRINT_SIZE, file_format=DEFAULT_FILE_FORMAT) # arguments, warnings = calculate_converter_arguments(document, size=PRINT_SIZE, file_format=DEFAULT_FILE_FORMAT)
# Pre-generate # Pre-generate
#convert_document(document, **arguments) # convert_document(document, **arguments)
# Extract dimension values ignoring any unit # Extract dimension values ignoring any unit
page_width = request.GET.get('page_width', dict(PAGE_SIZE_DIMENSIONS)[DEFAULT_PAPER_SIZE][0]) page_width = request.GET.get('page_width', dict(PAGE_SIZE_DIMENSIONS)[DEFAULT_PAPER_SIZE][0])
@@ -948,7 +946,7 @@ def document_type_edit(request, document_type_id):
return render_to_response('generic_form.html', { return render_to_response('generic_form.html', {
'title': _(u'edit document type: %s') % document_type, 'title': _(u'edit document type: %s') % document_type,
'form': form, 'form': form,
#'object': document_type, # 'object': document_type,
'object_name': _(u'document type'), 'object_name': _(u'document type'),
'navigation_object_name': 'document_type', 'navigation_object_name': 'document_type',
'document_type': document_type, 'document_type': document_type,