Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: filters/localise_path.py

Issue 4661048523096064: Issue 2120 - Add support for animations. (Closed)
Patch Set: Forgot to give localise_path filter a default return! Created April 9, 2015, 8:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: filters/localise_path.py
diff --git a/filters/localise_path.py b/filters/localise_path.py
new file mode 100644
index 0000000000000000000000000000000000000000..80cff8bfb131eca0d2046e180e6c211bc0d8f6c2
--- /dev/null
+++ b/filters/localise_path.py
@@ -0,0 +1,23 @@
+# This file is part of the Adblock Plus website,
+# Copyright (C) 2006-2015 Eyeo GmbH
+#
+# Adblock Plus is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# Adblock Plus is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+def localise_path(path, locale):
Sebastian Noack 2015/04/10 07:55:46 Maybe it's just me. But I feel that British spelli
+ for prefix in (("locales", locale), ("locales", "en"), ("static",)):
+ full_path = os.path.join(*prefix + (path,))
+ if os.path.isfile(full_path):
Sebastian Noack 2015/04/10 07:55:46 Again, are you sure it's safe to resolve paths rel
+ return full_path
+ return full_path

Powered by Google App Engine
This is Rietveld