def execute(self): method = self.request.method user = self.values['user'] self.values['tab'] = '/admin' if user.rol != 'admin': self.forbidden() return if method == 'GET': app = self.get_application() self.values['m'] = self.get_param('m') if not app: app = model.Application() self.values['app'] = app self.values['mail_contact'] = self.not_none(app.mail_contact) self.values['mail_subject_prefix'] = self.not_none( app.mail_subject_prefix) self.values['mail_sender'] = self.not_none(app.mail_sender) self.values['mail_footer'] = self.not_none(app.mail_footer) self.render('templates/module/admin/admin-mail.html') elif self.auth(): app = self.get_application() if not app: app = model.Application() app.mail_subject_prefix = self.get_param('mail_subject_prefix') app.mail_contact = self.get_param('mail_contact') app.mail_sender = self.get_param('mail_sender') app.mail_footer = self.get_param('mail_footer') app.put() memcache.delete('app') AppProperties().updateJinjaEnv() self.redirect('/module/admin.mail?m=' + self.getLocale('Updated'))
def execute(self): method = self.request.method if method == 'GET': self.values['redirect_to'] = self.request.get('redirect_to') self.render('templates/module/user/user-forgotpassword.html') else: email = self.request.get('email') u = model.UserData.all().filter('email =', email).get() if not u: self.show_error(email, "No user found with this mail") return # only local accounts can reset password app = self.get_application() subject = self.getLocale("Password recovery")#u"Recuperar password" if u.registrationType is None or u.registrationType == 0: u.token = self.hash(str(random.random()), email) u.put() #Haz click en el siguiente enlace para proceder a establecer tu password.\n%s/module/user.resetpassword?nickname=%s&token=%s body = self.getLocale("Click this link to set your password.\n%s/module/user.resetpassword?nickname=%s&token=%s") % (app.url, u.nickname, u.token) else: accountProvider = AppProperties().getAccountProvider(u.registrationType) body = self.getLocale("You have requested to recover password but credentials you use in %s are from %s. Review your login information.") % (app.name, accountProvider) self.mail(subject=subject, body=body, to=[u.email]) self.values['token'] = u.token self.values['email'] = email self.values['redirect_to'] = self.request.get('redirect_to') self.render('templates/module/user/user-forgotpassword-sent.html')
def create_jinja_environment(self): env = AppProperties().getJinjaEnv() env.filters['relativize'] = self.relativize env.filters['markdown'] = self.markdown env.filters['smiley'] = self.smiley env.filters['pagination'] = self.pagination env.filters['media'] = self.media_content env.filters['quote'] = self.quote return env
def update07to08(): app = model.Application.all().get() app.theme = 'blackbook' app.version = '0.8' app.put() memcache.delete('app') AppProperties().updateJinjaEnv() return
def create_jinja_environment(self): env = AppProperties().getJinjaEnv() env.filters["relativize"] = self.relativize env.filters["markdown"] = self.markdown env.filters["smiley"] = self.smiley env.filters["pagination"] = self.pagination env.filters["media"] = self.media_content env.filters["quote"] = self.quote return env
def get(self): if self.request.url.split('/')[2] == AppProperties().getAppDic().get( Constant.domain): #'vikuit.com': self.redirect(self.get_application().url + self.request.url.split('/', 3)[3], permanent=True) # 'http://www.vikuit.com/' return try: self.common_stuff() self.pre_execute() except CapabilityDisabledError: self.values = {} self.render('templates/maintenace.html') return
def execute(self): method = self.request.method user = self.values['user'] self.values['tab'] = '/admin' if user.rol != 'admin': self.forbidden() return if method == 'GET': app = self.get_application() self.values['m'] = self.get_param('m') if not app: app = model.Application() self.values['app'] = app self.values['recaptcha_public_key'] = self.not_none( app.recaptcha_public_key) self.values['recaptcha_private_key'] = self.not_none( app.recaptcha_private_key) self.values['google_adsense'] = self.not_none(app.google_adsense) self.values['google_adsense_channel'] = self.not_none( app.google_adsense_channel) self.values['google_analytics'] = self.not_none( app.google_analytics) self.render('templates/module/admin/admin-google.html') elif self.auth(): app = self.get_application() if not app: app = model.Application() app.recaptcha_public_key = self.get_param('recaptcha_public_key') app.recaptcha_private_key = self.get_param('recaptcha_private_key') app.google_adsense = self.get_param('google_adsense') app.google_adsense_channel = self.get_param( 'google_adsense_channel') app.google_analytics = self.get_param('google_analytics') app.put() memcache.delete('app') AppProperties().updateJinjaEnv() self.redirect('/module/admin.google?m=' + self.getLocale('Updated'))
def execute(self): method = self.request.method user = self.values['user'] self.values['tab'] = '/admin' if user.rol != 'admin': self.forbidden() return if method == 'GET': app = self.get_application() self.values['m'] = self.get_param('m') if not app: app = model.Application() self.values['app'] = app self.values['theme'] = self.not_none(app.theme) self.values['max_results'] = self.not_none(app.max_results) self.values['max_results_sublist'] = self.not_none( app.max_results_sublist) self.render('templates/module/admin/admin-lookandfeel.html') elif self.auth(): app = self.get_application() if not app: app = model.Application() logo = self.request.get("logo") if logo: app.logo = images.im_feeling_lucky(logo, images.JPEG) memcache.delete('/images/application/logo') app.theme = self.get_param("theme") if self.get_param('max_results'): app.max_results = int(self.get_param('max_results')) if self.get_param('max_results_sublist'): app.max_results_sublist = int( self.get_param('max_results_sublist')) app.put() memcache.delete('app') AppProperties().updateJinjaEnv() self.redirect('/module/admin.lookandfeel?m=' + self.getLocale('Updated'))
def execute(self): method = self.request.method user = self.values['user'] self.values['tab'] = '/admin' if user.rol != 'admin': self.forbidden() return if method == 'GET': app = self.get_application() self.values['m'] = self.get_param('m') if not app: app = model.Application() self.values['app'] = app self.values['appName'] = self.not_none(app.name) self.values['appSubject'] = self.not_none(app.subject) self.values['locale'] = self.not_none(app.locale) self.values['url'] = self.not_none(app.url) self.render('templates/module/admin/admin-application.html') elif self.auth(): app = self.get_application() if not app: app = model.Application() app.users = model.UserData.all().count() app.communities = model.Community.all().count() app.threads = model.Thread.all().filter('parent_thread', None).count() app.articles = model.Article.all().filter('draft =', False).filter('deletion_date', None).count() app.name = self.get_param('appName') app.subject = self.get_param("appSubject") app.locale = self.get_param("locale") app.url = self.get_param('url') app.put() memcache.delete('app') AppProperties().updateJinjaEnv() self.redirect('/module/admin.application?m='+self.getLocale('Updated'))
def getLocale(label): env = AppProperties().getJinjaEnv() t = env.get_template("/translator-util.html") return t.render({"label": label})
def execute(self): method = self.request.method user = self.values['user'] self.values['tab'] = '/admin' if user.rol != 'admin': self.forbidden() return if method == 'GET': app = self.get_application() self.values['m'] = self.get_param('m') if not app: app = model.Application() self.values['app'] = app self.values['appName'] = self.not_none(app.name) self.values['appSubject'] = self.not_none(app.subject) self.values['locale'] = self.not_none(app.locale) self.values['theme'] = self.not_none(app.theme) self.values['url'] = self.not_none(app.url) self.values['mail_contact'] = self.not_none(app.mail_contact) self.values['mail_subject_prefix'] = self.not_none( app.mail_subject_prefix) self.values['mail_sender'] = self.not_none(app.mail_sender) self.values['mail_footer'] = self.not_none(app.mail_footer) self.values['recaptcha_public_key'] = self.not_none( app.recaptcha_public_key) self.values['recaptcha_private_key'] = self.not_none( app.recaptcha_private_key) self.values['google_adsense'] = self.not_none(app.google_adsense) self.values['google_adsense_channel'] = self.not_none( app.google_adsense_channel) self.values['google_analytics'] = self.not_none( app.google_analytics) self.values['max_results'] = self.not_none(app.max_results) self.values['max_results_sublist'] = self.not_none( app.max_results_sublist) self.render('templates/module/admin/admin-modules.html') elif self.auth(): app = self.get_application() if not app: app = model.Application() app.users = model.UserData.all().count() app.communities = model.Community.all().count() app.threads = model.Thread.all().filter('parent_thread', None).count() app.articles = model.Article.all().filter( 'draft =', False).filter('deletion_date', None).count() app.name = self.get_param('appName') app.subject = self.get_param("appSubject") app.locale = self.get_param("locale") logo = self.request.get("logo") if logo: app.logo = images.im_feeling_lucky(logo, images.JPEG) memcache.delete('/images/application/logo') app.theme = self.get_param("theme") app.url = self.get_param('url') app.mail_subject_prefix = self.get_param('mail_subject_prefix') app.mail_contact = self.get_param('mail_contact') app.mail_sender = self.get_param('mail_sender') app.mail_footer = self.get_param('mail_footer') app.recaptcha_public_key = self.get_param('recaptcha_public_key') app.recaptcha_private_key = self.get_param('recaptcha_private_key') app.google_adsense = self.get_param('google_adsense') app.google_adsense_channel = self.get_param( 'google_adsense_channel') app.google_analytics = self.get_param('google_analytics') if self.get_param('max_results'): app.max_results = int(self.get_param('max_results')) if self.get_param('max_results_sublist'): app.max_results_sublist = int( self.get_param('max_results_sublist')) app.put() memcache.delete('app') AppProperties().updateJinjaEnv() self.redirect('/module/admin.application?m=' + self.getLocale('Updated'))