Esempio n. 1
0
class ActiveDirectoryVariableSpecific(colander.MappingSchema):
    sssd_conf = colander.SchemaNode(deform.FileData(),
                                    widget=FileUploadWidget(filestore),
                                    title=_('SSSD conf'))
    krb5_conf = colander.SchemaNode(deform.FileData(),
                                    widget=FileUploadWidget(filestore),
                                    title=_('KRB5 conf'))
    smb_conf = colander.SchemaNode(deform.FileData(),
                                   widget=FileUploadWidget(filestore),
                                   title=_('SMB conf'))
    pam_conf = colander.SchemaNode(deform.FileData(),
                                   widget=FileUploadWidget(filestore),
                                   title=_('PAM conf'))
Esempio n. 2
0
class BankAccountStatement(MappingSchema):
    class Store(dict):
        def preview_url(self, name):
            return ''

    file = SchemaNode(FileData(),
                      widget=FileUploadWidget(Store(), accept='text/xml'))
Esempio n. 3
0
 class FileSchema(ContentSchema):
     file = SchemaNode(
         FileData(),
         title=_(u'File'),
         widget=FileUploadWidget(tmpstore),
         validator=validate_file_size_limit,
     )
Esempio n. 4
0
File: file.py Progetto: dnouri/Kotti
 class FileSchema(ContentSchema):
     file = SchemaNode(
         FileData(),
         title=_(u'File'),
         missing=null,
         widget=FileUploadWidget(tmpstore),
         )
Esempio n. 5
0
 def set_mode(self):
     kwargs = {'key': self.name}
     return FileFields(self.title,
                       self.name,
                       self.round,
                       widget=FileUploadWidget(self.tmpstore, **kwargs),
                       mapinit=None,
                       desc=self.desc)
Esempio n. 6
0
 def serialize(self, field, cstruct, **kw):
     if cstruct in (null, None):
         cstruct = {}
     kw['url'] = None
     if 'uid' not in cstruct and 'id' in cstruct:
         cstruct['uid'] = cstruct['id']
         if cstruct['id'] != null and self.get_url:
             kw['url'] = self.get_url(self.request, cstruct['id'])
     return DeformFileUploadWidget.serialize(self, field, cstruct, **kw)
Esempio n. 7
0
 def serialize(self, field, cstruct, **kw):
     if cstruct in (null, None):
         cstruct = {}
     kw['url'] = None
     if 'uid' not in cstruct and 'id' in cstruct:
         cstruct['uid'] = cstruct['id']
         if cstruct['id'] != null and self.get_url:
             kw['url'] = self.get_url(self.request, cstruct['id'])
     return DeformFileUploadWidget.serialize(self, field, cstruct, **kw)
Esempio n. 8
0
class AddBinarySchema(MappingSchema):
    binary = SchemaNode(FileData(),
                        widget=FileUploadWidget(TmpStore()),
                        validator=valid_binary_file)
    operatingsystem = SchemaNode(String(),
                                 widget=deferred_operating_system_widget,
                                 validator=deferred_operating_system_validator)
    architecture = SchemaNode(String(),
                              widget=deferred_architecture_widget,
                              validator=deferred_architecture_validator)
Esempio n. 9
0
 def serialize(self, field, cstruct, **kw):
     if cstruct in (null, None):
         cstruct = {}
     kw['url'] = None
     if 'uid' not in cstruct and self.id_field in cstruct:
         cstruct['uid'] = cstruct[self.id_field]
         if cstruct[self.id_field] != null and self.get_url:
             kw['url'] = self.get_url(self.request, cstruct[self.id_field])
     if cstruct.get('filename', None) == null:
         cstruct['filename'] = ""
     return DeformFileUploadWidget.serialize(self, field, cstruct, **kw)
Esempio n. 10
0
File: file.py Progetto: dnouri/Kotti
 class FileSchema(MappingSchema):
     title = SchemaNode(String(), title=_(u'Title'), missing=u'')
     description = SchemaNode(
         String(),
         title=_('Description'),
         missing=u"",
         widget=TextAreaWidget(cols=40, rows=5),
         )
     file = SchemaNode(
         FileData(),
         title=_(u'File'),
         widget=FileUploadWidget(tmpstore),
         )
Esempio n. 11
0
 class BannerBoxSchema(ContentSchema):
     file = colander.SchemaNode(
         FileData(),
         title=_(u'File'),
         widget=FileUploadWidget(tmpstore),
         validator=validate_file_size_limit,
     )
     link = colander.SchemaNode(
         colander.String(),
         title=_('Link'),
         validator=link_validator,
         missing=u'',
     )
Esempio n. 12
0
 class SubmissionSchema(colander.MappingSchema):
     name = colander.SchemaNode(colander.String(), title=_("Full Name"))
     sender = colander.SchemaNode(colander.String(),
                                  validator=colander.Email(),
                                  title=_("E-Mail Address"))
     subject = colander.SchemaNode(colander.String(), title=_("Subject"))
     content = colander.SchemaNode(colander.String(),
                                   widget=TextAreaWidget(cols=40, rows=5),
                                   title=_("Your message"))
     attachment = colander.SchemaNode(
         FileData(),
         title=_('Attachment'),
         widget=FileUploadWidget(tmpstore),
         validator=file_size_limit,
         missing=None,
     )
     _LOCALE_ = colander.SchemaNode(colander.String(),
                                    widget=HiddenWidget(),
                                    default=locale_name)
Esempio n. 13
0
class UpdateModel(colander.MappingSchema):
    '''
    Schema for representing an update in form 
    '''
    local_file = colander.SchemaNode(deform.FileData(),
                                     widget=FileUploadWidget(filestore),
                                     preparer=unzip_preparer,
                                     validator = colander.All(
                                         UpdateNamingValidator(), 
                                         UpdateSequenceValidator(),
                                         UpdateFileStructureValidator(), 
                                         UpdateControlFileValidator(),
                                         UpdateScriptRangeValidator()),
                                     missing=colander.null,
                                     title=_('Update ZIP'))
    remote_file = colander.SchemaNode(UrlFile(),
                                      preparer=unzip_preparer,
                                      validator = colander.All(
                                          UpdateNamingValidator(), 
                                          UpdateSequenceValidator(),
                                          UpdateFileStructureValidator(), 
                                          UpdateControlFileValidator()),
                                      missing=colander.null,
                                      title=_('URL download'))
Esempio n. 14
0
 def deserialize(self, field, pstruct):
     value = DeformFileUploadWidget.deserialize(self, field, pstruct)
     if value != null and 'fp' in value:
         value['data'] = value['fp']
     return value
Esempio n. 15
0
 def __init__(self, tmpstore, get_url=None, **kw):
     DeformFileUploadWidget.__init__(self, tmpstore, **kw)
     self.get_url = get_url
 def __init__(self, tmpstore, **kw):
     FileUploadWidget.__init__(self, **kw)
     self.tmpstore = tmpstore
Esempio n. 17
0
    def __init__(self, **kw):
        if 'tmpstore' not in kw:
            kw['tmpstore'] = MemoryTmpStore()

        FileUploadWidget.__init__(self, **kw)
Esempio n. 18
0
    def __init__(self, **kw):
        if 'tmpstore' not in kw:
            kw['tmpstore'] = MemoryTmpStore()

        FileUploadWidget.__init__(self, **kw)
Esempio n. 19
0
 def deserialize(self, field, pstruct):
     value = DeformFileUploadWidget.deserialize(self, field, pstruct)
     if value != null and 'fp' in value:
         value['data'] = value['fp']
     return value
Esempio n. 20
0
class Schema(colander.MappingSchema):
    file = colander.SchemaNode(FileData(), widget=FileUploadWidget(store))
Esempio n. 21
0
 def __init__(self, **kw):
     FileUploadWidget.__init__(self, None, **kw)
     self.tmpstore = tmpstore
     self.thumb_size = kw.get('thumb_size')
Esempio n. 22
0
class EditBinarySchema(MappingSchema):
    binary = SchemaNode(FileData(),
                        widget=FileUploadWidget(TmpStore()),
                        validator=valid_binary_file)
Esempio n. 23
0
import colander
from storage.schemas import FileData
from deform.widget import (TextInputWidget, TextAreaWidget, HiddenWidget,
                           FileUploadWidget)


class MemoryFileUploadTempStore(dict):
    def preview_url(self, uuid):
        return None


tmpstore = MemoryFileUploadTempStore()
input_widget = TextInputWidget(css_class='form-control')
text_widget = TextAreaWidget(css_class='form-control body-field')
file_widget = FileUploadWidget(tmpstore, css_class='form-control')


class BlogCreateSchema(colander.Schema):
    title = colander.SchemaNode(colander.String(),
                                title='Title',
                                widget=input_widget)
    slug = colander.SchemaNode(colander.String(),
                               missing=None,
                               title='Slug',
                               widget=input_widget)
    body = colander.SchemaNode(colander.String(),
                               title='Body',
                               widget=text_widget)
    image = colander.SchemaNode(FileData(upload_to='blog/'),
                                missing='',
                                title='Image',
Esempio n. 24
0
class AddSourceSchema(MappingSchema):
    source = SchemaNode(FileData(),
                        widget=FileUploadWidget(TmpStore()),
                        validator=valid_source_file)
Esempio n. 25
0
 def serialize(self, field, cstruct, **kw):
     if cstruct in (null, None):
         cstruct = {}
     if 'id' in cstruct:
         cstruct['uid'] = cstruct['id']
     return DeformFileUploadWidget.serialize(self, field, cstruct, **kw)
Esempio n. 26
0
 def __init__(self,**kw):
     FileUploadWidget.__init__(self, None, **kw)
     self.tmpstore = DummyTempStore()
Esempio n. 27
0
 def __init__(self, tmpstore, get_url=None, **kw):
     DeformFileUploadWidget.__init__(self, tmpstore, **kw)
     self.get_url = get_url