poznamkovy-blok-o-knihach 
X36RSF

 
Classes
        
BooksModel
NotesModel
database
database_local

 
class BooksModel
      Methods defined here:
__init__(self)
deleteBook(self, bookId)
getBookById(self, bookId)
getBookExists(self, bookId)
getBooksByIds(self, ids)
getBooksByTag(self, tag)
getBooksByTags(self, tags)
getBooksList(self)
getTagsList(self)
saveBook(self, book)
synchronize(self)
updateTagList(self)

Data and other attributes defined here:
books = {}
db = None
tags = {}

 
class NotesModel
      Methods defined here:
__init__(self, booksModel)
deleteNote(self, bookId, noteId)
getBookNoteById(self, bookId, noteId)
getBookNotesByIds(self, bookId, ids)
getDefaultBookId(self)
getNotesByBookId(self, bookId)
saveNote(self, note)

Data and other attributes defined here:
booksModel = None
db = None
defaultBookId = '0AqSWlRWYPabFdHZ4aXVmdWZtd2QzSFBfSjhZUmZFZUE'

 
class database
    Google Docs database interface for Poznamkovy Blok project
 
  Methods defined here:
__init__(self, username='cvutpoznamky@gmail.com', password='osklivyheslo')
createNewBook(self, book_name, author='N/A', isbn='N/A', descr='N/A', genre='N/A', tags='', cretimestamp='', modtimestamp='', creuser='', moduser='')
Create new book and set its name. Sheet on googleDOCS is in format DB_<hash_num>.
Args:  book_name - book name
[author] - default 'N/A'
[isbn] - default 'N/A'
[descr] - default 'N/A'
                  [genre] - default 'N/A'
                  [tags] - default ''
[cretimestamp] - default '', inserts time.time()
[modtimestamp] - default '', inserts time.time()
[creuser] - default '', inserts username
[moduser] - default '', inserts username
Returns: new book unique identifier
createNote(self, book_id, header='N/A', body='N/A', tags='', cretimestamp=None, modtimestamp=None, creuser=None, moduser=None)
Creates note for selected book.
Args: book_id - Google Docs spreadsheet identifier
      [header] - note header
      [body] - body input
      [tags] - tags divided by comma
      [cretimestamp] - creation timestamp (date.date())
      [modtimestamp] - modification timestamp (date.date())
      [creuser] - creator
      [moduser] - modificator
Return: boolean success
deleteBook(self, book_id)
Deletes book from Google Docs.
Arg: book_id - Google Docs spreadsheet identifier
Returns: boolean success
deleteNote(self, book_id, note_id)
Delete note by id
Args: book_id - Google Docs spreadsheet identifier
      note_id - note to be deleted
Returns: boolean success
getNotesByBookID(self, book_id)
Returns a collection of notes stored for selected book.
Arg: book_id - Google Docs spreadsheet identifier
Returns: list of dictionaries - dictionary contains keys: id, header, body, tags, cretimestamp, modtimestamp, creuser, moduser
listBooks(self, book_name=None)
Returns a collection of available books. Result set can be filtered by name (partial match).
Arg: [book_name] - name filter
Returns: list of dictionaries {'id', 'name', author', 'isbn', 'descr', 'genre', 'tags', 'cretimestamp', 'modtimestamp', 'creuser', 'moduser'}, where ID = Google Docs spreadsheet identifier
updateBook(self, book_id, name=None, author=None, isbn=None, descr=None, genre=None, tags=None, modtimestamp=None, moduser=None)
Updates book info.
  Args: book_id - Google Docs spreadsheet identifier
                [name] - new book name
[author]
                [isbn]
                [descr]
                [genre]
                [tags]
[modtimestamp]
[moduser]
  Returns: boolean success
updateNote(self, book_id, note_id, header=None, body=None, tags=None, modtimestamp=None, moduser=None)
Update book note defined by id.
Args: book_id - Google Docs spreadsheet identifier, represents book containing the note
      note_id - note identificator
      [header] - note data
      [body] - note data
      [tags] - note data
      [modtimestamp] - modification timestamp
      [moduser] - modificator
Returns: boolean success

 
class database_local
    Local interface to GoogleDOCS database.
 
  Methods defined here:
__init__(self, username='cvutpoznamky@gmail.com', password='osklivyheslo')
commit(self)
Commit local changes to network server.
!!--!! Modifies local structures (new ID). Re-list informations after commit !!--!! 
Sets modified flag to False
Returns: True on successful structure commit, False if object is not synchronized
Note: implement Exception handling (ret False on problem)
createNewBook(self, book_name, author='N/A', isbn='N/A', descr='N/A', genre='N/A', tags='')
Create new book and set its name.
Returns False if object is not synchronized.
Args:  book_name - book name
[author] - default 'N/A'
[isbn] - default 'N/A'
[descr] - default 'N/A'
                  [genre] - default 'N/A'
                  [tags] - default ''
Returns: new book unique identifier
createNote(self, book_id, header='N/A', body='N/A', tags='')
Creates note for selected book.
Returns empty list if object is not synchronized.
Args: book_id - Google Docs spreadsheet identifier
      [header] - note header
      [body] - body input
      [tags] - tags divided by comma
Return: boolean success
deleteBook(self, book_id)
Sets deleted flag to book in local structure.
Returns empty list if object is not synchronized.
Arg: book_id - Google Docs spreadsheet identifier
Returns: boolean success
deleteNote(self, book_id, note_id)
Delete note by id
Returns False if object is not synchronized.
Args: book_id - Google Docs spreadsheet identifier
      note_id - note to be deleted
Returns: boolean success
getNotesByBookID(self, book_id)
Returns a collection of notes stored for selected book.
Returns empty list if object is not synchronized.
Arg: book_id - Google Docs spreadsheet identifier
Returns: list of dictionaries - dictionary contains keys: id, header, body, tags
listBooks(self, book_name=None)
Returns a collection of available books. Result set can be filtered by name (partial match).
Returns empty list if object is not synchronized. 
Arg: [book_name] - name filter
Returns: list of dictionaries {'id', 'name', author', 'isbn', 'descr', 'genre', 'tags'}, where ID = Google Docs spreadsheet identifier
update(self)
Create dictionary of {'id', 'name', author', 'isbn', 'descr', 'genre', 'tags'} and assign it to self.db_local variable
Sets synchronized flag to True, modified flag to False
Returns: True on successful structure creation
Note: implement Exception handing in case of network problem - will return False
updateBook(self, book_id, name=None, author=None, isbn=None, descr=None, genre=None, tags=None)
Updates book info.
Returns False if object is not synchronized.
    Args: book_id - Google Docs spreadsheet identifier
                  [name] - new book name
  [author]
                  [isbn]
                  [descr]
                  [genre]
                  [tags]
    Returns: boolean success
updateNote(self, book_id, note_id, header=None, body=None, tags=None)
Update book note defined by id.
Returns False if object is not synchronized.
Args: book_id - Google Docs spreadsheet identifier, represents book containing the note
      note_id - note identificator
      [header] - note data
      [body] - note data
      [tags] - note data
Returns: boolean success

Data and other attributes defined here:
db_client = None
db_local = None
modified = False
new_book_id = 0
new_note_id = 0
synchronized = False

 
Data
         __author__ = 'egertpe, hovorvoj, koldctom, kovarjin, kulovjir, lommicha, stetomar'
__date__ = '23 April 2011'

 
Author
         egertpe, hovorvoj, koldctom, kovarjin, kulovjir, lommicha, stetomar