def get(page): if page in ["/index.html","/index.php","/index.asp","/index.htm","home","/",""]: dictio = dict() dictio["user"]=users.get_current_user() path = os.path.join(os.path.dirname(__file__),'templates/static/index.html') #TODO: prettify this with latest projects/actions return template.render(path, dictio) elif page in ["settings","settings.html","settings.php"]: dictio = dict() dictio["user"]=users.get_current_user() path = os.path.join(os.path.dirname(__file__),'templates/static/settings.html') return template.render(path, dictio) elif page in ["about.php","about.html","about-us.html"]: dictio = dict() dictio["user"]=users.get_current_user() path = os.path.join(os.path.dirname(__file__),'templates/static/about.html') return template.render(path, dictio) elif page in ["faq.php","faq.html","faq.htm"]: path = os.path.join(os.path.dirname(__file__),'templates/static/faq.html') return template.render(path, {}) elif page in ["contact.html"]: if users.get_current_user() != None: import recaptcha path = os.path.join(os.path.dirname(__file__),'templates/static/contact.html') return template.render(path,{'captcha':recaptcha.displayhtml(public_key='6Ld7IMgSAAAAAJNZJcIsENwlG7Qw8q3ICDu0h_dE',use_ssl=False,error=None)}) else: path = os.path.join(os.path.dirname(__file__),'templates/static/nocontact.html') return template.render(path,{}) elif page in ["legal.html"]: path = os.path.join(os.path.dirname(__file__),'templates/static/legal.html') return template.render(path,{}) else: raise Exception('notfound')
def generate(self): return displayhtml(self.public_key)
def captcha(): return mark_safe(recaptcha.displayhtml(settings.RECAPTCHA_PUB))
def GET(self): page = self.page content = '<form method="post">' content += recaptcha.displayhtml(public_key) content += '<input type="submit" /></form>' web.render('generic.html')