Beispiel #1
0
    def create_note_evernote(self, user_profile, project):
        auth_token = user_profile.evernote_profile.auth_token
        evernote_helper = EvernoteHelper(user_profile.evernote_profile)
        noteStore = evernote_helper.note_store

        note = evernote_helper.create_note(self.title, self.content, project)

        try:
            created_note = noteStore.createNote(auth_token, note)
        except Errors.EDAMUserException as e:
            return None
        except Errors.EDAMNotFoundException as e:
            return None
        except Exception as e:
            raise e

        # If note is synced fine the usn is updated
        user_profile.evernote_profile.latest_update_count = created_note.updateSequenceNum
        user_profile.save()

        self.evernote_usn = created_note.updateSequenceNum
        self.evernote_guid = created_note.guid
        project.notes[int(self.id)] = self
        project.save()

        return created_note