예제 #1
0
 def get(self, page=None):
     self.error(404)
     path = os.path.join(os.path.dirname(__file__), '..', 
                                                    'views', 
                                                    'index.html')
     template_vars = {'short_status': config.get('404', 'short'),
                      'long_status': config.get('404', 'long'),
                      'page': str(urllib.unquote_plus(page))}
     self.response.out.write(template.render(path, template_vars))
예제 #2
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__), '..', 
                                                    'views', 
                                                    'index.html')
     template_vars = {'short_status': config.get('200', 'short'),
                      'long_status': config.get('200', 'long')}
     self.response.out.write(template.render(path, template_vars))
     visit = Visit(self.request)
     visit.put()
     jabber(self.request, config.get('action', 'visiting'))
예제 #3
0
 def post(self):
     try:
         cv = Cv(pdf=db.Blob(self.request.get('file')))
         md5 = hashlib.md5(cv.pdf)
         cv.rfc2822_date = cv.created_at.strftime('%a, %d %b %Y %H:%M:%S'\
                                                  '+0100')
         cv.e_tag = md5.hexdigest()
         cv.md5_sum = base64.encodestring(md5.digest()).rstrip()
         cv.put()
         self.redirect('/%s' % config.get('upload', 'ok'))
     except Exception, err:
         logging.error(err)
         self.redirect('/%s' % config.get('upload', 'fail'))
예제 #4
0
 def get(self):
     cv = Cv.all().order('-created_at').get()
     
     self.response.headers['ETag'] = cv.e_tag
     self.response.headers['Last-Modified'] = cv.rfc2822_date
     self.response.headers['Content-MD5'] = cv.md5_sum
     self.response.headers['Content-Type'] = config.get('content', 'type')
     self.response.headers['Content-Disposition'] = '%s;filename=%s' % (
                                       config.get('content', 'disposition'),
                                       config.get('content', 'filename'))
     self.response.out.write(cv.pdf)
     visit = Visit(self.request)
     visit.put()
     jabber(self.request, config.get('action', 'download_cv'))