Controller Module Documentation — bibtex_project 1.0 documentation

# Controller Module Documentation

class `controller.` `Controller`(v)

  This class is used as an interface between the model and the view

  `compare_files`()

    parse the two bibtex files using bibtex parser and create two bibtex databases replicate those two databases as mongo databases compare the records from the local file with records from the master file

  `file_update`(is_update)

    Update the current local file with changes selected by the user Args:

    > is_update: Flag indicates if the user made any selections to update the current local file

  `update`(is_update, list_change, list_add)

    Update the model and the local file with the user driven modifications and close the controller instance Args:

    > is_update: Flag indicates if the user made any selections to update the current local file list_change: List of properties for each record that have different values on the master file and the local file list_add: List of properties for each record that are present on the master file but not on the local

`controller.` `compare_records`(coll1, coll2)

  Compares the records in the mongo db collection coll1 with the records in collection coll2 and prepares two lists Args:

  > coll1: Local File MongoDb collection coll2: Master File MongoDb collection

  Returns:
    (list1,list2): list1 has records with properties having different values on the two colelctions
      list2 has records with properties present in coll2 but not in coll1

`controller.` `connect_mongo`()

  Connect to the pymongo client Raises:

  > pymongo.errors.ConnectionFailure: If no mongo server is running

`controller.` `delete_id`(elem)

  Delete the property ‘_id’ from the dictionary Args:

  > elem: Dictionary