[IMP] extract creation of pad URL into separate methods for overriding/configuration in the future
bzr revid: xmo@openerp.com-20101020122528-z194x6jz1zvg1lwc
This commit is contained in:
parent
dd572f0c73
commit
a3e79c6d49
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue