Implement note deletion

This commit is contained in:
Tanner Collin 2017-10-05 21:36:12 -06:00
parent e960c2d717
commit 1dc6043061
2 changed files with 18 additions and 4 deletions

View File

@ -79,6 +79,12 @@ class ItemManager:
content=content) content=content)
return 0 return 0
def deleteNote(self, uuid):
item = self.items[uuid]
item['deleted'] = True
item['dirty'] = True
self.syncItems()
def __init__(self, username, password): def __init__(self, username, password):
self.standard_notes = StandardNotesAPI(username, password) self.standard_notes = StandardNotesAPI(username, password)
self.syncItems() self.syncItems()

View File

@ -12,7 +12,6 @@ from datetime import datetime
from fuse import FUSE, FuseOSError, Operations, LoggingMixIn from fuse import FUSE, FuseOSError, Operations, LoggingMixIn
from itemmanager import ItemManager from itemmanager import ItemManager
class StandardNotesFS(LoggingMixIn, Operations): class StandardNotesFS(LoggingMixIn, Operations):
def __init__(self, path='.'): def __init__(self, path='.'):
self.item_manager = ItemManager('tanner@domain.com', 'complexpass') self.item_manager = ItemManager('tanner@domain.com', 'complexpass')
@ -87,6 +86,18 @@ class StandardNotesFS(LoggingMixIn, Operations):
self.item_manager.createNote(note_name, now) self.item_manager.createNote(note_name, now)
return 0 return 0
def unlink(self, path):
self.notes = self.item_manager.getNotes()
path_parts = path.split('/')
note_name = path_parts[1]
note = self.notes[note_name]
uuid = note['uuid']
self.item_manager.deleteNote(uuid)
return 0
def chmod(self, path, mode): def chmod(self, path, mode):
return 0 return 0
@ -114,9 +125,6 @@ class StandardNotesFS(LoggingMixIn, Operations):
def truncate(self, path, length, fh=None): def truncate(self, path, length, fh=None):
return 0 return 0
def unlink(self, path):
return 0
def utimens(self, path, times=None): def utimens(self, path, times=None):
return 0 return 0