def get(self): user = users.get_current_user() if not user: # need to sign in self.redirect(users.create_login_url(self.request.uri)) return producer = bene_util.sanitize(self.request.get('producer')) consumer = bene_util.sanitize(self.request.get('consumer')) u = bene_query.getCurrentUser() if not u: # no user exists if producer and not consumer: # make person a producer only in most restricted case u = entities.User(email=bene_util.getEmail(user), owner=user, isConsumer=False, isProducer=True) u.put() self.redirect('/createproducer') return else: # all other cases, make consumer u = entities.User(email=bene_util.getEmail(user), owner=user, isConsumer=True, isProducer=False) u.put() self.redirect('/createconsumer') return if producer and not consumer: # signed in producer if u.isConsumer: # if previously signed in as consumer u.isConsumer = False u.isProducer = True u.put() if bene_query.getCurrentProducer( ) == None: # no producer page, so create one self.redirect('/createproducer') return else: # already has producer page, so redirect self.redirect('/producerhome') return else: # signed in consumer if u.isProducer: # if previously signed in as producer u.isConsumer = True u.isProducer = False u.put() if bene_query.getCurrentConsumer( ) == None: # no consumer page, so create on self.redirect('/createconsumer') return else: # already has consumer page, so redirect self.redirect('/consumerhome') return
def post(self): user = users.get_current_user() if not user: # need to sign in self.redirect('/?signin=True') return if bene_query.getCurrentUser().isProducer: # producers can't do this self.redirect('/') return if bene_query.getCurrentConsumer() != None: # already exists self.redirect('/') return # no consumer, so add to store _name = bene_util.sanitize(self.request.get('name')) _picture = bene_util.sanitize(self.request.get('picturedata')) _profile = self.request.get('profile') _email_public = self.request.get('email') c = entities.Consumer(name=_name, has_unread=0, email=bene_util.getEmail(user), email_public=_email_public, owner=user, profile=_profile, verified=False) c.addPicture(_picture) c.put() self.redirect('/consumerhome?%s' % urllib.urlencode({'firsttime': True})) return
def post(self): user = users.get_current_user() if not user: # need to sign in self.redirect('/?signin=True') return if bene_query.getCurrentUser().isProducer: # producers can't do this self.redirect('/') return if bene_query.getCurrentConsumer() != None: # already exists self.redirect('/') return # no consumer, so add to store _name = self.request.get('name') _picture = self.request.get('picture') _profile = self.request.get('profile') c = entities.Consumer(name=_name, email=bene_util.getEmail(user), owner=user, profile=_profile, verified=False) c.addPicture(_picture) c.put() self.redirect('/') return
def post(self): user = users.get_current_user() if not user: # need to sign in self.redirect('/?signin=True') return if bene_query.getCurrentUser( ).isConsumer: # consumers can't access this self.redirect('/') return _producer = bene_query.getCurrentProducer() if _producer != None: # already has a producer page self.redirect('/') return _name = bene_util.sanitize(self.request.get('name')) _picture = self.request.get('picturedata') _description = bene_util.sanitize(self.request.get('description')) _email_public = self.request.get('email') p = entities.Producer(name=_name, email=bene_util.getEmail(user), email_public=_email_public, owner=user, description=_description, verified=False) p.addPicture(_picture) p.put() self.redirect('/producerhome?%s' % urllib.urlencode({'verifyone': True})) return
def post(self): user = users.get_current_user() if not user: # need to sign in self.redirect('/?signin=True') return if bene_query.getCurrentUser().isConsumer: # consumers can't access this self.redirect('/') return _producer = bene_query.getCurrentProducer() if _producer != None: # already has a producer page self.redirect('/') return _name = self.request.get('name') _picture = self.request.get('picture') _description = self.request.get('description') p = entities.Producer(name = _name, email=bene_util.getEmail(user), owner=user, description=_description, verified=False) p.addPicture(_picture) p.put() self.redirect('/') return
def get(self): user = users.get_current_user() if not user: # need to sign in self.redirect('/?signin=True') return if bene_query.getCurrentUser().isProducer: # producers can't do this self.redirect('/') return if bene_query.getCurrentConsumer() != None: # has consumer page self.redirect('/') return template_values = bene_util.initTemplate(self.request.uri) template_values['email_public_old'] = bene_util.getEmail(user) path = os.path.join(os.path.dirname(__file__), 'createconsumer.html') self.response.out.write(template.render(path, template_values)) return