## Script (Python) "pull_numbers_translation" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=table='translationtype', items='translation', language='Spanish' ##title= ## # pull_numbers_translation.py: from Products.PythonScripts.standard import html_quote request = container.REQUEST RESPONSE = request.RESPONSE #table = "category" #items = "commands" sqlQ = "SELECT * from %s" %table rs = context.sql(Qstring=sqlQ) entries = {} for entry in rs: entries.setdefault((entry[1], entry[0])) totalcount = 0 i = 0 sqlQ = """ SELECT count( * ) as total_record FROM %s WHERE %s Like ''; """ %("translation", language) #print sqlQ #return printed rs = context.sql(Qstring=sqlQ) for bit in rs: i += 1 t = r''' %s (%s) ''' %( language, "Not Assigned", bit[0],) print '' print t for entry, catID in entries: sqlQ = """ SELECT count( * ) as total_record FROM %s INNER JOIN %s ON %s.%sID = %s.ID WHERE (((%s.Name) Like '%s')); """ %(table, items, items, table, table, table, entry) rs = context.sql(Qstring=sqlQ) for bit in rs: i += 1 t = r''' ''' %(catID, entry, table, items, language, entry, bit[0],) print t if i == 5: print '' i = 0 totalcount += bit[0] t = r'''
%s (%s)
All (%i) ''' %(entry, table, items, language, totalcount ) print t print "
" return printed