def chk_login(self, redirect_url='/'): self.login_user = users.get_current_user() self.is_login = (self.login_user != None) if self.is_login: # added register code here CurrentUser = self.get_user_db() if CurrentUser == None: # Create a User CurrentUser = tarsusaUser(user=users.get_current_user(), urlname=cgi.escape(users.get_current_user().nickname())) CurrentUser.put() ## Added userid property. CurrentUser.userid = CurrentUser.key().id() CurrentUser.dispname = users.get_current_user().nickname() CurrentUser.put() else: ## DB Model Patch ## These code for registered user whose information are not fitted into the new model setting. #Run DB Model Patch when User Logged in. #DBPatcher.chk_dbmodel_update(CurrentUser) #Run this at every ViewItem event ## Added userid here. if CurrentUser.userid == None: CurrentUser.userid = CurrentUser.key().id() CurrentUser.put() return True else: #self.redirect(redirect_url) return False
def setUp(self): # Populate test entities. entity = tarsusaUser(name='Bar') self.setup_key = entity.put() NewtarsusaItem = tarsusaItem(name="Item", done=False, routine="none", usermodel=entity) NewtarsusaItem.put()
def setUp(self): # Populate test entities. entity = modules.tarsusaUser(name='Bar') self.setup_key = entity.put() NewtarsusaItem = modules.tarsusaItem(name="Item", done=False, routine="none", usermodel=entity) NewtarsusaItem.put() NewtarsusaItem2 = modules.tarsusaItem(name="Item", done=False, routine="none", usermodel=entity) NewtarsusaItem2.put() logging.info("user:"******"Item:" + str(NewtarsusaItem.key().id())) logging.info("Item2:" + str(NewtarsusaItem2.key().id()))
def initialize(self, request, response): webapp.RequestHandler.initialize(self, request, response) self.login_user = users.get_current_user() self.is_login = (self.login_user != None) if self.is_login: self.user = tarsusaUser.all().filter( 'user = '******'referer'] except: self.referer = None
def chk_login(self, redirect_url='/'): self.login_user = users.get_current_user() self.is_login = (self.login_user != None) if self.is_login: # added register code here CurrentUser = self.get_user_db() if CurrentUser == None: # Create a User CurrentUser = tarsusaUser( user=users.get_current_user(), urlname=cgi.escape(users.get_current_user().nickname())) CurrentUser.put() ## Added userid property. CurrentUser.userid = CurrentUser.key().id() CurrentUser.dispname = users.get_current_user().nickname() CurrentUser.put() else: ## DB Model Patch ## These code for registered user whose information are not fitted into the new model setting. #Run DB Model Patch when User Logged in. #DBPatcher.chk_dbmodel_update(CurrentUser) #Run this at every ViewItem event ## Added userid here. if CurrentUser.userid == None: CurrentUser.userid = CurrentUser.key().id() CurrentUser.put() return True else: #self.redirect(redirect_url) return False
def initialize(self, request, response): webapp.RequestHandler.initialize(self, request, response) self.login_user = users.get_current_user() self.is_login = (self.login_user != None) if self.is_login: self.user = tarsusaUser.all().filter('user = '******'referer'] except: self.referer = None