gnowledge/gstudio — pull request #26 by AvadootNachankar (2013-11-15 07:48:25+00:00)
Title: History-version-file creation/updation modified

1) INSTALLATIONS file renamed to install.txt

2) Regarding history-version file: For time being, while creating/updating a particular document, the developer needs to explicitly write code to create/update the history-version file respectively. That is:

(a) While saving a document, i.e. after document.save() function immediately write:

history_manager = HistoryManager()
rcs_obj = RCS()

# Saving the current document's instance into database
doc_page.save()

''' -- Storing history of this current document's instance -- '''
if history_manager.create_or_replace_json_file(doc_page):
fp = history_manager.get_file_path(doc_page)
rcs_obj.checkin(fp, 1, "Message-you-want-to-give").", "-i")

(b) While updating a document, i.e. after document.save() function immediately write:

history_manager = HistoryManager()
rcs_obj = RCS()

# Updating instance with modified data
collection_obj.update({'_id': obj_id}, {'$set': {'content_org': content_org, 'content': content}}, upsert=False)

# Must fetch from database again, otherwise you won't get the updated data
node = col_GSystem.GSystem.one({'_id': obj_id})

# Storing histroy in rcs-version-file
fp = history_manager.get_file_path(node)
rcs_obj.checkout(fp)

if history_manager.create_or_replace_json_file(node):
rcs_obj.checkin(fp, 1, "Message-you-want-to-give")