Example #1
0
 def get(self):
     user_id = get_user_id()
     backup_all = True if self.request.get("backup_all") else False
     notes = NoteManager.getNotes(backup_all)
     self.response.headers['Content-Type'] = 'application/force-download'
     for note in notes:
         self.response.write('%s\n' % note.toString())
Example #2
0
 def canBeVisitedByCurrentUser(self):
     if self.user_id == get_user_id():
         return True
     user_email = get_user_email()
     for email in self.getSharedUsers():
         if email == user_email:
             return True
     return False
Example #3
0
 def post(self):
     user_id = get_user_id()
     priority = self.request.get("priority", "p4")
     title = self.request.get("title")
     task = self.request.get("task")
     tag = self.request.get("tag")
     parent_note_id = self.request.get("parent_note_id")
     logging.debug('Add Note Page, parent_note_id = %s' % parent_note_id)
     note = NoteManager.createNote(user_id, priority, title, task,
                                   parent_note_id, tag)
     return self.redirect('dump_note?note_id=%s' % str(note.note_id))
Example #4
0
 def get(self):
     note_id = self.request.get('note_id')
     note = NoteManager.getNote(note_id)
     if note.user_id != get_user_id():
         self.response.write("note doesn't belong to current user!")
         return
     NoteManager.removeNote(note)
     template_values = {
         'to_url': 'list_notes',
     }
     self.response.write(
         load_template('refresh_to_list_notes.html', template_values))
Example #5
0
	def add_friend(self, id, iid):




		iuserid = login.get_user_id(self.key)
		userid = login.get_user_fullid(self.key)
		ouserid = ObjectId(userid)

		userdata = self.get(login.get_user_fullid(self.key))
		if userdata is not None:
			if "friends" in userdata:
				for frnd in userdata["friends"]:
					if frnd["fid"] == ouserid:
						print "Trying to add an existing contact"
						return 1


		fdata = {"id": iid, "fid": ObjectId(id), "rating": 0, "since": datetime.datetime.utcnow(), "conversation": None}
		db.roadhouse.people.update({"_id": ObjectId(userid)}, {"$push": {"friends": fdata}}, True)
		fdata2 = {"id": iuserid, "fid": ObjectId(userid), "rating": 0, "since": datetime.datetime.utcnow(), "conversation": None}
		db.roadhouse.people.update({"_id": ObjectId(id)}, {"$push": {"friends": fdata2}}, True)
		return 1
Example #6
0
 def canBeDeletedByCurrentUser(self):
     return self.user_id == get_user_id()