Example #1
0
    def post(self, **kwargs):

        # 'file' is the name of the file upload field in the form.
        upload_files = self.get_uploads('file')
        blob_info = upload_files[0]

        if not self.auth_current_user:
            blob_info.delete()
            redirect_to('/timestamper/upload')
            return

        file_info = FileInfo(blob=blob_info.key())
        file_info.created_by=self.auth_current_user.username
        file_info.updated_by_by=self.auth_current_user.username
        file_info.put()



        response = redirect_to('timestamper/info', file_id=(file_info.key().id()))
        # Clear the response body.
        response.data = ''
        return response

        # Clear the response body.
        response.data = ''
        return response
Example #2
0
 def post(self, **kwargs):
     userid = self.request.form.get('userid')
     user = User.get(userid)
     user.disabled = not user.disabled
     user.put()
     self.set_message('success', 'The users account was successfully changed. ', flash=True, life=5)
     return redirect_to('home')
Example #3
0
    def post(self, **kwargs):
        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        ids = self.request.form.get('jobids').split(',')
        logging.log(logging.INFO, " ids: %s" % self.request.form.get('jobids') )
        if len(ids) > 0:
            invoice = InvoiceModel()
            invoice.CreatedBy = self.auth_current_user
            upload_files = self.get_uploads('invoice')
            blob_info = upload_files[0]
            invoice.File = str(blob_info.key())
            logging.log(logging.INFO, "set uploaded file as %s" % blob_info.key())

            invoice.Client = ClientModel.get(self.request.form.get('clientid'))
            invoice.put()
        
            for id in self.request.form.get('jobids').split(','):
                job = JobModel.get(id)
                job.Invoiced = True
                job.Invoice = invoice
                job.OrderStage = OrderStatus.Invoiced
                job.put()
            
        self.set_message('success', 'Successfully created invoice. ', flash=True, life=5)
        response = redirect_to('admin-invoices')
        # Clear the response body.
        response.data = ''
        return response
Example #4
0
    def post(self):
        srfile = self.request.files.get('score_record_file')
        if srfile:
            records = simplejson.load(srfile)
            models.ScoreRevision.regist_new_revision(records)

            return redirect_to('main')
Example #5
0
    def post(self, **kwargs):
        self.form = PasteForm(request.form)

        if self.form.validate():
            if self.current_user:
                user_key = str(self.current_user.key())
            else:
                user_key = None

            language_code = request.form.get('language')
            code_raw = request.form.get('code', u'')
            code = highlight(code_raw, language_code)

            values = {
                'area_key': str(self.area.key()),
                'user_key': user_key,
                'code_raw': code_raw,
                'code':     code,
                'language': language_code,
            }
            paste = Paste(**values)
            paste.put()
            self.set_message('success', _('The paste was saved.'), flash=True)

            return redirect_to('paste/view', paste_id=paste.id,
                area_name=self.area.name)
        else:
            self.set_form_error(_('Ooops, code is empty! Please post '
                'some lines.'))
            return self.get()
Example #6
0
 def post(self, **kwargs):
     u = users.get_current_user()
     r = models.Reviewer.all(keys_only = True).filter('user ='******'review-start')
     q = get_by_id_or_404(models.Quote, kwargs['id'])
     if request.form.get('accept', ''):
         q.quote = request.form['quote']
         q.language = request.form['language']
         q.programming_language = request.form['programming_language']
         q.accepted = True
         q.accepted_by = r
         q.accepted_date = datetime.datetime.now()
         q.put()
     else:
         q.delete()
     return redirect_to('review-start')
Example #7
0
 def get(self, **kwargs):
     pages = Page.all()
     for page in pages:
         page.loginRequired=False
         page.put()
     response = redirect_to('admin')
     response.data = ''
     return response
Example #8
0
 def post(self, **kwargs):
   """Create"""
   image = request.files.get('image')
   if image:
     try:
       image = db.Blob(images.resize(image.read(), 64,64))
     except BadImageError, NotImageError:
       self.set_flash({'error' : "Error Processing Image"})
       return redirect_to('buildable/create')
Example #9
0
    def post(self, key):

        form = get_entry_form(self.request)
        
        if form.validate():

            list_p = db.Key(key)

            l = ListMember(list_p, key_name=str(form.phone_number.data), list_parent=list_p, firstname=str(form.firstname.data), lastname=str(form.lastname.data), phone_number=str(form.phone_number.data)).put()
            
            if form.add_another.data == True:
                return redirect_to('list-add', key=str(list_p), flash='Member added successfully.', addMore='true')
            else:            
                
                return redirect_to('list-view', key=str(list_p), flash='Member added successfully.')
            
        else:
            return Response('<b>Form could not be validated. :(</b>')        
Example #10
0
 def post(self, **kwargs):
   """Create"""
   raceName = request.form['name']
   letter = raceName[0]
   try:
     image = images.resize(request.files['image'].read(), 32,32)
   except BadImageError, NotImageError:
     #TODO: Should give another shot to correct...
     # Set Cookie with info, and flash message
     return redirect_to('race/index')
Example #11
0
 def post(self, **kwargs):
   race = db.get(kwargs['id'])
   race.name = request.form['name']
   race.letter = race.name[0]
   if request.files['image']:
     try:
       race.image = db.Blob(images.resize(request.files['image'].read(), 32,32))
     except BadImageError, NotImageError:
       #TODO: Throw Flash Message
       return redirect_to('race/index')
Example #12
0
 def post(self):
     desc = self.request.form.get('desc')
     prize = self.request.form.get('prize')
     duration = self.request.form.get('duration')
     p = Poof.all().filter('username = '******'content/index')
         p.description=desc
         p.prize_money = float(prize)
         p.duration_time = int(duration)
         today = date.today()
         p.end_date = datetime.date(today.year,today.month,today.day + int(duration))
         p.is_active = False
         p.confirmed_details = True
         p.put()
         return redirect_to('content/index')
     else:
         return self.render_response('content.html', section='content', message='Please upload an image before submitting')
Example #13
0
 def get(self, year=None, month=None, day=None, slug=None):
     language = self.get_locale()
     post = BlogPost.get_post_by_slug(slug, language=language)
     if post is not None:
         context = {
             'post': post,
             'language': language,
         }
         return self.render_response('blog/show.html', **context)
     else:
         return redirect_to('notfound')
Example #14
0
 def post(self):
     # 'file' is the name of the file upload field in the form.
     upload_files = self.get_uploads('file')
     blob_info = upload_files[0]
     i_url=images.get_serving_url(str(blob_info.key()))
     p = Poof(key_name =self.auth_current_user.username , username = self.auth_current_user.username, picture = blob_info.key(), image_url = i_url)
     p.put()
     response = redirect_to('content/index')
     # Clear the response body
     response.data = ''
     return response
Example #15
0
    def post(self, username):
        points_awarded = int(self.request.form.get('points'))
        poof = Poof.all().filter('username = '******'s profile
        winner_profile = Profile.all().filter('username ='******'s PoofHistory
        poofhistory = PoofHistory()
        poofhistory.username = poof.username
        poofhistory.poofer_username = j.poofer_username
        poofhistory.before_picture = poof.picture
        poofhistory.before_image_url = poof.image_url
        poofhistory.after_picture = winner_job.picture
        poofhistory.after_image_url = winner_job.poofed_image_url
        poofhistory.money_awarded = poof.prize_money
        poofhistory.points_awarded = points_awarded
        poofhistory.completed_datetime = datetime.datetime.today()
        poofhistory.put()

        #Create losers' PoofHistory
        for job in loser_jobs:
            ph = PoofHistory()
            ph.username = poof.username
            ph.poofer_username = job.poofer_username
            ph.before_picture = poof.picture
            ph.before_image_url = poof.image_url
            ph.after_picture = job.picture
            ph.after_image_url = job.poofed_image_url
            ph.money_awarded = None
            ph.points_awarded = None
            ph.completed_datetime = datetime.datetime.today()
            ph.put()

        #Delete poof and related jobs
        db.delete(winner_job)
        db.delete(loser_jobs)
        db.delete(poof)

        return redirect_to('content/index')
Example #16
0
 def post(self):
     # 'file' is the name of the file upload field in the form.
     upload_files = self.get_uploads('file')
     blob_info = upload_files[0]
     f = MyFile(name=blob_info.filename, blob_key=blob_info.key(), owner='*****@*****.**')
     f.put()
     # response = redirect_to('blobstore/serve', resource=blob_info.key())
     response = redirect_to('home')
     # Clear the response body.
     response.data = ''
     return response
Example #17
0
 def post(self):
     # 'file' is the name of the file upload field in the form.
     jobid = self.request.form.get('jobid')
     upload_files = self.get_uploads('file')
     blob_info = upload_files[0]
     job = JobModel.get(jobid)
     job.Artifacts.append(blob_info.key())
     job.put()
     response = redirect_to('preview', resource=blob_info.key(), jobid=jobid)
     # Clear the response body.
     response.data = ''
     return response
Example #18
0
 def get(self, slug=None, **kwargs):
     language = self.get_locale()
     product = Product.get_product_by_slug(slug, language=language)
     if product is not None:
         context = {
             'product': product,
             'language': language,
             'format_currency': i18n.format_currency,
         }
         return self.render_response('shop/show.html', **context)
     else:
         return redirect_to('notfound')
Example #19
0
 def get(self, tag=None):
     language = self.get_locale()
     posts = BlogPost.get_posts_by_tag(tag, language=language)
     context = {
         'posts': posts,
         'tag': tag,
         'language': language,
     }
     if len(posts) > 0:
         return self.render_response('blog/archive.html', **context)
     else:
         return redirect_to('notfound')
Example #20
0
 def get(self, **kwargs):
     u = users.get_current_user()
     if models.Reviewer.all(keys_only = True).filter('user ='******'review-start')))
     q = models.Quote.all().filter('accepted =', False).order('creation_date')
     if q.count(1) == 0:
         return redirect_to('home')
     return render_response('cppbash/review.html', quotes = q)
Example #21
0
 def post(self, **kwargs):
 	account = self.request.form.get('account')
 	#query = MyFile.gql("WHERE owner= :1", account)
 	#f = query.get()
     query = MyFile.all()
     query.filter('owner =', account).order('-timestamp')   
     f = query.get() 	
     if f == None:
 		return render_response('hello_world.html', message='None') 
 	response = redirect_to('cashblob/serve', resource=str(f.blob_key.key()))
 	response.data = ''
     return response
Example #22
0
 def get(self, slug=None, **kwargs):
     language = self.get_locale()
     product = Product.get_product_by_slug(slug, language=language)
     if product is not None:
         context = {
             'product': product,
             'language': language,
             'format_currency': i18n.format_currency,
         }
         return self.render_response('shop/show.html', **context)
     else:
         return redirect_to('notfound')
Example #23
0
 def get(self, gid):
     game = Game.all().filter('game_id', gid).get()
     if game is None:
         return Response('No game with that id was found')
     else:
         for profile in Profile.all().filter('game',game):
             response = push(profile, 1)
             if response.status_code != 200:
                 self.set_flash('Unable to push to player named "' + profile.name + '". Response from push server: '+response.status_code+': '+response.content)
         self.set_flash('Game was ended!')
         game.is_on = False
         game.put()
         return redirect_to('admin-game', gid = game.game_id)
Example #24
0
 def get(self, year=None, month=None, day=None):
     language = self.get_locale()
     posts = BlogPost.get_posts_by_date(year, month, day, language=language)
     
     if year is None:
         posts = group_by_date(posts)
     if posts is not None:
         context = {
             'posts': posts,
             'language': language,
         }
         return self.render_response('blog/archive.html', **context)
     else:
         return redirect_to('notfound')
Example #25
0
  def post(self, **kwargs):
    """Create"""
    newVersion = GameVersion()
    newVersion.version_number = request.form['versionNumber']
    newVersion.is_current = request.form.get('isCurrent', "No") == "Yes"

    if newVersion.is_current:
      current = GameVersion.getCurrent()
      if(current):
        current.is_current = False
        current.put()

    newVersion.put()
    return redirect_to('version/index')
Example #26
0
 def post(self):
     # 'file' is the name of the file upload field in the form.
     jobid = self.request.form.get('jobid')
     upload_files = self.get_uploads('file')
     blob_info = upload_files[0]
     job = JobModel.get(jobid)
     job.Artifacts.append(blob_info.key())
     job.put()
     response = redirect_to('preview',
                            resource=blob_info.key(),
                            jobid=jobid)
     # Clear the response body.
     response.data = ''
     return response
Example #27
0
  def post(self, **kwargs):
    version = db.get(kwargs['id'])
    
    version.version_number = request.form.get('version_number')
    version.is_current = request.form.get('is_current', False, type=bool)

    if(version.is_current):
      current = GameVersion.getCurrent()
      if current and str(current.key()) is not str(version.key()) :
        current.is_current = False
        current.put()

    version.put()

    return redirect_to('version/index')
Example #28
0
  def post(self, **kwargs):
    """Update"""
    unit               = get_by_id_or_404(Buildable, kwargs['id'])
    unit.name          = request.form.get('name')
    unit.race          = db.get(request.form.get('race'))
    unit.game_versions = [db.Key(val) for val in request.form.getlist('versions')]
    unit.description   = request.form.get('description', "")

    image = request.files.get('image')
    if image:
      try:
        unit.image = db.Blob(images.resize(image.read(), 64,64))
      except BadImageError, NotImageError:
        self.set_flash({'error' : "Error Processing Image"})
        return redirect_to('buildable/create')
Example #29
0
 def post(self, **kwargs):
     
     if self.form.validate():
         title = self.form.title.data
         file_data = self.form.file_data.data
         
         uploaded_files = self.get_uploads('file_data')
         blob_info = uploaded_files[0]
         logging.warn(blob_info)
         new_file = File(title=title, file_data=blob_info.key())
         # checking the file
         response = redirect_to('admin/files/index')
         if new_file.put():
             response.data = ''
             return response
         
     return self.get(**kwargs)
Example #30
0
    def post(self, **kwargs):

        if self.form.validate():
            title = self.form.title.data
            file_data = self.form.file_data.data

            uploaded_files = self.get_uploads('file_data')
            blob_info = uploaded_files[0]

            new_file = File(title=title, file_data=blob_info.key())
            # checking the file
            response = redirect_to('admin/files/index')
            if new_file.put():
                response.data = ''
                return response

        return self.get(**kwargs)
Example #31
0
    def post(self, list_p, entry):

        entry = db.get(db.Key(entry))
        list_p = db.get(db.Key(list_p))
        form = get_entry_form(self.request)
        
        if form.validate():
            
            if entry.phone_number != form.phone_number.data:
                db.delete(entry)
                entry = ListMember(list_p, key_name=form.phone_number.data, phone_number=form.phone_number.data)
                
            entry.firstname = form.firstname.data
            entry.lastname = form.lastname.data
            
            entry.put()
            
            return redirect_to('list-view', key=str(list_p.key()), flash='Member successfully saved.')
Example #32
0
    def post(self, **kwargs):
        if not self.form.validate():
            # Since the form didn't validate, render it again using self.get().
            return self.get(**kwargs)

        author = self.auth_current_user
        if author != None:
            author = author.username

        # Form is valid. Use the form data and redirect the user to the
        # final destination.
        name = self.form.name.data
        assignee = self.form.assignee.data
        description = self.form.description.data
        task = Task(name=name, assignee=assignee, description=description, created_by=author, updated_by=author, author=author)

        task.put()
        memcache.delete('tasks')

        return redirect_to('tasks-index')
Example #33
0
    def get(self, **kwargs):
        job = JobModel.get(kwargs['jobid']) 

        blobstore.delete(job.Artifacts)
        job.Artifacts = []
        
        history = JobHistoryModel.all()
        history.filter("Job = ", job)
        for item in history:
            logging.log(logging.INFO, "deleted %s" % item.key())
            item.delete()
        
        communication = CommunicationModel.all()
        communication.filter("Job = ", job)
        for item in communication: 
            logging.log(logging.INFO, "deleted %s" % item.key())
            item.delete()

        job.delete()
        self.set_message('success', 'The job, files, and all related information were successfully cleared.', flash=True, life=5)
        return redirect_to('home')
Example #34
0
 def get(self, **kwargs):
     # empty the cart!
     self.reset_cart()
     return redirect_to('pages/welcome')
Example #35
0
 def get(self, verification_code):
     verified = Profile.verify_code(verification_code)
     logging.info(verified)
     if verified:
         return redirect_to('user/profile')