예제 #1
0
파일: handlers.py 프로젝트: ac001/x-hands
	def get(self):

	
		## t is a shortcut to tipfy config
		t = config.config['tipfy']
		
		context = {}

		## list of middleware
		context['middleware'] = t['middleware']
		
		
		## Installed Apps
		apps = []
		urls = []
		handlers = []
		for app_module in sorted(t['apps_installed']):
			try:
				# Load the urls module from the app and extend our rules.
				app_rules = import_string('%s.urls' % app_module)
				rules = app_rules.get_rules(app_rules)
				rlist = []
				for r in rules:
					rlist.append({'handler': r.handler, 'endpoint': r.endpoint, 'url': r.rule})
					urls.append(r.rule)
					handlers.append(r.handler)
				apps.append({'app': app_module, 'rules': rlist});
			except ImportError:
				pass
		context['apps'] = apps 
		context['urls'] = sorted(urls)
		context['handlers'] = sorted(handlers)

		## TODO move the template to unders here, and append path
		return render_response('tipfy_console.html', **context)
예제 #2
0
파일: handlers.py 프로젝트: ac001/x-hands
	def get(self):
		#context = { 'site': site, 'load_ext' = true}
		#context['page_title'] = "Profile"
		
		return render_response('pages/profile.html', 
								site=site, page_title="Profile", load_ext=True
		)
예제 #3
0
 def post(self):
     if self.request.form.get('jobid'):
         job = JobModel.get(self.request.form.get('jobid'))
         job.ChangedBy = self.auth_current_user
         job.Description = self.request.form.get('description')
         job.Nickname = self.request.form.get('nickname')
         add_history("job was updated", self.auth_current_user, job.key(), self.auth_current_user.assigned_to)
         job.put()  
     else: 
         job = JobModel()
         job.Approved = False
         job.Description = self.request.form.get('description')
         job.Nickname = self.request.form.get('nickname')
         job.ChangedBy = self.auth_current_user
         job.CreatedBy = self.auth_current_user
         job.Client = ClientModel.get(self.auth_current_user.assigned_to)
         job.OrderStage = OrderStatus.PendingQuote
         job.put()
         #.Created.strftime("%a, %b %d %Y - %I:%M%P")
         job.JobNumber = job.Created.strftime("%Y_%b_%d_")
         job.JobNumber += str(job.key().id())
         job.put()
         
         add_history("a request for a quote was started. ", self.auth_current_user, job.key(), self.auth_current_user.assigned_to)
     
     context = {'added': True, 'key' : str(job.key()) }
     if self.request.is_xhr:
         return render_json_response(context)
     else:
         return render_response('hello.html', **context)        
예제 #4
0
    def get(self, **kwargs):
        context = {
            }

        context = request_context(context)

        return render_response('info.html', **context)
예제 #5
0
    def post(self):
        if self.request.form.get('jobid'):
            job = JobModel.get(self.request.form.get('jobid'))
            job.ChangedBy = self.auth_current_user
            job.Description = self.request.form.get('description')
            job.Nickname = self.request.form.get('nickname')
            add_history("job was updated", self.auth_current_user, job.key(),
                        self.auth_current_user.assigned_to)
            job.put()
        else:
            job = JobModel()
            job.Approved = False
            job.Description = self.request.form.get('description')
            job.Nickname = self.request.form.get('nickname')
            job.ChangedBy = self.auth_current_user
            job.CreatedBy = self.auth_current_user
            job.Client = ClientModel.get(self.auth_current_user.assigned_to)
            job.OrderStage = OrderStatus.PendingQuote
            job.put()
            #.Created.strftime("%a, %b %d %Y - %I:%M%P")
            job.JobNumber = job.Created.strftime("%Y_%b_%d_")
            job.JobNumber += str(job.key().id())
            job.put()

            add_history("a request for a quote was started. ",
                        self.auth_current_user, job.key(),
                        self.auth_current_user.assigned_to)

        context = {'added': True, 'key': str(job.key())}
        if self.request.is_xhr:
            return render_json_response(context)
        else:
            return render_response('hello.html', **context)
예제 #6
0
    def get(self, **kwargs):
        context = {
            }

        context = request_context(context)

        return render_response('add_point_doc.html', **context)
예제 #7
0
    def get(self, **kwargs):

        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        clientid = kwargs['clientid']
        jobs = JobModel.all()
        jobs.filter("Client = ", ClientModel.get(clientid))
        jobs.filter("Invoiced != " , True)
        context = []
        if self.request.is_xhr:
            for job in jobs:
                os = None
                js = None
                if job.OrderStage and lstOrderStages[job.OrderStage]: 
                    os = lstOrderStages[job.OrderStage]
                if job.JobStage:
                    js = lstJobStages[job.JobStage]
                    
                context.append({
                                'name' : job.Nickname, 
                                'jobstage': js, 
                                'orderstage': os, 
                                'id' : str(job.key()), 
                                'created': job.Created.strftime("%b %d %Y"), 
                                'quote' : job.Quote 
                                });
            return render_json_response(context)
        else:
            return render_response('hello.html', **context)
예제 #8
0
파일: handlers.py 프로젝트: ac001/x-hands
	def get(self):
		context = { 'site': site}
		context['page_title'] = "Rpx Auth"

		## TODO set to current server
		context['token_url'] = "http://localhost:8080/auth/rpx/"
		
		return render_response('pages/rpxauth.html', **context)
예제 #9
0
    def get(self, **kwargs):
        context = {
            'form': self.form,
          }

        context = request_context(context)

        return render_response('index.html', **context)
예제 #10
0
 def get(self, tag=None, **kwargs):
     language = self.get_locale()
     if tag is None:
         products = Product.get_latest_products(10, language=language)
     else:
         products = Product.get_products_by_tag(tag, language=language)
     context = {'products': products, 'tag': tag}
     return render_response('feed/product.xml', **context)
예제 #11
0
    def get(self, **kwargs):
        context = {
            'all_news': News.all().order('-date'),
            }

        context = request_context(context)

        return render_response('news.html', **context)
예제 #12
0
    def _on_auth(self, user=None):
        
        logging.info('User == '+str(user))
        
        logging.debug('OnAuth: Beginning.')
            
        session = self.request.args.get('session', False)
        
        logging.debug('OnAuth: Session = '+str(session))
        
        if session is False:
            abort(403)
        
        else:
            session_obj = json.loads(session)
            
            logging.debug('OnAuth: Decoded session object follows...')
            logging.debug('OnAuth: '+str(session_obj))
            
            u = memcache.get(str(session_obj['session_key']))

            if u is None:
                u = FacebookUser.get_by_key_name(str(session_obj['uid']))
                logging.debug('OnAuth: u 1st round = '+str(u))

            if u is None:
                u = FacebookUser(key_name=str(session_obj['uid']), uid=str(session_obj['uid'])).put()
                logging.debug('OnAuth: u 2nd round = '+str(u))
                
                
            logging.debug('OnAuth: u 3rd round = '+str(u))
            
            logging.debug('OnAuth: UID = '+str(session_obj['uid']))
            logging.debug('OnAuth: KEY = '+str(session_obj['session_key']))
                
            memcache.set(str(session_obj['uid']), u, time=3600)
            
            success_get = self.request.args.get('pledgeSuccess', False)
            
            if isinstance(u, db.Key):
                u_key_val = str(u)
            elif isinstance(u, db.Model):
                u_key_val = str(u.key())
            
            
            page_content_vars = {
            
                #'invites_form':EmailInvites(self.request),
                'pledge_form':PledgeLanding(self.request),                
                'fb_app_id':config.config['tipfy.ext.auth.facebook']['api_key'],
                'u_key':u_key_val,
                'pledgeSuccess':success_get,
                'debug':True,
                'dev':{'getvars':self.request.args.items(multi=True),'postvars':self.request.form.items(multi=True)}
            
            }
            
            return render_response('microsite.html', **page_content_vars)
예제 #13
0
파일: ib.py 프로젝트: a37912/gaeaib
 def get(self):
   return render_response(
       "boardlist.html", 
       boards =  get_config("aib", "boardlist"),
       allboards = map(
         boardlink,
         models.BoardCounter.all().fetch(self.BOARDLIM)
       ),
   )
예제 #14
0
	def get(self, page=None):
		
		c  = Context()
		if page == None:
			c.page = "/home"
		else:
			c.page = "/%s" % page
			
		return render_response('circle/%s.html' % c.page,  site=site, c=c)
예제 #15
0
 def get(self):
     tunes = models.Tune.all().order('tune_id')
     latest_revision = models.ScoreRevision.latest_revision()
     if latest_revision:
         q = latest_revision.query_score_records()
         scores = q.order('title').fetch(models.Tune.LIMIT*len(models.LEVEL_KINDS))
     else:
         scores = []
     return render_response('main.jinja', tunes=tunes, scores=scores)
예제 #16
0
파일: handlers.py 프로젝트: ac001/x-hands
    def get(self):
        context = {"site": site}
        context["page_title"] = "PAGE TITLE"
        context["page_title"] = "PAGE TITLE"
        context["page_title"] = "PAGE TITLE"
        context["page_title"] = "PAGE TITLE"
        context["page_title"] = "PAGE TITLE"

        # return render_response('main_container.html', **context)
        return render_response("pages/index.html", **context)
예제 #17
0
 def get(self, tag=None, **kwargs):
     language = self.get_locale()
     if tag is None:
         products = Product.get_latest_products(10, language=language)
     else:
         products = Product.get_products_by_tag(tag, language=language)
     context = {
         'products': products,
         'tag': tag
     }
     return render_response('feed/product.xml', **context)
예제 #18
0
 def get(self):
     # get current game, be that the one in progress or the most recently created one
     game = Game.all().filter('is_on', True).get()
     if game is None:
         game = Game.all().order('-game_id').get()
     if game is None:
         game = Game(game_id=1, is_on=False)
         game.put()
     
     # get the profiles registered in the current game
     profiles = Profile.all().filter('game',game)
     return render_response('list_profiles.html', profiles = profiles, game_is_on=game.is_on, form=self.form, flash = self.get_flash())
예제 #19
0
 def get(self):
     # TODO: move it to config
     credentials = foursquare.OAuthCredentials(
         "I2Z50NWD45L0XCZNARRS3A15TTKCKSI0WWR2A3HCYHZDIE44", "Z2PBQ40CDNBVRNNSM4JK5ZVPK0IWWEVJKTBMWOGM3PIXOA4Y"
     )
     fs = foursquare.Foursquare(credentials)
     # TODO: don't hardcode server
     app_token = fs.request_token(oauth_callback="http://localhost:8080/foursquare-login-success-callback")
     auth_url = fs.authorize(app_token)
     self.session["fs"] = fs
     self.session["app_token"] = app_token
     return render_response("foursquare_login.html", message=auth_url)
예제 #20
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
예제 #21
0
  def get(self, start_from=None):
    titles = models.Title.all()
    titles.filter("show", True)
    if start_from:
      key = db.Key.from_path("Title", start_from)
      titles.filter("__key__ >", key)

    return render_response(
        "welcome.html",
        boards = [ ("a", "Animu") ],
        titles = titles.fetch(self.MAX_T),
    )
예제 #22
0
파일: review.py 프로젝트: aristidb/cppbash
 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)
예제 #23
0
    def get(self, **kwargs):

        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        logging.log(logging.INFO, "searching for " + kwargs['term'])
        clients = db.GqlQuery("SELECT FROM ClientModel WHERE Name >= :1 AND Name < :2", kwargs['term'], u"%s" % kwargs['term'] + u"\ufffd")
        context = []
        if self.request.is_xhr:
            for client in clients:
                context.append({'value' : client.Name, 'id' : str(client.key()) });
            return render_json_response(context)
        else:
            return render_response('hello.html', **context)            
예제 #24
0
    def get(self):
        # TODO: move it to a decorator
        if self.session["fs"] is None:
            return self.redirect("/foursquare-login")
        fs = self.session["fs"]

        # NOTE: Do we always have the right fs in session?
        history = foursquare.all_history(fs)
        venues = {}
        for checkin in history:
            if checkin["venue"]["id"] in venues:
                continue
            venues[checkin["venue"]["id"]] = {"name": checkin["venue"]["name"]}

        return render_response("venue_list.html", venues=venues)
예제 #25
0
파일: submit.py 프로젝트: aristidb/cppbash
 def post(self, **kwargs):
     p = request.form
     q = models.Quote(
         quote = p['quote'],
         language = p['language'],
         programming_language = p['programming_language'],
         accepted = False)
     if p['email']:
         q.submitter_email = db.Email(p['email'])
     q.submitter_ip = os.environ['REMOTE_ADDR']
     q.creation_date = datetime.datetime.now()
     q.random = random.random()
     # todo: validate
     q.put()
     return render_response('cppbash/submit_quote.html', quote = q )
예제 #26
0
    def get(self):
        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))

        clients = ClientModel.all().order("Name")
        context = []
        if self.request.is_xhr:
            for client in clients:
                users_query = db.Query(User).filter("assigned_to", str(client.key()))
                logging.log(logging.INFO, "users: " + str(users_query.count()))
                u = []
                if users_query.count() > 0: 
                    for user in users_query:
                        u.append({'Username' : user.username, 'Email' : user.email, 'Key': str(user.key())})
                context.append({'Name' : client.Name, 'Key' : str(client.key()), 'Address': client.Address, 'Email' : client.Email, 'PhoneNumber': client.PhoneNumber, 'Users' : u});
            return render_json_response(context)
        else:
            return render_response('hello.html', **context)
예제 #27
0
  def get(self, title):

    r = models.Rename.get_by_key_name(title)

    if r and r.name != title:
      return redirect_to("title",title=r.name)

    title_db = renamed(title)

    if not title_db:
      raise NotFound

    eps = models.Ep.all()
    eps.order("date_modify")
    eps.ancestor(title_db)

    return render_response(
        "title.html",
        title = title_db,
        eps = eps,
    )
예제 #28
0
 def get(self, **kwargs):
     return render_response("hello.html", message="Hello, Jinja!")
예제 #29
0
파일: quote.py 프로젝트: aristidb/cppbash
 def get(self, **kwargs):
     q = get_by_id_or_404(models.Quote, kwargs['id'])
     return render_response('cppbash/quote.html', quote = q)
예제 #30
0
파일: ib.py 프로젝트: a37912/gaeaib
 def get(self, tpl):
   return render_response(tpl, boards =  get_config("aib", "boardlist"))
예제 #31
0
파일: handlers.py 프로젝트: ac001/x-hands
	def get(self):
		context = { 'site': site}
		context['page_title'] = "Classifieds"
		
		return render_response('pages/classifieds.html', **context)
예제 #32
0
파일: handlers.py 프로젝트: daffodil/nl
	def get(self):
		context = {'title': 'Accounts', 'tab': '/accounts'}
		return render_response('accounts.html', c=context, g=appGlobal)
예제 #33
0
 def get(self):
     """Simply returns a rendered template with an enigmatic salutation."""
     return render_response('hello_world.html', message='Hello, World!')
예제 #34
0
 def get(self, **kwargs):
     return render_response('hello.html', message='Hello, Jinja!')