summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2010-10-20 14:25:28 +0200
committerXavier Morel <xmo@openerp.com>2010-10-20 14:25:28 +0200
commita3e79c6d496902b4d41085d42e9d8d6b35ffb080 (patch)
tree081d9812b00106038b501a099493a189aa160238
parentdd572f0c73b17248d9a526284e931f892264cb96 (diff)
[IMP] extract creation of pad URL into separate methods for overriding/configuration in the future
bzr revid: xmo@openerp.com-20101020122528-z194x6jz1zvg1lwc
-rw-r--r--addons/piratepad/controllers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/piratepad/controllers.py b/addons/piratepad/controllers.py
index 3b30257f9a1..b0940f94369 100644
--- a/addons/piratepad/controllers.py
+++ b/addons/piratepad/controllers.py
@@ -5,9 +5,16 @@ from openobject.tools import expose
import openerp.controllers
from openerp.utils import rpc, TinyDict
+PIRATEPAD_ROOT = "http://piratepad.net/"
class Piratepad(openerp.controllers.SecuredController):
_cp_path = "/piratepad"
+ def get_root(self):
+ return PIRATEPAD_ROOT
+
+ def make_url(self, pad_name):
+ return self.get_root() + '-'.join(pad_name.split())
+
@expose('json', methods=('POST',))
def link(self, pad_name):
params, data = TinyDict.split(cherrypy.session['params'])
@@ -15,7 +22,7 @@ class Piratepad(openerp.controllers.SecuredController):
default_res_model=params.model, default_res_id=params.id,
active_id=False, active_ids=[])
- pad_link = "http://piratepad.net/"+'-'.join(pad_name.split())
+ pad_link = self.make_url(pad_name)
attachment_id = rpc.RPCProxy('ir.attachment').create({
'name': pad_name,
'url': pad_link,