[Revisionmanager-devel] RevisionManager CHANGES.txt,1.4,1.5 RevisionManager.py,1.5,1.6
Brought to you by:
philikon
From: panjunyong <pan...@us...> - 2004-04-12 16:23:27
|
Update of /cvsroot/revisionmanager/RevisionManager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23499 Modified Files: CHANGES.txt RevisionManager.py Log Message: add new getRevision method: get certain history revision of a file Index: RevisionManager.py =================================================================== RCS file: /cvsroot/revisionmanager/RevisionManager/RevisionManager.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RevisionManager.py 11 Apr 2004 07:15:26 -0000 1.5 --- RevisionManager.py 12 Apr 2004 16:09:36 -0000 1.6 *************** *** 1636,1639 **** --- 1636,1677 ---- RESPONSE.redirect(self.absolute_url() + '/rm_statusForm') + security.declareProtected(Permissions.RMManage, "rm_getRevision") + def rm_getRevision(self, REQUEST=None, RESPONSE=None, path='', revision=''): + """ + get a history revision. + update to a new temp dir, and send it back + """ + # make the temp work dir, setup the new settings + tmpWorkDir = tempfile.mkdtemp() + + settings = self._settings + kw = settings.copy() + kw['work_dir']=tmpWorkDir + + # setup the cvswrapper and update + if (kw['use_zope_uid'] or + kw['access_method'] == 'ext'): + user = getSecurityManager().getUser() + kw['user_name'] = user.getUserName() + cvs = CVSWrapper(**kw) + + try: + cvs.checkout(os.path.join(settings['module'], path), revision) + + # get the file + absoluteFileName = os.path.join(tmpWorkDir, settings['module'], path) + out = open(absoluteFileName, 'rb') + data = out.read() + out.close() + finally: + # delete the whole workdir + shutil.rmtree(tmpWorkDir) + + # return to file + basename = os.path.basename(absoluteFileName) + RESPONSE.setHeader('Content-Disposition', + 'attachment; filename=%s' % basename) + return data + # ############################################################################ Index: CHANGES.txt =================================================================== RCS file: /cvsroot/revisionmanager/RevisionManager/CHANGES.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CHANGES.txt 9 Apr 2004 09:09:05 -0000 1.4 --- CHANGES.txt 12 Apr 2004 16:09:36 -0000 1.5 *************** *** 2,5 **** --- 2,7 ---- CHANGES + * add new getRevision method: get certain history revision of a file --panjunyong + * Add context parameter to createObject method. This make RevisionManager compatible with creation of CMF content which need context when use |