import os
import time
import errno
+import re
+import openerp
import netsvc
import urlparse
try:
return self.parent.get_baseuri(self) + '/'.join(ajoin)
@memoize(4)
- def db_list(self):
+ def _all_db_list(self):
+ """return all databases who have module document_webdav installed"""
s = netsvc.ExportService.getService('db')
result = s.exp_list()
self.db_name_list=[]
try:
db = sql_db.db_connect(db_name)
cr = db.cursor()
- cr.execute("SELECT id FROM ir_module_module WHERE name = 'document' AND state='installed' ")
+ cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_webdav' AND state='installed' ")
res=cr.fetchone()
if res and len(res):
self.db_name_list.append(db_name)
cr.close()
return self.db_name_list
+ def db_list(self, uri):
+ # import pudb;pudb.set_trace()
+ u = urlparse.urlsplit(uri)
+ h = u.hostname
+ d = h.split('.')[0]
+ r = openerp.tools.config['dbfilter'].replace('%h', h).replace('%d',d)
+ dbs = [i for i in self._all_db_list() if re.match(r, i)]
+ return dbs
+
def get_childs(self,uri, filters=None):
""" return the child objects as self.baseuris for the given URI """
self.parent.log_message('get children: %s' % uri)
if not dbname:
if cr: cr.close()
- res = map(lambda x: self.urijoin(x), self.db_list())
+ res = map(lambda x: self.urijoin(x), self.db_list(uri))
return res
result = []
node = self.uri2object(cr, uid, pool, uri2[:])