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:  Ready For Test
Privacy:  Public Assigned to:  tumashu
Open/Closed:  Open Release:  4.2.0
Module:  health_caldav Component:  Hospital Management

Jump to the original submission

Fri 14 Jul 2023 04:56:22 PM UTC, comment #11: 

pywebdav3-gnuhealth 0.12.0

Updated and clean up setup.py // MANIFEST.in // PEP8


changeset:   12:0f4179086f2f
tag:         tip
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 17:45:04 2023 +0100
summary:     Remove obsolete PKG-INFO and setup.cfg

changeset:   11:854a5f36280c
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 17:41:14 2023 +0100
summary:     Version 0.12.0 - Include version and README.rst in MANIFEST.in

changeset:   10:339fa0d25b5a
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 17:39:04 2023 +0100
summary:     Use standard open method. Remove import io

changeset:   9:64b3477b2d8f
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 17:17:20 2023 +0100
summary:     Include version keyword argument

changeset:   8:6bc5b090ac68
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 17:11:13 2023 +0100
summary:     Cleanup setup.py // PEP8

changeset:   7:2dcbb3a60133
user:        Luis Falcon <falcon@gnuhealth.org>
date:        Fri Jul 14 16:43:57 2023 +0100
summary:     Update Changes file


Luis Falcon <meanmicio>
Group administrator
Fri 14 Jul 2023 10:23:57 AM UTC, comment #10: 

Great! Nice to have by default UTF-8 strings :)

I'll test it this weekend and release the new patch release on health-pywebdav3-server

Have a great weekend!
Luis

Luis Falcon <meanmicio>
Group administrator
Thu 13 Jul 2023 04:23:40 AM UTC, comment #9: 

thunderbird and evolution work now, we need to release health-pywebdav3-server 0.11.0

1. https://hg.savannah.gnu.org/hgweb/health/rev/31634a6e925f
2. https://hg.savannah.gnu.org/hgweb/health-pywebdav3-server/rev/a48107a43dcb

Feng Shu <tumashu>
Wed 12 Jul 2023 11:02:05 AM UTC, comment #8: 

Probably Thunderbird changed things related to the API. That is a pity because it used to work. I'm sure we can update the code and make it work.

Otherwise, we can use Evolution or cadaver client.


comment #7:

> At the moment, evolution works, but thunderbird does not work, and can not sync
>
> > 79e8ee07 health_webdav3_server: Fix res UnboundLocalError             Feng 2023-07-12
> > 1524839c Fix time.gmtime(d) error: 'decimal.Decimal' object cannot be ... Feng 2023-07-12
> > dae3be9b Caldav: Fix Exception 'int' object is not iterable error         Feng 2022-08-01
> > d07d8592 health_caldav: use summary as rec_name of event                  Feng 2022-07-30
> > fd4ca4c1 health_caldav/calendar_.py: fix attendee encode and decode issue Feng 2022-07-29
> > d1f84c9b Caldav: set depth to '1' in do_REPORT when no value is found.    Feng 2022-07-29
> > 4b8c95a6 webdav3_server/webdav.py: import socket                          Feng 2022-07-28
> > 1fc5fb7b Improve health_caldav logger about patient appointment.          Feng 2022-07-22
>

Luis Falcon <meanmicio>
Group administrator
Wed 12 Jul 2023 09:40:25 AM UTC, comment #7: 

At the moment, evolution works, but thunderbird does not work, and can not sync

> 79e8ee07 health_webdav3_server: Fix res UnboundLocalError             Feng 2023-07-12
> 1524839c Fix time.gmtime(d) error: 'decimal.Decimal' object cannot be ... Feng 2023-07-12
> dae3be9b Caldav: Fix Exception 'int' object is not iterable error         Feng 2022-08-01
> d07d8592 health_caldav: use summary as rec_name of event                  Feng 2022-07-30
> fd4ca4c1 health_caldav/calendar_.py: fix attendee encode and decode issue Feng 2022-07-29
> d1f84c9b Caldav: set depth to '1' in do_REPORT when no value is found.    Feng 2022-07-29
> 4b8c95a6 webdav3_server/webdav.py: import socket                          Feng 2022-07-28
> 1fc5fb7b Improve health_caldav logger about patient appointment.          Feng 2022-07-22


Feng Shu <tumashu>
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>
Group 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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-14 meanmicio Assigned toteffalump tumashu
        Release4.0.0 4.2.0
    2023-07-13 tumashu StatusIn Progress Ready For Test
    2023-07-12 meanmicio Assigned toNone teffalump
    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.13-f8d8.
    Corresponding source code