def get(self, feed_url, messageid): existingUsers = UserDetails.gql("WHERE feedUrl = :1 LIMIT 1",feed_url) for existingUser in existingUsers: email_name = existingUser.emailName account_exists = True USER_EMAIL = email_name + config.SETTINGS['emaildomain'] mId = int(messageid) accountExists = False emailName = "" empty = True email = MailMessage.get_by_id(mId) if email: empty = False feed_url = self.request.path.split('/')[2] prev_url = "" next_url = "" this_data = { 'email':email, 'to':USER_EMAIL, 'user':email_name, 'account_exists':account_exists, 'empty': empty, 'feed_url':feed_url[2], 'feed_url':feed_url, 'prev_url':prev_url} app = App() view_data = app.data(this_data) path = os.path.join(main.ROOT_DIR, 'views/view/web-single.html') self.response.out.write(template.render(path, view_data))
def get(self, feed_url): account_exists = empty = False emailName = "" existingUsers = UserDetails.gql("WHERE feedUrl = :1 LIMIT 1",feed_url) for existingUser in existingUsers: email_name = existingUser.emailName account_exists = True if account_exists: feed_path = feed_url feed_url = config.SETTINGS['url'] +"/"+ feed_url user_email = email_name + config.SETTINGS['emaildomain'] app = App() emails = MailMessage.all().filter("toAddress = ", user_email).order("-dateReceived") emailCount = emails.count() if emailCount == 0: empty = True this_data = { 'emails':emails, 'to':user_email, 'authControl':users.create_login_url("/"), 'empty': empty, 'feed_url':feed_url, 'feed_path':feed_path, 'account_exists':account_exists} view_data = app.data(this_data) path = os.path.join(main.ROOT_DIR, 'views/view/web.html') self.response.out.write(template.render(path, view_data)) else: self.redirect("/#")
def post(self): app = App() confirm_username = self.request.get('email_name') validator = AccountValidator() validation = validator.validate(self.request.get('email_name')) if validation['valid']: account_available = True confirm_url = "/confirm/" + validation['email_name'] auth_control = users.create_login_url(confirm_url) feed_urls = Check.generate_box(validation['email_name']) feed_url = feed_urls['feed'] feed_view = feed_urls['view'] feed_gen = feed_urls['gen'] validator = AccountValidator() validation = validator.validate(confirm_username) if validation['valid']: userDetails = UserDetails() userDetails.emailName = validation['email_name'] userDetails.feedUrl = feed_gen userDetails.put() self.redirect("/view/" + feed_gen) else: self.redirect("/#invalid" + validation['errors'] + " " + confirm_username) this_data = { 'email_name':validation['email_name'], 'hostname':config.SETTINGS['hostname'], 'account_available':account_available, 'auth_control':auth_control, 'feed_url':feed_url, 'feed_view':feed_view } view_data = app.data(this_data) path = os.path.join(main.ROOT_DIR, 'views/register.html') self.response.out.write(template.render(path,view_data)) else: path = os.path.join(main.ROOT_DIR, 'views/index.html') this_data = {'errors':validation['errors']} view_data = app.data(this_data) self.response.out.write(template.render(path, view_data))
def get(self, feed_url): account_exists = False existingUsers = UserDetails.gql("WHERE feedUrl = :1 LIMIT 1",feed_url) for existingUser in existingUsers: email_name = existingUser.emailName account_exists = True if account_exists: FEED_TITLE = email_name + " - email2feed" FEED_URL = "http://"+config.SETTINGS['hostname']+"/"+feed_url FEED_URL_VIEW = "http://"+config.SETTINGS['hostname']+"/view/"+feed_url USER_EMAIL = email_name + config.SETTINGS['emaildomain'] # ex. [email protected] USER_LINK = config.SETTINGS['url'] + "/view/" + feed_url latestMessageVal = ""; messages = MailMessage.all().filter("toAddress = ", USER_EMAIL).order("-dateReceived") results = messages.fetch(config.SETTINGS['maxfetch']) latestEmailQry = MailMessage.all().filter("toAddress = ", USER_EMAIL).order("-dateReceived") latestMessageFtch = latestEmailQry.fetch(1) for latestMessage in latestMessageFtch: latestMessageVal = latestMessage.dateReceived footer = "<div style='clear:both;text-align: right; width:100%'><span style='color:#4E83B9'>email<span style='color:#1A4979; font-weight: bold;'>2</span><span style='color:#4E83B9'>feed</span> | <a target='_blank' style='color:#4E83B9;text-decoration: none;' href='" + FEED_URL_VIEW + "'>settings</a></div>" this_data = { "results" : results ,"feedTitle" : FEED_TITLE ,"feedUrl" : FEED_URL ,"feedFooter" : footer ,"updated" : latestMessageVal ,"name" : email_name ,"email" : USER_EMAIL ,"userlink" : USER_LINK } app = App() view_data = app.data(this_data) self.response.headers['Content-Type'] = 'application/atom+xml' self.response.out.write(template.render("views/view/atom.xml", view_data)) else: self.redirect("/#")
def get(self): app = App() path = os.path.join(main.ROOT_DIR, 'views/index.html') user = users.get_current_user() authControl = users.create_login_url("/") #dynamic link path to login or logout screens if user: #if logged in account = app.account_exists(users.get_current_user()) if account['exists']: #Did this user get an email with us? if account['account_name']: self.redirect("/view/"+account['account_name']) this_data = {} view_data = app.data(this_data) self.response.out.write(template.render(path, view_data))