Esempio n. 1
0
class CarrierExtraSettings(colander.MappingSchema):
    carrier_image = colander.SchemaNode(deform.FileData(),
                                        widget=widget.FileUploadWidget(tmpstore=tmpstore),
                                        title='Carrier Image',
                                        description="Choose file to upload",
                                        missing=colander.null)
    carrier_motd = colander.SchemaNode(colander.String(),
                                       widget=widget.TextInputWidget(),
                                       description="Set your carrier's Motto / MOTD.",
                                       title="Carrier Motto",
                                       validator=colander.Length(max=150),
                                       missing=colander.null)
Esempio n. 2
0
class PDFUploadSchema(colander.Schema):
    """ use colander to define a data validation schema for linkage with
    a deform object.
    """
    csn = colander.SchemaNode

    serial = csn(colander.String(), validator=colander.Length(3, 50))

    # Based on: # http://stackoverflow.com/questions/6563546/\
    # how-to-make-file-upload-facultative-with-deform-and-colander
    # Various demos delete this temporary file on succesful submission
    pdf_tmp_store = MemoryTmpStore()
    fuw = widget.FileUploadWidget(pdf_tmp_store)
    pdf_upload = csn(FileData(), widget=fuw)
class StickerSchema(colander.Schema):
    """ use colander to define a data validation schema for linkage with
    a deform object.
    """
    serial = colander.SchemaNode(colander.String(),
                                 validator=colander.Length(3, 15))

    domain = colander.SchemaNode(colander.String(),
                                 validator=colander.url,
                                 default="http://waspho.com")

    # Based on: # http://stackoverflow.com/questions/6563546/\
    # how-to-make-file-upload-facultative-with-deform-and-colander
    # Various demos delete this temporary file on succesful submission
    tmpstore = MemoryTmpStore()
    fuw = widget.FileUploadWidget(tmpstore)
    upload = colander.SchemaNode(FileData(), 
                                 missing=colander.null,
                                 widget=fuw)
Esempio n. 4
0
    traits = []
    likes = []
    aboutme = colander.SchemaNode(
                colander.String(),
                validator=colander.Length(max=500),
                widget=widget.TextAreaWidget(rows=10, cols=40),
                description='Enter some text')

class EditPictureSchema(colander.MappingSchema):
	"""
	Picture edit schema
	"""
    image = colander.SchemaNode(
                FileData(),
                widget=widget.FileUploadWidget(tmpstore))

class MessageSchema(colander.MappingSchema):
	"""Messaging schema
	"""
    message = colander.SchemaNode(colander.String(),
                                  widget=widget.TextAreaWidget(rows=10, cols=40))

									  
"""Views"""

@view_config(route_name='root', renderer='templates/userhome.pt')
def root(request):
	"""The home page if you are logged in, this route shows a particular user,
	    or returns not found if that user doesn't exist
	"""
Esempio n. 5
0
class SampleSchema(c.MappingSchema):
    name = c.SchemaNode(c.String())
    image = c.SchemaNode(FileData(), widget=w.FileUploadWidget(store))
Esempio n. 6
0
class AddSchema(colander.Schema):
    upload = colander.SchemaNode(
                FileData(),
                widget=widget.FileUploadWidget(tmpstore),
                title='Unggah')
Esempio n. 7
0
class UploadSchema(colander.MappingSchema):
    title = colander.SchemaNode(colander.String())
    description = colander.SchemaNode(colander.String())
    file = colander.SchemaNode(FileData(),
                               widget=w.FileUploadWidget(Storage()))
    tags = Tags()