def get(self, numberOfSeconds, optionsStr, title): logging.info(">>> " + self.request.url + " >>>AccessViaRelativeUrl") options = themecontroller.getThemeOptions(optionsStr) if title: title = title.strip() if title != '': title = urllib2.unquote(title.strip()) else: title = "" urlToShare = self.request.url data = { "dateObject" : { "relativeDuration": numberOfSeconds }, "title": title, "options": options, "form": {}, "relative": True, "shortUrl": urlToShare, "listOfThemes": themecontroller.getListOfThemes() } data["latestUrls"] = utils.getLatestUrls() data["popularUrls"] = utils.getMostPopulars() formData = utils.prepareFormData() data["form"].update(formData) pageContent = utils.getTemplateContent(os.path.join(os.path.dirname(__file__), "templates/main.html"), data) self.response.out.write(pageContent)
def get(self): delta = datetime.datetime.today() + datetime.timedelta(hours = 1) day = str(delta.day) if len(day) == 1: day = "0" + day month = str(delta.month) if len(month) == 1: month = "0" + month year = str(delta.year) hour = str(delta.hour) if len(hour) == 1: hour = "0" + hour minute = str(delta.minute) if len(minute) == 1: minute = "0" + minute second = str(delta.second) if len(second) == 1: second = "0" + second data = { "dateObject" : { "day": day, "month": month, "year": year, "hour": hour, "minute": minute }, "jsdate": month + "/" + day + "/" + year + " " + hour + ":" + minute + ":" + second, "title": "w.aitfor.it", "options": themecontroller.getThemeOptions("waitforit"), "form": {}, "up": True, "relative": False, "shortUrl": self.request.url, "listOfThemes": themecontroller.getListOfThemes(), "nbOfTotalUrls": utils.getNbOfTotalUrls() } data["latestUrls"] = utils.getLatestUrls() data["popularUrls"] = utils.getMostPopulars() formData = utils.prepareFormData() data["form"].update(formData) pageContent = utils.getTemplateContent(os.path.join(os.path.dirname(__file__), "templates/main.html"), data) self.response.out.write(pageContent)
def get(self): pageContent = utils.getTemplateContent(os.path.join(os.path.dirname(__file__), "templates/customThemePlayGround.html"), {"simpleCustomMode": True}) self.response.out.write(pageContent)
def get(self, target, optionsStr, title): logging.info(">>> " + self.request.url + " >>>CountDownDMYHMS") # Expected format is DDMMYYYYHHMMSS (checked via main.py by a regexp anyway) day = target[:2] month = target[2:4] year = target[4:8] hour = target[8:10] minute = target[10:12] second = target[12:14] if utils.isValidDate(day, month, year, hour, minute, second): storedUrl = utils.storeUrl(self.request.url, target, optionsStr or "", title or "", None, None, None) ctheme = None isTemplatizedCTheme = False options = {} if storedUrl.customTheme: ctheme = storedUrl.customTheme.html isTemplatizedCTheme = storedUrl.customTheme.isTemplate else: options = themecontroller.getThemeOptions(optionsStr) jsdate = month + "/" + day + "/" + year + " " + hour + ":" + minute + ":" + second if title: title = title.strip() if title != '': title = urllib2.unquote(title.strip()) else: title = "" urlToShare = utils.getContextRootFromUrl(self.request.url) + "/" + pb64.encodeB64Padless(storedUrl.counter) data = { "dateObject" : { "day": day, "month": month, "year": year, "hour": hour, "minute": minute }, "jsdate": jsdate, "title": title, "options": options, "customTheme": ctheme, "isTemplateTheme": isTemplatizedCTheme, "form": {}, "up": storedUrl.up, "relative": storedUrl.relative, "shortUrl": urlToShare, "listOfThemes": themecontroller.getListOfThemes() } data["latestUrls"] = utils.getLatestUrls() data["popularUrls"] = utils.getMostPopulars() formData = utils.prepareFormData() data["form"].update(formData) pageContent = utils.getTemplateContent(os.path.join(os.path.dirname(__file__), "templates/main.html"), data) self.response.out.write(pageContent) else: # Error, the date has a valid format, but is not a real date self.redirect("/")