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

🌈 move constants and library out #296

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sync_telegram/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"summary": """Telegram integration powered by Sync Studio""",
"category": "Discuss",
"images": ["images/sync_telegram.jpg"],
"version": "14.0.3.2.1",
"version": "14.0.3.2.2",
"application": False,
"author": "IT Projects Labs, Ilya Ilchenko",
"support": "[email protected]",
Expand Down
8 changes: 7 additions & 1 deletion sync_telegram/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
`3.2.2`
-------

- **Improvement:** code clean up

`3.2.1`
-------

**Improvement:** In cases when there are many subscribed partners channel name was too long
- **Improvement:** In cases when there are many subscribed partners channel name was too long


`3.2.0`
-------
Expand Down
26 changes: 10 additions & 16 deletions sync_telegram/models/sync_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@
import logging

import requests
from lxml.html.clean import Cleaner
from telegram import ( # pylint: disable=missing-manifest-dependency; disabled because pre-commit cannot find external dependency in manifest. https://github.com/itpp-labs/DINAR/issues/91
Bot,
Update,
)

from odoo import api, fields, models
from odoo.tools import html2plaintext

from odoo.addons.sync.models.sync_project import AttrDict

_logger = logging.getLogger(__name__)

MAX_SIZE_IMAGE = 10485760
MAX_SIZE_DOCUMENT = 52428800
MAX_SIZE_TO_DOWNLOAD = 20971520


class SyncProjectTelegram(models.Model):

Expand All @@ -32,26 +42,10 @@ def _eval_context_telegram(self, secrets, eval_context):
* telegram.setWebhook
* telegram.parse_data
"""
from lxml.html.clean import Cleaner

from odoo.tools import html2plaintext

try:
# https://github.com/python-telegram-bot/python-telegram-bot
from telegram import ( # pylint: disable=missing-manifest-dependency
Bot,
Update,
)
except (ImportError, IOError) as err:
_logger.debug(err)

log_transmission = eval_context["log_transmission"]
log = eval_context["log"]

MAX_SIZE_IMAGE = 10485760
MAX_SIZE_DOCUMENT = 52428800
MAX_SIZE_TO_DOWNLOAD = 20971520

if secrets.TELEGRAM_BOT_TOKEN:
bot = Bot(token=secrets.TELEGRAM_BOT_TOKEN)
else:
Expand Down