[Blends-commit] r3143 - /blends/trunk/webtools/blendstasktools.py
tille at users.alioth.debian.org
tille at users.alioth.debian.org
Fri Feb 17 21:38:41 UTC 2012
Author: tille
Date: Fri Feb 17 21:38:40 2012
New Revision: 3143
URL: http://svn.debian.org/wsvn/blends/?sc=1&rev=3143
Log:
Use new way to provide all description languages in description table (formerly ddtp)
Modified:
blends/trunk/webtools/blendstasktools.py
Modified: blends/trunk/webtools/blendstasktools.py
URL: http://svn.debian.org/wsvn/blends/blends/trunk/webtools/blendstasktools.py?rev=3143&op=diff
==============================================================================
--- blends/trunk/webtools/blendstasktools.py (original)
+++ blends/trunk/webtools/blendstasktools.py Fri Feb 17 21:38:40 2012
@@ -46,6 +46,7 @@
import logging.handlers
logger = logging.getLogger('blends')
logger.setLevel(logging.INFO)
+# logger.setLevel(logging.DEBUG)
# Seems to have problems on 17.04.2009
# BASEURL = 'http://ftp.debian.org/debian'
@@ -55,11 +56,6 @@
KEYSTOIGNORE = ( 'Architecture', 'Comment', 'Leaf', 'NeedConfig', 'Note', 'Section',
'Needconfig', 'DontAvoid',
'Enhances', 'Test-always-lang', 'Metapackage')
-# DDTP now exports to official debian mirror
-#DDTPURL = "http://ddtp.debian.net/debian/dists/"
-DDTPURL = "http://ftp.de.debian.org/debian/dists/"
-DDTPDIR = "/i18n/Translation-"
-DDTPLISTS = ('etch', 'lenny', 'sid')
CONFDIR = 'webconf'
@@ -283,12 +279,10 @@
def _execute_udd_query(query):
try:
curs.execute(query)
- # print >>uddlog, query
+ logger.debug(query)
except psycopg2.ProgrammingError, err:
- try:
- print >>stderr, "%s; query was\n%s" % (err, to_unicode(query))
- except UnicodeDecodeError, err2:
- print >>stderr, "%s; beginn of query was\n%s\n%s" % (err, query[0], err2)
+ print >>stderr, "Problem with query\n%s" % (to_unicode(query))
+ print >>stderr, err
exit(-1)
except psycopg2.DataError, err:
print >>stderr, "%s; query was\n%s" % (err, query)
@@ -307,6 +301,11 @@
vote int, recent int, -- popcon
debtags text[],
screenshot_versions text[], image text[], icon text[],
+ "Published-Year" text,
+ "Published-Title" text,
+ "Published-Authors" text,
+ "Published-DOI" text,
+ "Published-PubMed" text,
description_en text, long_description_en text,
description_cs text, long_description_cs text,
description_da text, long_description_da text,
@@ -350,6 +349,7 @@
query = """PREPARE query_metapkg_trans (text[]) AS
SELECT * FROM blends_metapackage_translations($1) AS (
package text,
+ description_en text, long_description_en text,
description_cs text, long_description_cs text,
description_da text, long_description_da text,
description_de text, long_description_de text,
@@ -591,6 +591,7 @@
self.blendname = blendname # Blend that includes the package in dependency list
self.taskname = taskname # Task which includes the Dependency
self.pkg = None # Name of dependant package
+ self.source = None # Name of source package of the dependency
self.PrintedName = None # Only for Meta package names - no use for a real dependant package
# FIXME -> object model
self.pkgstatus = 'unknown' # global pkgstatus: characterizes status of dependency, release, packaging status
@@ -741,7 +742,7 @@
# one hand is a sign that this Blend has uploaded metapackages at all and on the
# other hand gives a clue about whether it makes sense to query for description
# translations
- query = "SELECT COUNT(*) FROM ddtp WHERE package = ANY ('%s')" % List2PgArray(metapackages)
+ query = "SELECT COUNT(*) FROM descriptions WHERE package = ANY ('%s')" % List2PgArray(metapackages)
_execute_udd_query(query)
if curs.rowcount > 0:
hastranslations = curs.fetchone()[0]
@@ -988,17 +989,16 @@
# This is NOT YET implemented
self.metadepends = None
+
def SetMetapackageInfo(self, pkgname, ddtptranslations=None):
# Gather information (specifically description translations if exists) about metapackage itself
self.metapkg = DependantPackage(self.blendname, self.task)
self.metapkg.pkg = pkgname
+ self.metapkg.source = self.blendname
if not ddtptranslations:
return
for lang in languages:
- # we do not use the English package description but rather the description in the tasks file itself
- # so ignore the English language here and moreover check whether a translation of the language in question exists
- if lang != 'en' and \
- ddtptranslations['description_'+lang]:
+ if ddtptranslations['description_'+lang]:
self.metapkg.desc[lang] = {}
try:
short = to_unicode(ddtptranslations['description_'+lang])
@@ -1015,6 +1015,10 @@
logger.error("===> UnicodeDecodeError in metapackage long %s (lang='%s'): '%s'; ErrTxt: %s" % \
(self.metapkg.pkg, lang, ddtptranslations['long_description_'+lang], err))
self.metapkg.desc[lang]['long'] = 'UnicodeDecodeError'
+ except AttributeError, err:
+ logger.error("===> AttributeError in metapackage long %s (lang='%s'): '%s'; ErrTxt: %s" % \
+ (self.metapkg.pkg, lang, ddtptranslations['long_description_'+lang], err))
+ self.metapkg.desc[lang]['long'] = 'Missing long description'
def _AppendDependency2List(self, dep, source):
# Append dependency which was found in the tasks file if not Ignore / Avoid and
@@ -1470,14 +1474,11 @@
dep.properties['pkg-url'] = PKGURLMASK % dep.pkg
for pub in ("Published-Year", "Published-Title", "Published-Authors", "Published-DOI", "Published-PubMed"):
- try:
- if row[pub]:
- if not dep.properties.has_key('published'):
- dep.properties['published'] = {}
- ptype = pub.replace('Published-','').lower()
- dep.properties['published'][ptype] = to_unicode(row[pub])
- except:
- pass # if publication information is not yet queried
+ if row[pub]:
+ if not dep.properties.has_key('published'):
+ dep.properties['published'] = {}
+ ptype = pub.replace('Published-','').lower()
+ dep.properties['published'][ptype] = to_unicode(row[pub])
for l in languages:
if row['description_'+l]:
@@ -1485,6 +1486,9 @@
dep.desc[l]['short'] = MarkupString(to_unicode(row['description_'+l]), dep.pkg, 'ShortDesc')
if row['long_description_'+l]:
dep.desc[l]['long'] = Markup(render_longdesc(row['long_description_'+l].splitlines()))
+ if not dep.desc['en'].has_key('short'):
+ logger.error("Dep has no English short description: %s", str(dep))
+ dep.desc['en']['short'] = "??? missing short description for package %s :-(" % dep.pkg
(_name, _url) = email.Utils.parseaddr(row['maintainer'])
dep.properties['maintainer'] = to_unicode(row['maintainer'])
dep.responsible = '<a href="mailto:%s">%s</a>' % (_url, to_unicode(_name))
@@ -1716,7 +1720,11 @@
dep.responsible = MarkupString(dep.responsible, dep.pkg, 'responsible')
if dep.desc['en'] != {}:
dep.desc['en']['short'] = MarkupString(dep.desc['en']['short'], dep.pkg, 'pkgShortDesc')
- dep.desc['en']['long'] = MarkupString(dep.desc['en']['long'], dep.pkg, 'pkgLongDesc')
+ try:
+ dep.desc['en']['long'] = MarkupString(dep.desc['en']['long'], dep.pkg, 'pkgLongDesc')
+ except KeyError:
+ logger.error("Dep has no English long description: %s", str(dep))
+ dep.desc['en']['long'] = "??? Missing long description for package %s" % dep.pkg
def __str__(self):
ret = "Blend: " + self.blendname + ", " \
More information about the Blends-commit
mailing list