Exemple #1
0
    def make_form(self, user=None):
        if user is None:
            return form.Form(
                form.Textbox('name'), form.Textbox('username'),
                form.Textarea('about'),
                form.File('profile', description='profile picture'),
                form.Button('save'))

        return form.Form(form.Textbox('name', value=user.name),
                         form.Textbox('username', value=user.username),
                         form.Textarea('about', value=user.about),
                         form.File('profile', description='profile picture'),
                         form.Button('save'))()
Exemple #2
0
 def GET(self):
     if web.ctx.session.login != 1:
         raise web.seeother('/#login')
     addbook = form.Form(
         form.Textbox('book_num', description = "Book Number", class_ = 'form-control'),
         form.Textbox('type', description = 'Book type', class_ = 'form-control'),
         form.Textbox('title', description = 'Book name', class_ = 'form-control'),
         form.Textbox('press', description = 'Press', class_ = 'form-control'),
         form.Textbox('year', description = 'Year', class_ = 'form-control'),
         form.Textbox('author', description = 'Author', class_ = 'form-control'),
         form.Textbox('price', description = 'Price', class_ = 'form-control'),
         form.Textbox('amount', description = 'Amount', class_ = 'form-control'),
         form.Hidden('optype', value = 'addbook'),
         # form.Button("Submit", class_ = "btn btn-primary"),
         )
     appendbook = form.Form(
         form.Textbox('book_num', description = 'Book Number', class_ = 'form-control'),
         form.Textbox('quantity', description = 'Quantity', class_ = 'form-control'),
         form.Hidden('optype', value = 'appendbook'),
         )
     addbooklist = form.Form(
         form.File(name = "Upload"),
         # form.Button("Submit", class_ = "btn btn-primary"),
         )
     return render.addbook(addbook, appendbook, addbooklist,web.ctx.session)
Exemple #3
0
 def form(self):
     return form.Form(
         form.File(
             'resume_fn',
             form.notnull,
             description='It will take forever if we validate the form'),
         form.Button('submit', type='submit', value='Apply'))
Exemple #4
0
    form.Textbox('middle_user'),
    form.Password('middle_password'),

    form.Textbox("second_server"),
    form.Textbox("second_port"),
    form.Textbox('second_user'),
    form.Password('second_password'),

    form.Textbox("third_server"),
    form.Textbox("third_port"),
    form.Textbox('third_user'),
    form.Password('third_password'),

    form.Textbox('exec_command'),

    form.File('myfile'),
    form.Textbox('file_send_location'),

    form.Textbox('file_receive'),
    form.Textbox('file_receive_location'))
    #form.Textbox('file_send'),

def myfirstconnect(middle_server, middle_port, middle_user, middle_password, mycommand, file_send, file_rec, rece_f_loc, send_f_loc):
    myreturn=''

    try:
        import paramiko
        paramiko.util.log_to_file('/tmp/filename.log')

    except:
        print "import error"
Exemple #5
0
    def form(self):

        return form.Form(
            form.File('file_csv', form.notnull, description='CSV File'),
            form.Button('submit', type='submit', value='Send emails'),
        )
     description='Personal Website (optional)',
     pre='<label class="help">If you have a personal website, please provide its url with http.</label>'),
 form.Textbox('interests', 
     form.notnull,
     description='Interests *',
     pre='<label class="help">Please provide 3-10 keywords/keyphrases, separated by commas.</label>'),
 form.Dropdown('degree', 
     ('', 'Highschool', 'Bachelors', 'Masters', 'PhD', 'Other'),
     form.notnull,
     description='Highest Degree Attained *'),
 form.Dropdown('occupation', 
     ('', 'Undergraduate student', 'PhD student', 'Postdoc', 'Faculty', 'Industry Researcher', 'Other'),
     form.notnull,
     description='Current Occupation *'),
 form.File('resume', 
     form.notnull,
     description='Upload your resume in pdf. *'),
 
 ## EDITED BY: rgap
 # form.Radio('pascal_member', 
 #     ('Yes', 'No'),
 #     description='Pascal Member (optional)',
 #     pre='<label class="help">Are you a member of the PASCAL European network?</label>'),
 
 form.Textbox('referee_name', 
     form.notnull,
     description='Referee Name *',
     pre='<label class="help">Your referee will receive an email asking for a letter of reference. Please <strong>make sure that the referee email is well written and he actually can receive emails, if we make any correction your referee will not receive any confirmation, just you</strong>, so also make sure that he received it, and that he/she is willing to submit a letter by <strong>%s</strong>, 2016.</label>' % config.date_referee_deadline),
 form.Textbox('referee_affiliation', 
     form.notnull,
     description='Referee Affiliation *'),
Exemple #7
0
bulkcert_form = BootstrapFormTable(
    form.Dropdown('selected_ca',
                  [('value1', 'description1'), ('value2', 'description2')],
                  class_='form-control input-sm input-sm',
                  description='Select CA'),
    form.Dropdown('certtype',
                  ['Client', 'Server'],
                  class_='form-control input-sm input-sm',
                  description='Select Certificate Type'),
    form.Password('password',
                  form.notnull,
                  class_='form-control input-sm input-sm',
                  description='Password'),
    form.File('req_list',
              type='file',
              class_='form-control input-sm input-sm',
              description='Bulk request file'),
    form.Hidden('mode',
                type='readonly',
                class_='form-control input-sm',
                value='bulk')
)

revoke_form = BootstrapFormInline(
    form.Dropdown('selected_ca',
                  [('value1', 'description1'), ('value2', 'description2')],
                  class_='form-control input-sm',
                  onchange='getList(this.value)',
                  description='Select CA'),
    form.Password('password',
                  form.notnull,
Exemple #8
0
 def make_form(self, boards=None):
     boards = boards or []
     boards = [(x.id, x.name) for x in boards]
     return form.Form(form.File('image'), form.Textarea('description'),
                      form.Dropdown('board', boards),
                      form.Button('add', id='btn-add'))()
Exemple #9
0
find_project = form.Form(
    form.Textbox("Name", form.notnull),
    form.Textbox(
        "Date from", form.notnull,
        form.Validator('Format: dd/mm/yyyy', lambda x: validate_date(x))),
    form.Textbox(
        "to", form.notnull,
        form.Validator('Format: dd/mm/yyyy', lambda x: validate_date(x))),
    form.Button('Find', value="Find"))

create_individual = form.Form(
    form.Textbox("Name", form.notnull), form.Textarea('Description'),
    form.Textbox(
        "Birth Date", form.notnull,
        form.Validator('Format: dd/mm/yyyy', lambda x: validate_date(x))),
    form.File(name='Picture'), form.Button('Create', value="Create"))

find_individual = form.Form(
    form.Textbox("Name", form.notnull),
    form.Textbox(
        "Birth Date from", form.notnull,
        form.Validator('Format: dd/mm/yyyy', lambda x: validate_date(x))),
    form.Textbox(
        "to", form.notnull,
        form.Validator('Format: dd/mm/yyyy', lambda x: validate_date(x))),
    form.Button('Find', value="Find"))


def validate_date(date):
    match = re.match('(^\d{1,2}[\/|-]\d{1,2}[\/|-]\d{4}$)', date)
    if match:
Exemple #10
0
urls = (
    '/','index',
    '/upload', 'upload',
    '/marks','marks',
    '/markedit','markedit',
    '/reports', 'reports',
    '/delmarks', 'delmarks',
    '/stu', 'stu',
    '/stuview','stuview',
    )

app=web.application(urls,globals())

uploadform = form.Form (
    form.File('datafile'),
    # form.Dropdown('asmt',[('FA1','FA1'),('FA2','FA2'),('SA1','SA1'),('FA3','FA3'), ('FA4','FA4'), ('SA2','SA2')]),
    # form.Dropdown('year',[('2010-11','2010-11'),('2011-12','2011-12')]),
    # form.Dropdown('std',[('9','9'),('10','10')]),
    # form.Dropdown('section',[('A','A'),('B','B'),('C','C')]),
    # form.Dropdown('subject',[('Kannada','Kannada'),('Maths','Maths')]),
    # form.Textbox('per'),
    form.Button('Upload')
    )

marksform = form.Form(
    form.Dropdown('asmt',[('FA1','FA1'),('FA2','FA2'),('SA1','SA1'),('FA3','FA3'), ('FA4','FA4'), ('SA2','SA2'),('All','All')]),
    form.Dropdown('year',[('2010-11','2010-11'),('2011-12','2011-12')]),
    form.Dropdown('std',[('9','9'),('10','10')]),
    form.Dropdown('section',[('A','A'),('B','B'),('C','C')]),
    form.Dropdown('subject',[('Kannada','Kannada'),('Maths','Maths')]),
import web, shutil
from web import form
import os
import tensorflow.keras
from PIL import Image, ImageOps
import numpy as np

#URLS = ('/upload', 'Upload')
render = web.template.render("senales/")
fileForm = form.Form(form.File('myfile'))

class Index(object):

    def GET(self):
        f = fileForm()
        return render.index(f)
        #self.datos = None
        #return render.index(self.datos)

    def POST(self):
        x = web.input(myfile={})
        filedir = '/workspace/se-alesDeTransito/senales/static/'
        if 'myfile' in x:
            filepath=x.myfile.filename.replace('\\','/')
            filename=filepath.split('/')[-1]
            fout = open(filedir +'/'+ filename,'wb')
            fout.write(x.myfile.file.read())
            fout.close()
            np.set_printoptions(suppress=True)

            # Load the model

report_form = form.Form(
    form.Textbox('sender',
                 form.notnull,
                 description='Your name',
                 class_='form-control'),
    form.Textbox('subject',
                 form.notnull,
                 description='Subject',
                 class_='form-control'),
    form.Textarea('content',
                  form.notnull,
                  description='Your message',
                  class_='form-control'),
    form.File('attachment', description='Attach a file'),
)


class HomePage:
    def GET(self):
        f = report_form()
        return render.home(f)

    def POST(self):
        f = report_form()
        if f.validates():
            user_data = web.input(attachment={})
            rid = add_report(sender=user_data.sender,
                             subject=user_data.subject,
                             content=user_data.content,
Exemple #13
0
import web
from web import form

urls = ('/', 'index', '/view', 'view', '/upload', 'upload')

render = web.template.render('templates/', base='layout')

upload_form = form.Form(form.File("myfile"))


class index:
    def GET(self):
        return render.index()


class view:
    def GET(self):
        return render.view()


class upload:
    def GET(self):
        form = upload_form()
        return render.upload(form)

    def POST(self):
        x = web.input(myfile={})
        filedir = 'tmp'
        if 'myfile' in x:
            fname = x.myfile.filename.split('/')[-1]
            fout = open(filedir + '/' + fname, 'wb')