Skip to content

Commit

Permalink
Localization 1006 (#490)
Browse files Browse the repository at this point in the history
* LOCALIZATION-1006: adding new rules to regex.

* LOCALIZATION-1006: Fix in regex.

* LOCALIZATION-1006: FutureWarning fix.

* LOCALIZATION-1006: Test to remove FutureWarning

* LOCALIZATION-1006: Updating flake8 and following pep8 style
  • Loading branch information
ggaete authored Oct 18, 2021
1 parent 6d2baeb commit f286208
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
25 changes: 13 additions & 12 deletions pootle/apps/pootle_translationproject/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,46 @@
urlpatterns = [
# Admin views
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)" r"/admin/permissions/",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)" r"/admin/permissions/",
admin_permissions,
name="pootle-tp-admin-permissions",
),
# Translation
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/"
r"translate/(?P<dir_path>(.*/)*)?$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"translate/(?P<dir_path>([^<>]*/)*)?$",
TPTranslateView.as_view(),
name="pootle-tp-translate",
),
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/"
r"translate/(?P<dir_path>(.*/)*)(?P<filename>.*\.*)$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"translate/(?P<dir_path>([^<>]*/)*)(?P<filename>.*\.*)$",
TPTranslateStoreView.as_view(),
name="pootle-tp-store-translate",
),
# Export view
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/"
r"export-view/(?P<dir_path>(.*/)*)?$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"export-view/(?P<dir_path>([^<>]*/)*)?$",
TPExportView.as_view(),
name="pootle-tp-export",
),
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/"
r"export-view/(?P<dir_path>(.*/)*)(?P<filename>.*\.*)$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"export-view/(?P<dir_path>([^<>]*/)*)(?P<filename>.*\.*)$",
TPExportStoreView.as_view(),
name="pootle-tp-store-export",
),
# Browser
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/" r"(?P<dir_path>(.*/)*)?$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"(?P<dir_path>([^<>]*/)*)?$",
TPBrowseView.as_view(),
name="pootle-tp-browse",
),
url(
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/]*)/"
r"(?P<dir_path>(.*/)*)(?P<filename>.*\.*)?$",
r"^(?P<language_code>[^/]*)/(?P<project_code>[^/><]*)/"
r"(?P<dir_path>([^<>]*/)*)(?P<filename>.*\.*)?$",
TPBrowseStoreView.as_view(),
name="pootle-tp-store-browse",
),
Expand Down
4 changes: 2 additions & 2 deletions pootle/middleware/errorpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def log_exception(request, exception, tb):

try:
request_repr = repr(request)
except:
except Exception:
request_repr = "Request repr() unavailable"

msg_args = (str(exception.args[0]), tb, request_repr)
Expand Down Expand Up @@ -93,7 +93,7 @@ def handle_exception(request, exception, template_name):
return HttpResponseServerError(
render_to_string(template_name, context=ctx, request=request)
)
except:
except Exception:
# Let's not confuse things by throwing an exception here
pass

Expand Down
2 changes: 1 addition & 1 deletion requirements/_lint.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Linting tools

black==19.10b0
flake8==3.4.1
flake8==4.0.1
isort==4.3.21
pylint==2.4.4
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def build_mo(self):
command = ["msgfmt", "--strict", "-o", mo_filename, po_filename]
try:
subprocess.check_call(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
error_occured = True
except Exception as e:
log.warn("%s: skipping, running msgfmt failed: %s", lang, e)
Expand Down

0 comments on commit f286208

Please sign in to comment.