예제 #1
0
    def POST(self):
        """
        Store uploaded file.
        """
        try:
            i = web.input(file={}, name='No Name')
        except ValueError:
            return render.error(message='Sorry, only files up to %d'
                                ' megabytes are accepted.' % MAX_UPLOAD_SIZE)

        # Check if we have everything we need
        if not 'file' in i or i.file == None or not i.file.file or not i.name:
            return render.error(message='No name and/or file provided.')

        # Store the file under a temporary path
        fd, filename = tempfile.mkstemp(suffix='.vcf', prefix='upload-')
        handle = os.fdopen(fd, 'w')
        handle.write(i.file.file.read())
        handle.close()
        web.seeother('/thanks?%s' % urlencode({'file': filename,
                                               'name': i.name}))
예제 #2
0
    def POST(self):
        """
        Store uploaded file.
        """
        try:
            i = web.input(file={}, name='No Name')
        except ValueError:
            return render.error(message='Sorry, only files up to %d'
                                ' megabytes are accepted.' % MAX_UPLOAD_SIZE)

        # Check if we have everything we need
        if not 'file' in i or i.file == None or not i.file.file or not i.name:
            return render.error(message='No name and/or file provided.')

        # Store the file under a temporary path
        fd, filename = tempfile.mkstemp(suffix='.vcf', prefix='upload-')
        handle = os.fdopen(fd, 'w')
        handle.write(i.file.file.read())
        handle.close()
        web.seeother('/thanks?%s' % urlencode({
            'file': filename,
            'name': i.name
        }))
예제 #3
0
파일: utils.py 프로젝트: Nitecon/webframe
def url_encode(url):
    return http.urlencode(url)
예제 #4
0
파일: public.py 프로젝트: gcobos/rft
 def GET(self, path): 
     fragments = ''
     if web.input():
         fragments = '?' + http.urlencode(web.input())
     return web.seeother('/' + path + '/' + fragments)
예제 #5
0
def url_encode(url):
    return http.urlencode(url)
예제 #6
0
 def GET(self, path):
     fragments = ''
     if web.input():
         fragments = '?' + http.urlencode(web.input())
     return web.seeother('/' + path + '/' + fragments)