Skip to content
Snippets Groups Projects
Verified Commit fe73736e authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

feat(textgrid_named_dav_provider.py): show project names in dav root

parent 3df4fbe2
No related branches found
No related tags found
1 merge request!14Resolve "Show titles and format in repdav listing"
Pipeline #278149 passed
...@@ -6,6 +6,7 @@ from pprint import pformat ...@@ -6,6 +6,7 @@ from pprint import pformat
from tgclients.config import TextgridConfig from tgclients.config import TextgridConfig
from tgclients.crud import TextgridCRUD from tgclients.crud import TextgridCRUD
from tgclients.metadata import TextgridMetadata from tgclients.metadata import TextgridMetadata
from tgclients.auth import TextgridAuth
from wsgidav.util import join_uri from wsgidav.util import join_uri
from repdav.stream_tools import FileLikeQueue from repdav.stream_tools import FileLikeQueue
...@@ -42,6 +43,16 @@ class TextgridNamedRoot(TextgridRoot): ...@@ -42,6 +43,16 @@ class TextgridNamedRoot(TextgridRoot):
def __init__(self, path, environ): def __init__(self, path, environ):
super().__init__(path, environ) super().__init__(path, environ)
config = TextgridConfig()
self._auth = TextgridAuth(config)
def get_member_names(self):
_logger.debug("Called TextgridNamedRoot.get_member_names(self).")
projects = []
for project in tuple(self._auth.list_assigned_projects(self._sid)):
projects.append(self._auth.get_project_description(project).name + ' [' + project + ']')
_logger.debug("MY PROJECTS: %s", projects)
return projects
def get_member(self, name): def get_member(self, name):
_logger.debug("Called TextgridRoot.get_member(self, %s).", name) _logger.debug("Called TextgridRoot.get_member(self, %s).", name)
...@@ -62,7 +73,9 @@ class TextgridNamedProject(TextgridProject): ...@@ -62,7 +73,9 @@ class TextgridNamedProject(TextgridProject):
# return names # return names
# #
# path resolution has to be rewritten before we can work with resource titles # path resolution has to be rewritten before we can work with resource titles
response = self._tgsearch.list_project_root(self.path.split("/")[-1], self._sid) name = self.path.split("/")[-1]
project_id = name[name.rfind('[')+1:name.rfind(']')]
response = self._tgsearch.list_project_root(project_id, self._sid)
names = [] names = []
for result in response.result: for result in response.result:
names.append(self._tgmeta.filename_from_metadata(result)) names.append(self._tgmeta.filename_from_metadata(result))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment