bugGNU Health - Bugs: bug #62792, health_caldav do not work well...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62792: health_caldav do not work well with thunderbird and evolution

Submitter:  Feng Shu <tumashu>
Submitted:  Thu 21 Jul 2022 10:01:34 AM UTC
 
Category:  webdav Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  4.0.0
Module:  health_caldav Component:  Hospital Management

( Jump to the original submission )

Mon 01 Aug 2022 05:33:11 AM UTC, comment #6: 

patches tarball has been updated to v2, please see attachment, thunderbird seem to work well.

(file #53494)

Feng Shu <tumashu>
Thu 28 Jul 2022 11:48:25 PM UTC, comment #5: 

comment #4:

> Dear Feng Shu and Gerald
>
> It used to work in Thunderbird, under the same codebase, so I assume there might be some changes in the webdav client adopted by thunderbird that break the current implementation.
>
> I'll take a look at it in the next few days and get back to you.


Good news, the patches attached may help you find the problem easily :-)

>
> Best
> Luis

Feng Shu <tumashu>
Thu 28 Jul 2022 12:07:50 PM UTC, comment #4: 

Dear Feng Shu and Gerald

It used to work in Thunderbird, under the same codebase, so I assume there might be some changes in the webdav client adopted by thunderbird that break the current implementation.

I'll take a look at it in the next few days and get back to you.

Best
Luis

Luis Falcon <meanmicio>
Project Administrator
Thu 28 Jul 2022 05:33:15 AM UTC, comment #3: 

Let Evolution work have another problems, and seem to more than thunderbird's issue, At the moment, I can not let it work.

1. health_caldav/webdav.py

```
    def get_childs(cls, uri, filter=None, cache=None):
        pool = Pool()
        Calendar = pool.get('calendar.calendar')
        Event = pool.get('calendar.event')

        if uri in ('Calendars', 'Calendars/'):
            domain = cls._caldav_filter_domain_calendar(filter)
            domain = [['OR',
                    ('owner', '=', Transaction().user),
                    ('read_users', '=', Transaction().user),
                    ],
                domain]
            calendars = Calendar.search(domain)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this place, calendars is []

            if cache is not None:
                cache.setdefault('_calendar', {})
                cache['_calendar'].setdefault(Calendar.__name__, {})
                for calendar in calendars:
                    cache['_calendar'][Calendar.__name__][calendar.id] = {}
            return ([x.name for x in calendars]
                + [x.name + '.ics' for x in calendars])
```

2. /health-pywebdav3-server/pywebdav/lib/report.py

```
    def create_prop(self):
        """ handle a <prop> request

        This will

        1. set up the <multistatus>-Framework

        2. read the property values for each URI
           (which is dependant on the Depth header)
           This is done by the get_propvalues() method.

        3. For each URI call the append_result() method
           to append the actual <result>-Tag to the result
           document.

        We differ between "good" properties, which have been
        assigned a value by the interface class and "bad"
        properties, which resulted in an error, either 404
        (Not Found) or 403 (Forbidden).

        """

        # create the document generator
        doc = domimpl.createDocument(None, "multistatus", None)
        ms = doc.documentElement
        ms.setAttribute("xmlns:D", "DAV:")
        ms.tagName = 'D:multistatus'

        if self._depth=="0":
            if self._uri in self._dataclass.get_childs(get_parenturi(self._uri),
                    self.filter):
                gp,bp=self.get_propvalues(self._uri)
                res=self.mk_prop_response(self._uri,gp,bp,doc)
                ms.appendChild(res)

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  In this place, no proper response, maybe code logic error.

```

Feng Shu <tumashu>
Thu 28 Jul 2022 05:22:12 AM UTC, comment #2: 

I let thunderbird work again, please see attache patches. the approach is let uris in health_caldav, health_webdav3_server and health-pywebdav3-server always are string instead of byte.

The issues about Thunderbird are two:
1. health-pywebdav3-server/pywebdav/lib/report.py, the below code alway False, for self._uri is byte while get_childs are strings.

```
    if self._uri in self._dataclass.get_childs(get_parenturi(self._uri),

                    self.filter):
```

2. health-pywebdav3-server/pywebdav/lib/WebDAVServer.py, the below code will self.wfile.write DATA twice.

```
        if DATA:

            if (isinstance(DATA, bytes)):

                self.wfile.write(DATA)

            else:

                self.wfile.write(DATA.encode('utf-8'))

           

            if isinstance(DATA, str):

                log.debug("Don't use iterator")

                self.wfile.write(DATA.encode('utf-8'))

            else:

                if self._config.DAV.getboolean('http_response_use_iterator'):

                    # Use iterator to reduce using memory

                    log.debug("Use iterator")

                    for buf in DATA:

                        self.wfile.write(buf)

                        self.wfile.flush()

                else:

                    # Don't use iterator, it's a compatibility option

                    log.debug("Don't use iterator")

                    self.wfile.write(DATA)
```

(file #53478)

Feng Shu <tumashu>
Thu 21 Jul 2022 10:06:01 AM UTC, comment #1: 

When I use evolution, the below problem showed, what is ".well-known" db?

```
Exception occurred during processing of request from ('::1', 36726, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
    if not self.parse_request():
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 582, in parse_request
    if not self.get_userinfo(None, None, self.command):
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 590, in get_userinfo
    with Transaction().start(dbname, 0, close=True) as transaction:
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/transaction.py", line 107, in start
    database = backend.Database(database_name).connect()
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/backend/postgresql/database.py", line 230, in _new_
    inst._connpool = ThreadedConnectionPool(
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 161, in _init_
    AbstractConnectionPool.__init__(
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 59, in _init_
    self._connect()
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(*self._args, **self._kwargs)
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: 致命错误:  数据库 ".well-known" 不存在

```

Feng Shu <tumashu>
Thu 21 Jul 2022 10:01:34 AM UTC, original submission:  

I have tested caldav with thunderbird and evolution too,  I think both of them can not work well.
the events created in thunderbird and evolution can be found in gnuhealth-client, but events created in gnuhealth-client
can not be showed in thunderbird or evolution.

Feng Shu <tumashu>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by meanmicio (Posted a comment)
  • -email is unavailable- added by tumashu (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-01 tumashu Attached File- Added health-and-health-pywebdav3-server-patches-v2.tar, #53494
    2022-07-28 meanmicio StatusNone In Progress
        ReleaseNone 4.0.0
        ComponentNone Hospital Management
    2022-07-28 tumashu Attached File- Added health-and-health-pywebdav3-server-patches.tar, #53478

    Back to the top


    Powered by Savane 3.9