Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymous access? #1

Open
olebole opened this issue Feb 24, 2023 · 3 comments
Open

Anonymous access? #1

olebole opened this issue Feb 24, 2023 · 3 comments

Comments

@olebole
Copy link

olebole commented Feb 24, 2023

Hi,

FYI, based on your package, I created a sphinxdoc "role" that can refer to docushare documents within sphinxdoc: https://github.com/olebole/sphinx-docushare
My main question here is how it is possible to retrieve documents anonymously, f.e. from https://docushare.lsstcorp.org/docushare? Without the login() method, one cannot proceed.

Unrelated to this: Is there a reason why this package is only on test.pypi.org and not on the main PyPI?

@tnakamot
Copy link
Collaborator

tnakamot commented Mar 6, 2023

Hi, thank you for your valuable feedback. Your sphinx extension looks nice.

I wasn't aware of any DocuShare site that does not require login. I removed a couple of check points that raise an error when the user has not been logged in.
2f3db95

Hope it works for your use case. It hasn't been well tested, but will include this change in the next release.

Regarding the question about PyPI, I just felt that this library heavily relies on specific DocuShare configurations that are probably not universal for all DocuShare sites. Actually, looking at your LSST's DocuShare site, there is handle 'presentation-xxxx' which I have never seen and this library does not support that. So, I am still reluctant to put this library in PyPI, but may change my mind if there are more requests.

@olebole
Copy link
Author

olebole commented Mar 6, 2023

Thank you for the change! This will specifically help to have some public tests!
Another questions: Often, the objects have a number of additional properties (standard and custom), which would be nice to have accessible: for my "sphinxdoc" package I would f.e. like to have it customizable what should be displayed as link text for the document. In my own project, this would be f.e. the "Document Number", which is a custom non-standard field.
This could be easily accomplished by adding the "property" to the objects. With monkeypatching in docushare.py:

--- a/docushare/docushare.py
+++ b/docushare/docushare.py
@@ -735,6 +735,7 @@ class DocuShare:
                 title = title,
                 object_handles = object_handles
             )
+            self.__dsobjects[hdl].properties = properties
             return self.__dsobjects[hdl]
         elif hdl.type == HandleType.Document:
             # Get properties
@@ -754,6 +755,7 @@ class DocuShare:
                 document_control_number = document_control_number,
                 version_handles = version_handles
             )
+            self.__dsobjects[hdl].properties = properties
             return self.__dsobjects[hdl]
         elif hdl.type == HandleType.Version:
             # Get properties
@@ -769,6 +771,7 @@ class DocuShare:
                 filename = filename,
                 version_number = version_number
             )
+            self.__dsobjects[hdl].properties = properties
             return self.__dsobjects[hdl]
         else:
             assert False, 'code must not reach here'

but the better way would probably be to add the property to the constructor of CollectionObject etc.

For the non-standard handles: a pragmatic way would be to treat all non-standard handles as DocumentObject; this seems at least the case in the LSST docushare.

If you like, I could prepare one or two Pull Requests for there things.

This was referenced Mar 6, 2023
@tnakamot
Copy link
Collaborator

tnakamot commented Mar 6, 2023

Hi, thank you your additional ideas for the properties and custom handles. They were moved to separate issues as I want to have one topic in one issue: Issue #2 and Issue #3 .

I like both of your ideas. I think that adding "properties" is a good idea, and I would like to include your modification in my source tree, so please make a pull request. For non-standard handles, treading them as DoumentObject is probably good, but I think more consideration would be necessary as in my comments in Issue #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants