<s> from __future__ import unicode_literals <EOL> import logging <EOL> from django import forms <EOL> from django . utils . translation import ugettext <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from documents . forms import DocumentForm <EOL> from . models import ( <EOL> IMAPEmail , POP3Email , StagingFolderSource , WebFormSource , <EOL> WatchFolderSource <EOL> ) <EOL> logger = logging . getLogger ( __name__ ) <EOL> class NewDocumentForm ( DocumentForm ) : <EOL> class Meta ( DocumentForm . Meta ) : <EOL> exclude = ( '<STR_LIT:label>' , '<STR_LIT:description>' ) <EOL> class NewVersionForm ( forms . Form ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( NewVersionForm , self ) . __init__ ( * args , ** kwargs ) <EOL> self . fields [ '<STR_LIT>' ] = forms . CharField ( <EOL> label = _ ( '<STR_LIT>' ) , <EOL> required = False , <EOL> widget = forms . widgets . Textarea ( attrs = { '<STR_LIT>' : <NUM_LIT:4> } ) , <EOL> ) <EOL> class UploadBaseForm ( forms . Form ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> show_expand = kwargs . pop ( '<STR_LIT>' , False ) <EOL> self . source = kwargs . pop ( '<STR_LIT:source>' ) <EOL> super ( UploadBaseForm , self ) . __init__ ( * args , ** kwargs ) <EOL> if show_expand : <EOL> self . fields [ '<STR_LIT>' ] = forms . BooleanField ( <EOL> label = _ ( '<STR_LIT>' ) , required = False , <EOL> help_text = ugettext ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> ) <EOL> class StagingUploadForm ( UploadBaseForm ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( StagingUploadForm , self ) . __init__ ( * args , ** kwargs ) <EOL> try : <EOL> self . fields [ '<STR_LIT>' ] . choices = [ <EOL> ( staging_file . encoded_filename , unicode ( staging_file ) ) for staging_file in self . source . get_files ( ) <EOL> ] <EOL> except Exception as exception : <EOL> logger . error ( '<STR_LIT>' , exception ) <EOL> staging_file_id = forms . ChoiceField ( label = _ ( '<STR_LIT>' ) ) <EOL> class WebFormUploadForm ( UploadBaseForm ) : <EOL> file = forms . FileField ( label = _ ( '<STR_LIT>' ) ) <EOL> class WebFormSetupForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> fields = ( '<STR_LIT:label>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> model = WebFormSource <EOL> class StagingFolderSetupForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> fields = ( <EOL> '<STR_LIT:label>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> model = StagingFolderSource <EOL> class EmailSetupBaseForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> fields = ( <EOL> '<STR_LIT:label>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT:host>' , '<STR_LIT>' , '<STR_LIT:port>' , '<STR_LIT:username>' , '<STR_LIT:password>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> widgets = { <EOL> '<STR_LIT:password>' : forms . widgets . PasswordInput ( render_value = True ) <EOL> } <EOL> class IMAPEmailSetupForm ( EmailSetupBaseForm ) : <EOL> class Meta ( EmailSetupBaseForm . Meta ) : <EOL> fields = EmailSetupBaseForm . Meta . fields + ( '<STR_LIT>' , ) <EOL> model = IMAPEmail <EOL> class POP3EmailSetupForm ( EmailSetupBaseForm ) : <EOL> class Meta ( EmailSetupBaseForm . Meta ) : <EOL> fields = EmailSetupBaseForm . Meta . fields + ( '<STR_LIT>' , ) <EOL> model = POP3Email <EOL> class WatchFolderSetupForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> fields = ( <EOL> '<STR_LIT:label>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> model = WatchFolderSource </s>
