vsPloneLibrary and Subversion integration
Repository structure
- <repository root>/<bookid>/<bookid>.txt
- repository root is a configurable parameter
- each book file has a special timestamp on a first line: "Timestamp: YYYYMMDDHHMMSS". It is maintained only by the system.
Upload of a new book
- check whether <repository root>/<bookid> exits in repo, if not create it
- checkout <repository root>/<bookid> into a temporary working copy <wc>
- check whether <wc>/<bookid>.txt does not exist, if so then it is a book update (see next section)
- check whether there is no timestamp, if so refuse the file (new file cannot have a timestamp, it is probably a different book)
- add a current timestamp
- save the file into <wc>/<bookid>.txt
- add it under svn control
- commit it
Book update
Steps 1.-3. as above have been already performed.
- check whether timestamps in <wc>/<bookid>.txt (from repository) and uploaded file are equal. If not refuse the file.
- update the timestamp
- save the file in <wc>/<bookid>.txt
- commit it
Book download
The book file is simply retrieved from repository.
Subversion credentials
We will use the same credentials as for plone authentification. Under normal circumstances the credential string is constructed like that:
from base64 import encodestring
encodestring("username:password")
The encoded credential string can be retrieved from REQUEST.get("__ac"). If the decoded string is ":", it will mean that SessionCrumbler product is in place. Then the encoded string will be obtained from REQUEST.SESSION.get("__ac").get("ac") .
