Then I modify The loggerhead.controllers.__init__.py to make a HTTPRedirect when is a download. This redirect the navigator to the real filename that is placed in os.getcwd()+ '/loggerhead/static/downloads/' + filename. It need to be changed because you need to run loggerhead inside the directory, instead of use os.getcwd you can use a config variable.
Then I modify loggerhead.apps.branch.py to add TGZ page and respond to redirection raising instead of returning.
And finally I modify the templates to show a download button.
Now I will try to create a launchpad branch of loggerhead applying that changes.
I attach a bzr diff modificated to show only the changes that are interesting.
I make some modifies to loggerhead to show like I want, and the code is merged with style and other own modification that make it difficult.
I will explain how it work:
First it's needed that loggerhead.history could export:
--- loggerhead/ history. py 2008-12-28 05:10:10 +0000 history. py 2009-01-08 23:54:47 +0000
+++ loggerhead/
@@ -51,6 +51,7 @@
import bzrlib.textfile
import bzrlib.tsort
import bzrlib.ui
+import bzrlib.export
# bzrlib's UIFactory is not thread-safe
lineno += 1
uihack = threading.local()
@@ -919,3 +920,8 @@
+
+ def export(self, revid, dest):
+ rev_tree = self._branch.
+ bzrlib.
+ return dest
Then I add this to download_ui controller: controllers/ download_ ui.py' controllers/ download_ ui.py 2008-12-05 18:52:44 +0000 controllers/ download_ ui.py 2009-01-08 23:54:47 +0000
=== modified file 'loggerhead/
--- loggerhead/
+++ loggerhead/
@@ -25,10 +25,26 @@
from paste.request import path_info_pop
from loggerhead. controllers import TemplatedBranchView
+import os
log = logging. getLogger( "loggerhead. controllers" )
+class TGZ(TemplatedBr anchView) : get_revno( revid) _branch_ nick, revno) static/ downloads/ ' + filename exists( rpath): export( revid, rpath) downloads/ '+filename} hView):
+ def get_values(self, path, kwargs, headers):
+ history = self._history
+ revid = self.get_revid()
+
+ revno = history.
+ filename = '%s_%s.tgz' % (history.
+ rpath = os.getcwd()+ '/loggerhead/
+
+ if not os.path.
+ history.
+
+ return {'download': '/static/
+
+
class DownloadUI (TemplatedBranc
def __call__(self, environ, start_response):
Then I modify The loggerhead. controllers. __init_ _.py to make a HTTPRedirect when is a download. This redirect the navigator to the real filename that is placed in os.getcwd()+ '/loggerhead/ static/ downloads/ ' + filename. It need to be changed because you need to run loggerhead inside the directory, instead of use os.getcwd you can use a config variable.
Then I modify loggerhead. apps.branch. py to add TGZ page and respond to redirection raising instead of returning.
And finally I modify the templates to show a download button.
Now I will try to create a launchpad branch of loggerhead applying that changes.