-
Notifications
You must be signed in to change notification settings - Fork 2
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
7 creating and describing caldav functions #34
base: main
Are you sure you want to change the base?
Conversation
…-functions' into 7-creating-and-describing-caldav-functions # Conflicts: # Documentation/CalDav_description.md
Code/TaskPlanner/CalDav_functions.py
Outdated
) as client: | ||
|
||
## Первый шаг для связи с сервером. | ||
## This will cause communication with the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Часть комментариев на английском, часть на русском. Так быть не должно
my_new_calendar.delete() | ||
|
||
|
||
def calendar_by_url_demo(client, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что делает этот метод? Из описания ничего не понятно
import caldav | ||
|
||
## Данные о календаре и пользователе: URL календаря (взят в настройках GOOGLE календаря), имя пользователя и пароль | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Примеры не покрывают все возможные варианты использования. Их приведу ниже
Code/TaskPlanner/CalDav_functions.py
Outdated
ical_fragment="""DTSTART;VALUE=DATE:20201213 | ||
DUE;VALUE=DATE:20201220 | ||
SUMMARY:Chop down a tree and drag it into the living room | ||
RRULE:FREQ=YEARLY | ||
PRIORITY: 2 | ||
CATEGORIES: outdoor""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что означают все эти поля? Почему не описано, не прокомментировано?
Documentation/CalDav_description.md
Outdated
# Основные функции CalDav для работы с календарём | ||
|
||
Настройка клиентского объекта *caldav* и *principal* объекта: | ||
```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bash это настройка для bash
. Для python
, а код ты написал на python, надо использовать python
```bash | ||
my_new_calendar = my_principal.make_calendar(name="Test calendar") | ||
``` | ||
Можно извлечь календарь с известным URL-адресом, не проходя через *principal*: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что значит principal
? Что значит не проходя через него? Из своего опыта я могу только догадаться, что это данные о пользователе, что прошел авторизацию. Как можно извлечь календарь в таком случае?
``` | ||
Извлечение календарей: | ||
```bash | ||
calendars = my_principal.calendars() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А что делать, если нужен конкретный?
Создание списка задач: | ||
```bash | ||
my_new_tasklist = my_principal.make_calendar( | ||
name="Test tasklist", supported_calendar_component_set=['VTODO']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supported_calendar_component_set=['VTODO']
, что это означает?
ics = "RRULE:FREQ=YEARLY", | ||
summary="Поход по магазинам", | ||
dtstart=date(2023, 4, 1), | ||
due=date(2023,4,2), | ||
categories=['family', 'finance'], | ||
status='NEEDS-ACTION') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ics
и status
, что это за параметры метода? Это должно быть описано, особенно, если они явно технические, некие константы CalDAV, как тут. Или почему они выглядят так?
Где сам текст TODO выставляется? Или summary это не только заголовок, но и текст?
``` | ||
Отметка о выполнении задачи: | ||
```bash | ||
todos[0].complete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если я захочу не по индексу, как это сделать? С точки зрения программиста, это неудобно. Если нам нужно будет отметить задачу, то явно мы не будет знать ее индекс в коллекции
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
других вариантов в документации не нашёл
```bash | ||
todos = my_new_calendar.search( | ||
start=datetime(2023, 1, 1), end=datetime(2024, 1, 1), | ||
compfilter='VTODO',event=True, expand=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что означают все три эти параметра?
```bash | ||
class caldav.davclient.DAVClient(url, proxy=None, username=None, | ||
password=None, auth=None, timeout=None, | ||
ssl_verify_cert=True, ssl_cert=None, headers={}, huge_tree=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что значит huge_tree
? А остальные параметры тут? Почему auth=None
? Почему у нас в одной строке сертификат ssl равен None, но в то же время проверка сертификата выставлена?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
конкретного описания всех параметров не нашёл, но часть описал
Базовый клиент для webdav, использует библиотеку запросов; предоставляет доступ к низкоуровневым операциям с сервером caldav. | ||
### Функции DAV client | ||
```bash | ||
calendar(**kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что обозначает данный параметр? Как я понимаю, это нечто дефолтное, от питона как переменное количество аргументов. Что туда можно передать? И для чего?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил в описание функции
Закрывает сессию объекта DAVClient. | ||
|
||
```bash | ||
delete(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если мы при создании объекта, указываем url, то зачем он тут? Он означает что то другое?
Отправьте запрос на удаление. | ||
|
||
```bash | ||
post(url, body, headers={}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что значит публикация? Добавление в календарь? Что такое body? Тело в виде JSON
? А headers
что это? Заголовки как в HTTP протоколе?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не уверен, что нам это понадобится.
Это http-запросы: get, put, post, delete.
Отправляет запрос на публикацию. | ||
|
||
```bash | ||
principal(*largs, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Совершенно непонятно что стоит передавать в параметры, чтобы использовать этот метод
Documentation/CalDav_description.md
Outdated
|
||
• url: url для корня propfind. | ||
|
||
• props = (xml запрос), нужные нам свойства |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что такое "xml запрос"? Как он выглядит? Приведи пример ниже, так будет лучше
Documentation/CalDav_description.md
Outdated
```bash | ||
propfind(url=None, props=”, depth=0) | ||
``` | ||
Отправляет запрос на propfind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что такое propfind?
Documentation/CalDav_description.md
Outdated
|
||
• props = (xml запрос), нужные нам свойства | ||
|
||
• depth: максимальная глубина рекурсии |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В каком плане рекурсия? Для чего она? Поиск по подзадачам?
Documentation/CalDav_description.md
Outdated
proppatch(url, body, dummy=None) | ||
``` | ||
Отправляет запрос на proppatch. | ||
|
||
• url: url for the root of the propfind. | ||
|
||
• body: XML propertyupdate запрос | ||
|
||
• dummy: compatibility parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Те же замечания, что и к вышенаписанному методу
Documentation/CalDav_description.md
Outdated
```bash | ||
put(url, body, headers={}) | ||
``` | ||
Отправляет запрос на put. | ||
|
||
```bash | ||
report(url, query=”, depth=0) | ||
``` | ||
Отправляет запрос на report. | ||
|
||
• url: url for the root of the propfind. | ||
|
||
• query: XML request | ||
|
||
• depth: maximum recursion depth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вновь те же самые замечания. Не понятно что это, непонятно как это использовать
Documentation/CalDav_description.md
Outdated
```bash | ||
request(url, method=’GET’, body=”, headers={}) | ||
``` | ||
Фактически отправляет запрос и выполняет аутентификацию |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что значит аутентификацию? Как я понимаю, нужно для этого предоставить логин и пароль. Где это выставляется? Что обозначают все эти параметры?
### Функции Calendar | ||
|
||
```bash | ||
add_todo(ical=None, no_overwrite=False, no_create=False, **ical_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Напиши пример, а то не ясно как это работает, как данные отправить
```bash | ||
freebusy_request(start, end) | ||
``` | ||
Выполняет поиск по календарю, но возвращает только информацию о free/busy (занят или нет). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что значит занят? Как я понимаю, это не то, что нам нужно
```bash | ||
get_supported_components() | ||
``` | ||
Возвращает список типов компонентов, поддерживаемых календарем, в строковом формате (typically [‘VJOURNAL’, ‘VTODO’, ‘VEVENT’]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что такое компонент? Тип? Думаю, что нам это не надо
```bash | ||
objects(sync_token=None, load_objects=False) | ||
``` | ||
Этот метод вернет все объекты в календаре, если sync_token не передан или если sync_token неизвестен серверу. Если передан synctoken, известный серверу, он вернет объекты, которые были добавлены, удалены или изменены с момента последней установки токена синхронизации. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Откуда sync_token
берется? Как его получить?
```bash | ||
save() | ||
``` | ||
Метод сохранения календаря пока используется только для его создания. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Метод для сохранения, что используется дя создания? О_о
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, это так. Так написано в документации.
Метод сохранения календаря пока используется только для его создания. | ||
|
||
```bash | ||
save_todo(ical=None, no_overwrite=False, no_create=False, **ical_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше всего добавить примеры
Documentation/CalDav_description.md
Outdated
add_attendee(attendee, no_default_parameters=False, **parameters) | ||
``` | ||
Для текущего (события/задачи/журнала) добавляет участника. | ||
|
||
Участником может быть любой из следующих: | ||
* *A principal * An email address prepended with “mailto:” | ||
* *An email address without the “mailto:”-prefix * A two-item tuple containing a common name and an email address * | ||
|
||
Может быть задано любое количество параметров участника, они будут использоваться по умолчанию, если для параметра no_default_parameters не установлено значение True: | ||
|
||
partstat=NEEDS-ACTION cutype=UNKNOWN (unless a principal object is given) rsvp=TRUE role=REQ-PARTICIPANT schedule-agent is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю, что нам это не нужно. Мы не будем делать исполняющих
Documentation/CalDav_description.md
Outdated
### Функции Principal | ||
|
||
```bash | ||
calendar(name=None, cal_id=None, cal_url=None) | ||
``` | ||
Метод calendar вернет объект calendar. Он не будет инициировать никакой связи с сервером. | ||
|
||
```bash | ||
calendar_user_address_set() | ||
``` | ||
defined in RFC6638 | ||
|
||
```bash | ||
calendars() | ||
``` | ||
Возвращает principials календари. | ||
|
||
```bash | ||
get_vcal_address() | ||
``` | ||
Возвращает principal как объект icalendar.vCalAddress | ||
|
||
```bash | ||
make_calendar(name=None, cal_id=None, supported_calendar_component_set=None) | ||
``` | ||
Удобный метод, обходит объект self.calendar_home_set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю тут лучше побольше примеров работы поискать, а то не очень понятно как использовать
Documentation/CalDav_description.md
Outdated
## Класс Free Busy | ||
|
||
```bash | ||
class caldav.objects.FreeBusy(parent, data, url=None, id=None) | ||
``` | ||
Объект FreeBusy используется для представления freebusyresponse с сервера. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Для чего это?
@gilevyaroslav Провел первоначальное ревью. Из самого главного, комментарии на разных языках, часто они очень скудные, непонятно как пользоваться этим. И нужно побольше примеров. Прошу подправить как можно быстрее, так как от этой задачи зависит дальнейшая работа всей команды |
@gilevyaroslav Каков статус задачи? Хочется понять когда примерно будут правки |
@Lailes Могу перевод и мелкие правки выгрузить сегодня, а с примерами всё неоднозначно. |
В каком плане, все неоднозначно? Закоммить пока перевод пока тогда |
…tion of the add_attendee function.
…-functions' into 7-creating-and-describing-caldav-functions # Conflicts: # Code/TaskPlanner/CalDav_functions.py # Documentation/CalDav_description.md
@gilevyaroslav Удали файл с кодом пожалуйста. Он не нужен |
@Dary5 Почему диаграмма переходов находится в этой ветке? По ошибке может? Как я понимаю, она не должна быть тут. Лучше её перенести в другую ветку, чтобы не потерять |
понятия не имею как она тут оказалась, потому что из своей ветки я давным-давно её смержила с мейном, сейчас она в мейне лежит |
e7732bb
to
f1d07c7
Compare
Task merge request
#7
Нет
Code changes
How to test