Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
do not throw error if default_locale without locales (bug 777325)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvan committed Aug 1, 2012
1 parent 56d98b8 commit 289e398
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 6 additions & 0 deletions tests/test_webapp.py
Expand Up @@ -204,6 +204,12 @@ def test_icons_has_min_listed(self):

def test_no_locales(self):
"""Test that locales are not required."""
del self.data["locales"]
self.analyze()
self.assert_silent()

def test_no_default_locale_no_locales(self):
"""Test that locales are not required if no default_locale."""
del self.data["default_locale"]
del self.data["locales"]
self.analyze()
Expand Down
10 changes: 0 additions & 10 deletions validator/specs/webapps.py
Expand Up @@ -53,7 +53,6 @@ class WebappSpec(Spec):
"child_nodes": {"*": {"expected_type": dict,
"child_nodes": {}}}}, # Set in __init__
"default_locale": {"expected_type": types.StringTypes,
"process": lambda s: s.process_default_locale,
"not_empty": True},
"installs_allowed_from": {"expected_type": list,
"process": lambda s: s.process_iaf,
Expand Down Expand Up @@ -200,15 +199,6 @@ def process_dev_url(self, node):
"Found: %s" % node,
self.MORE_INFO])

def process_default_locale(self, node):
if "locales" not in self.data:
self.err.error(
err_id=("spec", "webapp", "def_locale_wo_locales"),
error="`default_locale` without `locales`",
description=["A `default_locale` was provided without a "
"`locales` node.",
self.MORE_INFO])

def process_iaf(self, node):
market_urls = set()
for index, item in enumerate(node):
Expand Down
2 changes: 1 addition & 1 deletion validator/webapp.py
Expand Up @@ -14,6 +14,7 @@ def detect_webapp(err, package):
with open(package, mode="r") as f:
detect_webapp_string(err, f.read())


def detect_webapp_string(err, data):
"""
Parse and validate a webapp based on the string version of the provided
Expand Down Expand Up @@ -51,4 +52,3 @@ def detect_webapp_raw(err, webapp):
description="Your app's name is long enough to possibly be "
"truncated on Firefox OS devices. Consider using "
"a shorter name for your app.")

0 comments on commit 289e398

Please sign in to comment.