Index: cms/sources.py |
=================================================================== |
--- a/cms/sources.py |
+++ b/cms/sources.py |
@@ -37,17 +37,17 @@ class Source: |
checked_page = page |
if config.has_option("locale_overrides", page): |
checked_page = config.get("locale_overrides", page) |
if self.has_localizable_file(default_locale, checked_page): |
if not self.has_localizable_file(locale, checked_page): |
locale = default_locale |
- elif self.has_locale(default_locale, checked_page): |
+ elif self.has_page(checked_page): |
if not self.has_locale(locale, checked_page): |
locale = default_locale |
else: |
print >>sys.stderr, "Warning: Link to %s cannot be resolved" % page |
if page == default_page: |
page = "" |
@@ -69,18 +69,25 @@ class Source: |
return "pages/%s.%s" % (page, format) |
def list_pages(self): |
for filename in self.list_files("pages"): |
root, ext = os.path.splitext(filename) |
format = ext[1:].lower() |
yield root, format |
- def has_page(self, page, format): |
- return self.has_file(self.page_filename(page, format)) |
+ def has_page(self, page, format=None): |
+ if format is None: |
+ from .converters import converters |
+ return any( |
+ self.has_page(page, format) |
+ for format in converters.iterkeys() |
+ ) |
+ else: |
+ return self.has_file(self.page_filename(page, format)) |
def read_page(self, page, format): |
return self.read_file(self.page_filename(page, format)) |
# |
# Localizable files helpers |
# |