Skip to content

Commit

Permalink
refromat code via black
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Oct 17, 2024
1 parent ee41d72 commit 5b3da41
Showing 1 changed file with 136 additions and 141 deletions.
277 changes: 136 additions & 141 deletions server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,147 +17,147 @@
from ntb.io.feed_parsers import stt_newsml # NOQA
from content_api.app.settings import CONTENTAPI_INSTALLED_APPS
from superdesk.default_settings import (
HTML_TAGS_WHITELIST as _HTML_TAGS_WHITELIST, strtobool, CORE_APPS as _CORE_APPS, env
HTML_TAGS_WHITELIST as _HTML_TAGS_WHITELIST,
strtobool,
CORE_APPS as _CORE_APPS,
env,
)


ABS_PATH = os.path.abspath(os.path.dirname(__file__))
INIT_DATA_PATH = os.path.join(ABS_PATH, 'data')
LOCATORS_DATA_FILE = os.path.join(ABS_PATH, 'data', 'locators.json')
INIT_DATA_PATH = os.path.join(ABS_PATH, "data")
LOCATORS_DATA_FILE = os.path.join(ABS_PATH, "data", "locators.json")


# make sure db auth is not included
CORE_APPS = [app for app in _CORE_APPS if app != 'apps.auth.db']
CORE_APPS = [app for app in _CORE_APPS if app != "apps.auth.db"]


INSTALLED_APPS = [
'apps.auth',
'apps.auth.db.commands',
'superdesk.auth.oauth',
'superdesk.roles',
'ntb.scanpix',
'planning',
'ntb.io',
'ntb.io.feeding_services.newsworthy',
'ntb.publish',
'ntb.ping_scanpix',
'ntb.mediatopics_to_subject_mapping',

'superdesk.users',
'superdesk.upload',
'superdesk.sequences',
'superdesk.notification',
'superdesk.activity',
'superdesk.vocabularies',
'superdesk.profiling',
'superdesk.backend_meta',
'apps.comments',

'superdesk.io',
'superdesk.io.feeding_services',
'superdesk.io.feed_parsers',
'superdesk.io.subjectcodes',
'superdesk.io.iptc',
'apps.io',
'apps.io.feeding_services',
'superdesk.publish',
'superdesk.commands',
'superdesk.locators',

'apps.auth',
'apps.archive',
'apps.stages',
'apps.desks',
'apps.tasks',
'apps.preferences',
'apps.spikes',
'apps.prepopulate',
'apps.legal_archive',
'apps.search',
'apps.saved_searches',
'apps.privilege',
'apps.rules',
'apps.highlights',
'apps.products',
'apps.publish',
'apps.publish.enqueue',
'apps.publish.formatters',
'apps.content_filters',
'apps.content_types',
'apps.dictionaries',
'apps.duplication',
'apps.spellcheck',
'apps.templates',
'apps.archived',
'apps.validators',
'apps.validate',
'apps.workspace',
'apps.macros',
'apps.archive_broadcast',
'apps.search_providers',
'apps.feature_preview',
'apps.workqueue',
'apps.picture_crop',
'apps.languages',

'ntb.macros',
'ntb.push_content_notification',

'superdesk.text_checkers.ai.imatrics',
"apps.auth",
"apps.auth.db.commands",
"superdesk.auth.oauth",
"superdesk.roles",
"ntb.scanpix",
"planning",
"ntb.io",
"ntb.io.feeding_services.newsworthy",
"ntb.publish",
"ntb.ping_scanpix",
"ntb.mediatopics_to_subject_mapping",
"superdesk.users",
"superdesk.upload",
"superdesk.sequences",
"superdesk.notification",
"superdesk.activity",
"superdesk.vocabularies",
"superdesk.profiling",
"superdesk.backend_meta",
"apps.comments",
"superdesk.io",
"superdesk.io.feeding_services",
"superdesk.io.feed_parsers",
"superdesk.io.subjectcodes",
"superdesk.io.iptc",
"apps.io",
"apps.io.feeding_services",
"superdesk.publish",
"superdesk.commands",
"superdesk.locators",
"apps.auth",
"apps.archive",
"apps.stages",
"apps.desks",
"apps.tasks",
"apps.preferences",
"apps.spikes",
"apps.prepopulate",
"apps.legal_archive",
"apps.search",
"apps.saved_searches",
"apps.privilege",
"apps.rules",
"apps.highlights",
"apps.products",
"apps.publish",
"apps.publish.enqueue",
"apps.publish.formatters",
"apps.content_filters",
"apps.content_types",
"apps.dictionaries",
"apps.duplication",
"apps.spellcheck",
"apps.templates",
"apps.archived",
"apps.validators",
"apps.validate",
"apps.workspace",
"apps.macros",
"apps.archive_broadcast",
"apps.search_providers",
"apps.feature_preview",
"apps.workqueue",
"apps.picture_crop",
"apps.languages",
"ntb.macros",
"ntb.push_content_notification",
"superdesk.text_checkers.ai.imatrics",
]

RENDITIONS = {
'picture': {
'thumbnail': {'width': 220, 'height': 120},
'viewImage': {'width': 640, 'height': 640},
'baseImage': {'width': 1400, 'height': 1400},
"picture": {
"thumbnail": {"width": 220, "height": 120},
"viewImage": {"width": 640, "height": 640},
"baseImage": {"width": 1400, "height": 1400},
},
"avatar": {
"thumbnail": {"width": 60, "height": 60},
"viewImage": {"width": 200, "height": 200},
},
'avatar': {
'thumbnail': {'width': 60, 'height': 60},
'viewImage': {'width': 200, 'height': 200},
}
}

MACROS_MODULE = env('MACROS_MODULE', 'ntb.macros')
MACROS_MODULE = env("MACROS_MODULE", "ntb.macros")

WS_HOST = env('WSHOST', '0.0.0.0')
WS_PORT = env('WSPORT', '5100')
WS_HOST = env("WSHOST", "0.0.0.0")
WS_PORT = env("WSPORT", "5100")

# Determines if the ODBC publishing mechanism will be used, If enabled then pyodbc must be installed along with it's
# dependencies
ODBC_PUBLISH = env('ODBC_PUBLISH', None)
ODBC_PUBLISH = env("ODBC_PUBLISH", None)
# ODBC test server connection string
ODBC_TEST_CONNECTION_STRING = env('ODBC_TEST_CONNECTION_STRING',
'DRIVER=FreeTDS;DSN=NEWSDB;UID=???;PWD=???;DATABASE=News')
ODBC_TEST_CONNECTION_STRING = env(
"ODBC_TEST_CONNECTION_STRING",
"DRIVER=FreeTDS;DSN=NEWSDB;UID=???;PWD=???;DATABASE=News",
)

DEFAULT_SOURCE_VALUE_FOR_MANUAL_ARTICLES = 'NTB'
DEFAULT_SOURCE_VALUE_FOR_MANUAL_ARTICLES = "NTB"
DEFAULT_URGENCY_VALUE_FOR_MANUAL_ARTICLES = 3
DEFAULT_GENRE_VALUE_FOR_MANUAL_ARTICLES = []

# This value gets injected into NewsML 1.2 and G2 output documents.
NEWSML_PROVIDER_ID = 'ntb.no'
ORGANIZATION_NAME = env('ORGANIZATION_NAME', 'NTB')
ORGANIZATION_NAME_ABBREVIATION = env('ORGANIZATION_NAME_ABBREVIATION', 'NTB')

AMAZON_CONTAINER_NAME = env('AMAZON_CONTAINER_NAME', '')
AMAZON_ACCESS_KEY_ID = env('AMAZON_ACCESS_KEY_ID', '')
AMAZON_SECRET_ACCESS_KEY = env('AMAZON_SECRET_ACCESS_KEY', '')
AMAZON_REGION = env('AMAZON_REGION', 'us-east-1')
AMAZON_SERVE_DIRECT_LINKS = env('AMAZON_SERVE_DIRECT_LINKS', False)
AMAZON_S3_USE_HTTPS = env('AMAZON_S3_USE_HTTPS', False)

is_testing = os.environ.get('SUPERDESK_TESTING', '').lower() == 'true'
NEWSML_PROVIDER_ID = "ntb.no"
ORGANIZATION_NAME = env("ORGANIZATION_NAME", "NTB")
ORGANIZATION_NAME_ABBREVIATION = env("ORGANIZATION_NAME_ABBREVIATION", "NTB")

AMAZON_CONTAINER_NAME = env("AMAZON_CONTAINER_NAME", "")
AMAZON_ACCESS_KEY_ID = env("AMAZON_ACCESS_KEY_ID", "")
AMAZON_SECRET_ACCESS_KEY = env("AMAZON_SECRET_ACCESS_KEY", "")
AMAZON_REGION = env("AMAZON_REGION", "us-east-1")
AMAZON_SERVE_DIRECT_LINKS = env("AMAZON_SERVE_DIRECT_LINKS", False)
AMAZON_S3_USE_HTTPS = env("AMAZON_S3_USE_HTTPS", False)

is_testing = os.environ.get("SUPERDESK_TESTING", "").lower() == "true"
ELASTICSEARCH_FORCE_REFRESH = is_testing
ELASTICSEARCH_AUTO_AGGREGATIONS = False
SIGN_OFF_MAPPING = 'email'
DEFAULT_CONTENT_TYPE = 'Standard'
DEFAULT_LANGUAGE = 'nb-NO'
SIGN_OFF_MAPPING = "email"
DEFAULT_CONTENT_TYPE = "Standard"
DEFAULT_LANGUAGE = "nb-NO"
GENERATE_SHORT_GUID = True
LANGUAGES = [
{'language': 'nb-NO', 'label': 'Bokmål', 'source': True, 'destination': False},
{'language': 'nn-NO', 'label': 'Nynorsk', 'source': False, 'destination': True},
{'language': 'en', 'label': 'English', 'source': False, 'destination': False},
{'language': 'de', 'label': 'German', 'source': False, 'destination': False}
{"language": "nb-NO", "label": "Bokmål", "source": True, "destination": False},
{"language": "nn-NO", "label": "Nynorsk", "source": False, "destination": True},
{"language": "en", "label": "English", "source": False, "destination": False},
{"language": "de", "label": "German", "source": False, "destination": False},
]

# NTB NITF specific behaviour
Expand All @@ -167,7 +167,7 @@

NO_TAKES = True

FTP_TIMEOUT = int(env('SUPERDESK_FTP_TIMEOUT', 10))
FTP_TIMEOUT = int(env("SUPERDESK_FTP_TIMEOUT", 10))

#: after how many minutes consider content to be too old for ingestion
INGEST_OLD_CONTENT_MINUTES = 1
Expand All @@ -180,27 +180,22 @@
SESSION_EXPIRY_MINUTES = 12 * 60

NIFS_STAGE_MAP = {
6: 'Eliteserien menn',
682936: 'Eliteserien menn',
679874: 'Eliteserien menn',
679873: '1. divisjon menn',
682948: '1. divisjon menn'
6: "Eliteserien menn",
682936: "Eliteserien menn",
679874: "Eliteserien menn",
679873: "1. divisjon menn",
682948: "1. divisjon menn",
}
NIFS_QCODE_MAP = {
1: '15054000', # Fotball
2: '15031000', # Ishockey
3: '15029000', # Håndball
4: '15076000' # Bandy
1: "15054000", # Fotball
2: "15031000", # Ishockey
3: "15029000", # Håndball
4: "15076000", # Bandy
}

NIFS_SPORT_MAP = {
1: 'Fotball',
2: 'Ishockey',
3: 'Håndball',
4: 'Bandy'
}
NIFS_SPORT_MAP = {1: "Fotball", 2: "Ishockey", 3: "Håndball", 4: "Bandy"}

PLANNING_EXPORT_BODY_TEMPLATE = '''
PLANNING_EXPORT_BODY_TEMPLATE = """
{% for item in items %}
<h2>{{ item.name or item.headline or item.slugline }}</h2>
<p>{{ item.description_text or '' }}
Expand All @@ -220,7 +215,7 @@
{% endif %}
<p></p>
{% endfor %}
'''
"""

PUBLISH_QUEUE_EXPIRY_MINUTES = 60 * 24 * 7 # 7d

Expand Down Expand Up @@ -252,28 +247,28 @@
},
}

SCANPIX_PING_OWNER = env('SCANPIX_PING_OWNER')
SCANPIX_PING_USERNAME = env('SCANPIX_PING_USERNAME')
SCANPIX_PING_PASSWORD = env('SCANPIX_PING_PASSWORD')
SCANPIX_PING_OWNER = env("SCANPIX_PING_OWNER")
SCANPIX_PING_USERNAME = env("SCANPIX_PING_USERNAME")
SCANPIX_PING_PASSWORD = env("SCANPIX_PING_PASSWORD")

CONTENTAPI_INSTALLED_APPS += (
'ntb.content_api_rss',
)
CONTENTAPI_INSTALLED_APPS += ("ntb.content_api_rss",)

HIGH_PRIORITY_QUEUE_ENABLED = True

PLANNING_EVENT_TEMPLATES_ENABLED = True

HTML_TAGS_WHITELIST = _HTML_TAGS_WHITELIST + ('a', 'table', 'tbody', 'tr', 'td', 'th')
HTML_TAGS_WHITELIST = _HTML_TAGS_WHITELIST + ("a", "table", "tbody", "tr", "td", "th")

# if google auth is not configured enable password auth
google_confs = [os.environ.get(conf) for conf in ('GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET')]
if not all(google_confs) or os.environ.get('SUPERDESK_AUTH'):
INSTALLED_APPS.append('apps.auth.db')
google_confs = [
os.environ.get(conf) for conf in ("GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET")
]
if not all(google_confs) or os.environ.get("SUPERDESK_AUTH"):
INSTALLED_APPS.append("apps.auth.db")

SCHEMA_VERSION = 1

IMATRICS_SUBJECT_SCHEME = 'topics'
IMATRICS_SUBJECT_SCHEME = "topics"

AMAZON_SQS_REGION = env("AMAZON_SQS_REGION")
AMAZON_SQS_QUEUE_NAME = env("AMAZON_SQS_QUEUE_NAME")
Expand Down Expand Up @@ -309,4 +304,4 @@

NTB_IPTC_SEQUENCE = strtobool(env("NTB_IPTC_SEQUENCE", "off"))

OMSETT_API_TOKEN = env('OMSETT_API_TOKEN', "")
OMSETT_API_TOKEN = env("OMSETT_API_TOKEN", "")

0 comments on commit 5b3da41

Please sign in to comment.