mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-25 18:08:42 -06:00
[IMP] Check if alfresco server is down
This commit is contained in:
parent
c248a393cc
commit
f1b92c915d
@ -24,6 +24,7 @@ from openerp.osv import orm, fields
|
|||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from cmislib.model import CmisClient
|
from cmislib.model import CmisClient
|
||||||
import cmislib.exceptions
|
import cmislib.exceptions
|
||||||
|
import urllib2
|
||||||
|
|
||||||
|
|
||||||
class cmis_backend(orm.Model):
|
class cmis_backend(orm.Model):
|
||||||
@ -50,6 +51,7 @@ 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)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return client.defaultRepository
|
return client.defaultRepository
|
||||||
except cmislib.exceptions.ObjectNotFoundException:
|
except cmislib.exceptions.ObjectNotFoundException:
|
||||||
@ -58,6 +60,9 @@ class cmis_backend(orm.Model):
|
|||||||
except cmislib.exceptions.PermissionDeniedException:
|
except cmislib.exceptions.PermissionDeniedException:
|
||||||
raise orm.except_orm(_('Cmis connection Error!'),
|
raise orm.except_orm(_('Cmis connection Error!'),
|
||||||
_("Check your cmis account configuration."))
|
_("Check your cmis account configuration."))
|
||||||
|
except urllib2.URLError:
|
||||||
|
raise orm.except_orm(_('Cmis connection Error!'),
|
||||||
|
_("SERVER is down."))
|
||||||
|
|
||||||
# Function to check if we have access right to write from the path
|
# Function to check if we have access right to write from the path
|
||||||
def check_directory_of_write(self, cr, uid, ids, context=None):
|
def check_directory_of_write(self, cr, uid, ids, context=None):
|
||||||
@ -153,8 +158,8 @@ class cmis_backend(orm.Model):
|
|||||||
size=128,
|
size=128,
|
||||||
required=True,
|
required=True,
|
||||||
help="Initial directory of write."),
|
help="Initial directory of write."),
|
||||||
'browsing_ok': fields.boolean('Allow browsing in this backend',
|
'browsing_ok': fields.boolean('Allow browsing this backend',
|
||||||
help="Allow browsing in this backend."),
|
help="Allow browsing this backend."),
|
||||||
'storing_ok': fields.boolean('Allow storing in this backend',
|
'storing_ok': fields.boolean('Allow storing in this backend',
|
||||||
help="Allow storing in this backend."),
|
help="Allow storing in this backend."),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user