From: Ciaran Gultnieks Date: Thu, 27 Sep 2012 19:09:45 +0000 (+0100) Subject: Pre-scan descriptions to catch cross-linking errors earlier X-Git-Tag: 0.1~724 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=50c1afdded9e30c565845585e1704f4c660f3a7c;p=fdroidserver.git Pre-scan descriptions to catch cross-linking errors earlier --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index c8519ca4..964f0cf1 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -613,6 +613,21 @@ def read_metadata(verbose=False): if verbose: print "Reading " + metafile apps.append(parse_metadata(metafile, verbose=verbose)) + + # Parse all descriptions at load time, just to ensure cross-referencing + # errors are caught early rather than when they hit the build server. + def linkres(link): + for app in apps: + if app['id'] == link: + return ("fdroid.app:" + link, "Dummy name - don't know yet") + raise MetaDataException("Cannot resolve app id " + link) + for app in apps: + try: + description_html(app['Description'], linkres) + except Exception, e: + raise MetaDataException("Problem with description of " + app['id'] + + " - " + str(e)) + return apps # Formatter for descriptions. Create an instance, and call parseline() with