Exemplo n.º 1
0
def displayNoteToBeupdated(Username, Permalink):
	sessionUser = checkCookiesSessionUser();
	if sessionUser == None:
		return template('login', user=sessionUser)

	note = db.getNoteby_Username_Permalink(Username, Permalink);

	if note == None:
		return redirectHome();

	if sessionUser['UserID'] == note['UserID']:
		colors = db.getColorsAvailable(); # get all the available colors
		return template('createNote', note=note, colors=colors,user=sessionUser, editNote=True)
	
	return redirectPrivateZone(); # Private note. Guest can't read this note
Exemplo n.º 2
0
def displayNote(Username, Permalink):
	sessionUser = checkCookiesSessionUser();

	note = db.getNoteby_Username_Permalink(Username, Permalink);

	if (note == None):
		return redirectHome(); #return "The note you're trying to read dont exist";

	if sessionUser == None: 
		if int(note['Private']) == 0: #Gues user. Only shows the note if is public
			return template('singleNote', note=note, user=sessionUser);
	if sessionUser != None: # For logged in users. They can read "Public" notes and those notes owned by them
		if int(note['Private']) == 0 or sessionUser['UserID'] == note['UserID']: #la NOTa es publica o el usuario esta conectado
			return template('singleNote', note=note, user=sessionUser);
	
	return redirectPrivateZone(); # Not allowd to see this content