-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: VERSION conf/buildout.cfg docs/changelog.rst docs/conf.py geotrek/common/parsers.py geotrek/common/templates/common/parser_report.txt geotrek/trekking/locale/fr/LC_MESSAGES/django.po install.sh setup.py
- Loading branch information
Showing
124 changed files
with
3,908 additions
and
1,026 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ local/ | |
bootstrap.py | ||
/.buildout | ||
geotrek/settings/custom.py | ||
/parsers.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.35.1 | ||
2.0.0.dev0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
try: | ||
import importlib | ||
importlib.import_module('parsers') | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ eggs += | |
pydot | ||
pyparsing | ||
|
||
unzip=true | ||
|
||
[bpython] | ||
recipe = zc.recipe.egg:scripts | ||
eggs = ${buildout:eggs} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from __future__ import absolute_import | ||
|
||
import os | ||
|
||
from celery import Celery | ||
|
||
# set the default Django settings module for the 'celery' program. | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geotrek.settings.default') | ||
|
||
from django.conf import settings | ||
|
||
app = Celery('geotrek') | ||
|
||
# Using a string here means the worker will not have to | ||
# pickle the object when using Windows. | ||
app.config_from_object('django.conf:settings') | ||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) | ||
|
||
|
||
@app.task(bind=True) | ||
def debug_task(self): | ||
print('Request: {0!r}'.format(self.request)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import re | ||
|
||
from django.utils import translation | ||
from django.utils.datastructures import SortedDict | ||
from django.utils.translation.trans_real import get_supported_language_variant | ||
|
||
|
||
language_code_prefix_re = re.compile(r'^/api/([\w-]+)(/|$)') | ||
|
||
|
||
def get_language_from_path(path): | ||
from django.conf import settings | ||
supported = SortedDict(settings.LANGUAGES) | ||
regex_match = language_code_prefix_re.match(path) | ||
if not regex_match: | ||
return None | ||
lang_code = regex_match.group(1) | ||
try: | ||
return get_supported_language_variant(lang_code, supported) | ||
except LookupError: | ||
return None | ||
|
||
|
||
class APILocaleMiddleware(object): | ||
|
||
def process_request(self, request): | ||
language = get_language_from_path(request.path_info) | ||
if language: | ||
translation.activate(language) | ||
request.LANGUAGE_CODE = translation.get_language() |
Oops, something went wrong.