def post(self): user = users.get_current_user() if not user or 'user_id' not in dir(user): self.redirect(users.create_login_url('/addbuffr')) apiAddress = self.request.get('apiAddress') to_console = {} to_console["apiAddress"] = apiAddress to_console["is_valid_url(apiAddress)"] = (is_valid_url(apiAddress) != None) buffr_instance = Buffr() buffr_instance.apiName = self.request.get('apiName') buffr_instance.apiAddress = apiAddress APIUnstable = self.request.get('APIUnstable') if APIUnstable not in [True, False]: buffr_instance.APIUnstable = False else: buffr_instance.APIUnstable = APIUnstable buffr_instance.user_id = user.user_id() buffr_instance.user_email = user.email() buffr_instance.update_interval = int(self.request.get('updateInterval')) for possibility in user_readable_convertion_table: logging.info(str((possibility[0], buffr_instance.update_interval))) if int(possibility[0]) == buffr_instance.update_interval: buffr_instance.user_readable_update_interval = possibility[2] buffr_instance.end_point = hashlib.md5('%s:%s' % (user.user_id(), apiAddress)).hexdigest() buffr_instance.last_known_data = None buffr_instance.buffr_version = current_api_version buffr_instance.put() memcache.flush_all() logging.info('Added new Buffr to datastore') taskqueue.add(url='/confirm_working_url', params={'key': buffr_instance.key()}) render(self, 'addbuffer.html', {'to_console': to_console, 'submitted': True, 'apiAddress': apiAddress})
def post(self): user = users.get_current_user() if user and users.is_current_user_admin(): render(self, 'adminpage.html', {}) elif user: self.redirect('/') else: self.redirect('/login?redirect=/admin')
def get(self): user = users.get_current_user() if user: all_buffrs = memcache.get('%s-buffrs' % user.user_id()) if not all_buffrs: all_buffrs = Buffr.all() all_buffrs.filter('user_id =', user.user_id()) all_buffrs = all_buffrs.fetch(how_many_buffrs_per_user) memcache.set('%s-buffrs' % user.user_id(), all_buffrs) user_icon = get_gravatar(user.email()) render(self, 'userinfo.html', { 'user': users.get_current_user(), 'gravatar': user_icon, 'currentAddress': self.request.host_url, 'to_console': {'gravatar': user_icon}, 'all_buffrs': all_buffrs}) else: self.redirect(users.create_login_url('/user'))
def get(self): user = users.get_current_user() if not user or 'user_id' not in dir(user): self.redirect(users.create_login_url('/addbuffr')) render(self, 'addbuffer.html', {'submitted': False, 'updateIntervalOptions': user_readable_convertion_table})
def get(self): render(self, 'home.html', {})