2

I am trying to get and send data to Filenet. I am using cmislib 0.6.0. (Python).

The environment I am trying to use has more than one repo. If I use

repo = client.defaultRepository

I am not get the repo I want (it is not the first of the list). So, for that reason, I am using

my_rep = client.getRepository('MY_REPO_ID')

But when I tried to get a folder by the path

my_folder = my_repo.getObjectByPath('/MY_PATH')

*** AttributeError: 'RepositoryService' object has no attribute 'binding'

If I check the repo properties:

my_repo._cmisClient.__dict__

{'logger': <logging.Logger object at 0x7f0fc73d79d0>, '_uriTemplates': {}}

My default repo (which is not the repo I want) has binding attribute:

repo_default._cmisClient.__dict__

{'username': 'USER', 
 'repositoryUrl': 'http://HOST:9080/fncmis/atom11', 
 'binding': <cmislib.atompub.binding.AtomPubBinding object at 0x7f0fc6afb850>, 
 'extArgs': {}, 
 'logger': <logging.Logger object at 0x7f0fc73d7990>, 
 'password': 'PASSWORD'}

What is the configuration I am missing?

Many Thanks in advance.

1 Answers1

3

I got the solution.

The problem was the atributte _cmisClient of the repo.

When the repo is created with client.defaultRepository the repo properties are:

>>> repo_default.__dict__

{
    '_capabilities': {},
    '_repositoryName': None,
    '_permDefs': {},
    '_permMap': {},
    '_propagation': None,
    '_repositoryInfo': {},
    '_cmisClient': < cmislib.model.CmisClient object at 0x107a0b250 > ,
    '_repositoryId': None,
    'logger': < logging.Logger object at 0x107faca10 > ,
    '_permissions': None,
    'xmlDoc': < DOM Element: app: workspace at 0x1083ef998 > ,
    '_uriTemplates': {}
}

When the repo is created using client.getRepository(repositoryId)

>>> repo.__dict__
{
    '_capabilities': {},
    '_repositoryName': None,
    '_permDefs': {},
    '_permMap': {},
    '_propagation': None,
    '_repositoryInfo': {},
    '_cmisClient': < cmislib.atompub.binding.RepositoryService object at 0x10814fc10 > ,
    '_repositoryId': None,
    'logger': < logging.Logger object at 0x107faca10 > ,
    '_permissions': None,
    'xmlDoc': < DOM Element: app: workspace at 0x108786170 > ,
    '_uriTemplates': {}
 }

The first case _cmisClient has binding attribute:

{
   'username': 'REPO_USER',
   'repositoryUrl': 'REPO_URL',
   'binding': < cmislib.atompub.binding.AtomPubBinding object at 0x107f2e550 > ,
   'extArgs': {},
   'logger': < logging.Logger object at 0x107f2e590 > ,
   'password': 'REPO_PWD'
}

But the second case doesn't:

{
    'logger': < logging.Logger object at 0x107f2e5d0 > ,
    '_uriTemplates': {}
}

The problem is related how is build the repo. It is done in cmislib/atompub/binding.py, class RepositoryService.

In the first case, the repo is done in getDefaultRepository(self, client) and the repo is done with the following command:

repository = AtomPubRepository(client, [e for e in workspaceElements if e.nodeType == e.ELEMENT_NODE][0])

While in the second case, the repo is done in the method getRepository(self, client, repositoryId)

return AtomPubRepository(self, workspaceElement)

self is RepositoryService.

So, the fix is replace self with client:

return AtomPubRepository(client, workspaceElement)

I hope it helps.

UPDATE: I have forked the original cmislib with the fix for this problem:

https://github.com/sergioescudero/chemistry-cmislib