def get(self): template_params = {} # user = User.checkUser() # if not user: # template_params['loginUrl'] = User.loginUrl() # else: # template_params['logoutUrl'] = User.logoutUrl() # template_params['user'] = user.email user = None if self.request.cookies.get( 'our_token' ): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if user: #newlinks linkslist = Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink = link.from_link if fromlink is not None: urlandlink = [url, des, fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email html = template.render("web/templates/index.html", template_params) self.response.write(html)
def get(self): template_params={} user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist=Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email contactlist= Contact.getAllContactsPerUser(user) contacts= [] if contactlist: for contact in contactlist: contact_email= contact.contact_user_email contact_nickname= contact.nick_name email_and_nickname= [contact_email, contact_nickname] contacts.append(email_and_nickname) template_params['contacts']=contacts html = template.render("web/templates/contactspage.html", template_params) self.response.write(html)
def get(self): template_params = {} user = None if self.request.cookies.get( 'our_token' ): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return linkslist = Link.getAllLinksPerUser(user) #sorted(linkslist, key=lambda link: link.time_of_enter_the_link') # sort by age newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink = link.from_link if fromlink is not None: urlandlink = [url, des, fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls template_params['useremail'] = user.email html = template.render("web/templates/newlinks.html", template_params) self.response.write(html) return
def get(self): template_params = {} # user = User.checkUser() # if not user: # template_params['loginUrl'] = User.loginUrl() # else: # template_params['logoutUrl'] = User.logoutUrl() # template_params['user'] = user.email user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if user: #newlinks linkslist=Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email html = template.render("web/templates/details.html", template_params) self.response.write(html)
def get(self): template_params={} user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist=Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email grouplist= Group.getAllGroups(user) groups= [] if grouplist: for group in grouplist: group_name= group['group_name'] groupid=group['id'] one=[group_name,groupid] groups.append(one) template_params['groupss']= groups html = template.render("web/templates/mygroups.html", template_params) self.response.write(html)
def get(self): template_params={} user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return linkslist=Link.getAllLinksPerUser(user) #sorted(linkslist, key=lambda link: link.time_of_enter_the_link') # sort by age newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls template_params['useremail'] = user.email html = template.render("web/templates/newlinks.html", template_params) self.response.write(html) return
def get(self, group_id): template_params={} user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist=Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email grouplist= Group.getAllGroups(user) groups= [] if grouplist: for group in grouplist: group_name= group['group_name'] groupid=group['id'] one=[group_name,groupid] groups.append(one) template_params['groupss']= groups group = Group.get_by_id(int(group_id)) if group is None: return if group.admin != user.key and user.key not in group.members: template_params['no_access'] = True html = template.render('web/templates/mygroups.html', template_params) self.response.write(html) return else: template_params['group_name'] = group.group_name template_params['group_id'] = group_id linksInGroup=group.getLinks() links= [] for link in linksInGroup: link_user_name= link['email'] link_description= link['description'] link_url_link= link['url_link'] link_date= link['time_of_enter_the_link'] one=[link_user_name,link_description,link_url_link,link_date] links.append(one) links.reverse() template_params['links']= links html = template.render('web/templates/mygroupschat.html', template_params) self.response.write(html)
def get(self): template_params = {} user = None if self.request.cookies.get( 'our_token' ): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist = Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink = link.from_link if fromlink is not None: urlandlink = [url, des, fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email contactlist = Contact.getAllContactsPerUser(user) contacts = [] if contactlist: for contact in contactlist: contact_email = contact.contact_user_email contact_nickname = contact.nick_name email_and_nickname = [contact_email, contact_nickname] contacts.append(email_and_nickname) template_params['contacts'] = contacts html = template.render("web/templates/contactspage.html", template_params) self.response.write(html)
def get(self): template_params = {} user = None if self.request.cookies.get( 'our_token' ): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist = Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink = link.from_link if fromlink is not None: urlandlink = [url, des, fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls #newlinks template_params['useremail'] = user.email grouplist = Group.getAllGroups(user) groups = [] if grouplist: for group in grouplist: group_name = group['group_name'] groupid = group['id'] one = [group_name, groupid] groups.append(one) template_params['groupss'] = groups html = template.render("web/templates/mygroups.html", template_params) self.response.write(html)
def get(self, group_id): template_params={} user = None if self.request.cookies.get('our_token'): #the cookie that should contain the access token! user = User.checkToken(self.request.cookies.get('our_token')) if not user: html = template.render("web/templates/index.html", {}) self.response.write(html) return #newlinks linkslist=Link.getAllLinksPerUser(user) newurls = [] template_params = {} if linkslist: for link in linkslist: url = link.url_link des = link.description fromlink=link.from_link if fromlink is not None: urlandlink =[url,des,fromlink] newurls.append(urlandlink) template_params['newurls'] = newurls template_params['useremail'] = user.email grouplist= Group.getAllGroups(user) groups= [] if grouplist: for group in grouplist: group_name= group['group_name'] groupid=group['id'] one=[group_name,groupid] groups.append(one) template_params['groupss']= groups group = Group.get_by_id(int(group_id)) if group is None: return if group.admin != user.key and user.key not in group.members: template_params['no_access'] = True html = template.render('web/templates/mygroups.html', template_params) self.response.write(html) return else: template_params['admin_access'] =False if group.admin == user.key: template_params['admin_access'] =True template_params['group_name'] = group.group_name template_params['group_id'] = group_id linksInGroup=group.getLinks() links= [] for link in linksInGroup: link_user_name= link['email'] link_description= link['description'] link_url_link= link['url_link'] link_date= link['time_of_enter_the_link'] one=[link_user_name,link_description,link_url_link,link_date] links.append(one) sorted(links, key=lambda links: one[3]) links.reverse() template_params['links']= links all_Member_In_The_Group=group.getMembers() all_Member_In_The_Group.insert(0,group.getAdminOfTheGroup()) template_params['members']=all_Member_In_The_Group html = template.render('web/templates/mygroupschat.html', template_params) self.response.write(html)