Skip to content

Commit

Permalink
Runs black
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 8, 2020
1 parent 7e93238 commit 426ee13
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 35 deletions.
20 changes: 11 additions & 9 deletions geoportal/geomapfish_geoportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ def main(global_config, **settings):
del global_config # Unused

config = Configurator(
root_factory=Root, settings=settings,
root_factory=Root,
settings=settings,
locale_negotiator=locale_negotiator,
authentication_policy=create_authentication(settings)
authentication_policy=create_authentication(settings),
)

# Workaround to not have the error: distutils.errors.DistutilsArgError: no commands supplied
distutils.core._setup_stop_after = 'config'
config.include('c2cgeoportal_geoportal')
distutils.core._setup_stop_after = "config"
config.include("c2cgeoportal_geoportal")
distutils.core._setup_stop_after = None

config.add_translation_dirs('geomapfish_geoportal:locale/')
config.add_translation_dirs("geomapfish_geoportal:locale/")

# Scan view decorator for adding routes
config.scan()
Expand All @@ -33,14 +34,15 @@ def main(global_config, **settings):
for interface in config.get_settings().get("interfaces", []):
add_interface(
config,
interface['name'],
interface.get('type', INTERFACE_TYPE_NGEO),
default=interface.get('default', False)
interface["name"],
interface.get("type", INTERFACE_TYPE_NGEO),
default=interface.get("default", False),
)

try:
import ptvsd
ptvsd.enable_attach(address=('172.17.0.1', 5678))

ptvsd.enable_attach(address=("172.17.0.1", 5678))
# ptvsd.wait_for_attach()
except ModuleNotFoundError as e:
pass
Expand Down
2 changes: 1 addition & 1 deletion geoportal/geomapfish_geoportal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

from c2cgeoportal_commons.models.main import * # noqa

_ = TranslationStringFactory('geomapfish-server')
_ = TranslationStringFactory("geomapfish-server")
LOG = logging.getLogger(__name__)
16 changes: 8 additions & 8 deletions geoportal/geomapfish_geoportal/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@


# use two translator to translate each strings in Make
tsf_server = TranslationStringFactory('geomapfish-server')
tsf_geoportal = TranslationStringFactory('c2cgeoportal')
tsf_admin = TranslationStringFactory('c2cgeoportal_admin')
tsf_c2cgeoform = TranslationStringFactory('c2cgeoform')
tsf_server = TranslationStringFactory("geomapfish-server")
tsf_geoportal = TranslationStringFactory("c2cgeoportal")
tsf_admin = TranslationStringFactory("c2cgeoportal_admin")
tsf_c2cgeoform = TranslationStringFactory("c2cgeoform")


@subscriber(NewRequest)
Expand All @@ -17,7 +17,7 @@ def add_localizer(event):
localizer = get_localizer(request)

def auto_translate(string):
if request.path_info.startswith('/admin/'):
if request.path_info.startswith("/admin/"):
tsf_list = [tsf_admin, tsf_c2cgeoform]
else:
tsf_list = [tsf_server, tsf_geoportal]
Expand All @@ -33,7 +33,7 @@ def auto_translate(string):

@subscriber(BeforeRender)
def add_renderer_globals(event):
request = event.get('request')
request = event.get("request")
if request:
event['_'] = request.translate
event['localizer'] = request.localizer
event["_"] = request.translate
event["localizer"] = request.localizer
25 changes: 8 additions & 17 deletions geoportal/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,15 @@
from setuptools import find_packages, setup

setup(
name='geomapfish_geoportal',
version='1.0',
description='geomapfish, a c2cgeoportal project',
author='geomapfish',
author_email='info@geomapfish.com',
url='https://www.geomapfish.com/',
install_requires=[
'c2cgeoportal_geoportal',
'c2cgeoportal_admin',
],
name="geomapfish_geoportal",
version="1.0",
description="geomapfish, a c2cgeoportal project",
author="geomapfish",
author_email="info@geomapfish.com",
url="https://www.geomapfish.com/",
install_requires=["c2cgeoportal_geoportal", "c2cgeoportal_admin",],
packages=find_packages(),
include_package_data=True,
zip_safe=False,
entry_points={
'paste.app_factory': [
'main = geomapfish_geoportal:main',
],
'console_scripts': [
],
},
entry_points={"paste.app_factory": ["main = geomapfish_geoportal:main",], "console_scripts": [],},
)

0 comments on commit 426ee13

Please sign in to comment.