mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-25 01:48:41 -06:00
[IMP] Change cmis version and add popup message we get issue if the configuration is not correct
This commit is contained in:
parent
a395e63454
commit
6e06def60f
@ -26,7 +26,7 @@ import openerp.addons.connector.backend as backend
|
|||||||
cmis = backend.Backend('cmis')
|
cmis = backend.Backend('cmis')
|
||||||
""" Generic CMIS Backend """
|
""" Generic CMIS Backend """
|
||||||
|
|
||||||
cmis1000 = backend.Backend(parent=cmis, version='1.1')
|
cmis1000 = backend.Backend(parent=cmis, version='1.0')
|
||||||
""" CMIS Backend for version 1.1 """
|
""" CMIS Backend for version 1.0 """
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
@ -27,6 +27,7 @@ from cmislib.model import CmisClient
|
|||||||
import openerp.addons.connector as connector
|
import openerp.addons.connector as connector
|
||||||
from openerp.addons.connector.session import ConnectorSession
|
from openerp.addons.connector.session import ConnectorSession
|
||||||
import base64
|
import base64
|
||||||
|
import cmislib.exceptions
|
||||||
|
|
||||||
|
|
||||||
class cmis_backend(orm.Model):
|
class cmis_backend(orm.Model):
|
||||||
@ -37,7 +38,7 @@ class cmis_backend(orm.Model):
|
|||||||
_backend_type = 'cmis'
|
_backend_type = 'cmis'
|
||||||
|
|
||||||
def _select_versions(self, cr, uid, context=None):
|
def _select_versions(self, cr, uid, context=None):
|
||||||
return [('1.1', '1.1')]
|
return [('1.0', '1.0')]
|
||||||
|
|
||||||
# Test connection with GED
|
# Test connection with GED
|
||||||
def _auth(self, cr, uid, context=None):
|
def _auth(self, cr, uid, context=None):
|
||||||
@ -53,10 +54,14 @@ class cmis_backend(orm.Model):
|
|||||||
user_name = res['username']
|
user_name = res['username']
|
||||||
user_password = res['password']
|
user_password = res['password']
|
||||||
client = CmisClient(url, user_name, user_password)
|
client = CmisClient(url, user_name, user_password)
|
||||||
if not client:
|
try:
|
||||||
|
return client.defaultRepository
|
||||||
|
except cmislib.exceptions.ObjectNotFoundException:
|
||||||
|
raise osv.except_osv(_('Cmis connection Error!'),
|
||||||
|
_("Check your cmis account configuration."))
|
||||||
|
except cmislib.exceptions.PermissionDeniedException:
|
||||||
raise osv.except_osv(_('Cmis connection Error!'),
|
raise osv.except_osv(_('Cmis connection Error!'),
|
||||||
_("Check your cmis account configuration."))
|
_("Check your cmis account configuration."))
|
||||||
return client
|
|
||||||
|
|
||||||
def check_directory_of_write(self, cr, uid, ids, context=None):
|
def check_directory_of_write(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
@ -64,8 +69,8 @@ class cmis_backend(orm.Model):
|
|||||||
cmis_backend_obj = self.pool.get('cmis.backend')
|
cmis_backend_obj = self.pool.get('cmis.backend')
|
||||||
datas_fname = 'testdoc'
|
datas_fname = 'testdoc'
|
||||||
#login with the cmis account
|
#login with the cmis account
|
||||||
client = cmis_backend_obj._auth(cr, uid, context=context)
|
repo = self._auth(cr, uid, context=context)
|
||||||
repo = client.defaultRepository
|
|
||||||
folder_path_write = cmis_backend_obj.read(
|
folder_path_write = cmis_backend_obj.read(
|
||||||
cr, uid, ids, ['initial_directory_write'],
|
cr, uid, ids, ['initial_directory_write'],
|
||||||
context=context)[0]['initial_directory_write']
|
context=context)[0]['initial_directory_write']
|
||||||
@ -89,8 +94,8 @@ class cmis_backend(orm.Model):
|
|||||||
context = {}
|
context = {}
|
||||||
cmis_backend_obj = self.pool.get('cmis.backend')
|
cmis_backend_obj = self.pool.get('cmis.backend')
|
||||||
#login with the cmis account
|
#login with the cmis account
|
||||||
client = cmis_backend_obj._auth(cr, uid, context=context)
|
#login with the cmis account
|
||||||
repo = client.defaultRepository
|
repo = self._auth(cr, uid, context=context)
|
||||||
folder_path_read = cmis_backend_obj.read(
|
folder_path_read = cmis_backend_obj.read(
|
||||||
cr, uid, ids, ['initial_directory_read'],
|
cr, uid, ids, ['initial_directory_read'],
|
||||||
context=context)[0]['initial_directory_read']
|
context=context)[0]['initial_directory_read']
|
||||||
|
Loading…
Reference in New Issue
Block a user