mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-02-11 17:20:46 +01:00
2c8063cf4a
* fixed visualization * simplified tests * split into files * refactored test expected publications * split update tests * expanded specifications and tests * added event_status window tests * fixed 'all' command * renamed everything * fixed uppercase
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from dynaconf import Validator
|
|
|
|
|
|
telegram_validators = [
|
|
Validator("publisher.telegram.chat_id", must_exist=True),
|
|
Validator("publisher.telegram.msg_template_path", must_exist=True, default=None),
|
|
Validator("publisher.telegram.token", must_exist=True),
|
|
Validator("publisher.telegram.username", must_exist=True),
|
|
]
|
|
zulip_validators = []
|
|
mastodon_validators = []
|
|
twitter_validators = []
|
|
facebook_validators = []
|
|
|
|
publisher_name_to_validators = {
|
|
"telegram": telegram_validators,
|
|
"facebook": facebook_validators,
|
|
"twitter": twitter_validators,
|
|
"mastodon": mastodon_validators,
|
|
"zulip": zulip_validators,
|
|
}
|
|
publisher_names = publisher_name_to_validators.keys()
|
|
|
|
|
|
def get_active_publishers(settings):
|
|
return filter(
|
|
lambda publisher_name: settings["publisher"][publisher_name]["active"],
|
|
publisher_names,
|
|
)
|
|
|
|
|
|
def get_validators(settings):
|
|
active_publishers = get_active_publishers(settings)
|
|
validators = []
|
|
for publisher in active_publishers:
|
|
validators += publisher_name_to_validators[publisher]
|
|
return validators
|