[SCM] watchdog branch, master, updated. 0033f2cc6556bb4b378af3ce0c10e7a1b949eaa6

1 view
Skip to first unread message

devi

unread,
Apr 9, 2009, 4:29:55 AM4/9/09
to watchdo...@googlegroups.com
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "watchdog".

The branch, master has been updated
via 0033f2cc6556bb4b378af3ce0c10e7a1b949eaa6 (commit)
from 996bae118cde430c4c31076d8e20d0479a536efb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0033f2cc6556bb4b378af3ce0c10e7a1b949eaa6
Author: Devi <asl...@gmail.com>
Date: Thu Apr 9 11:47:11 2009 +0530

fixes

-----------------------------------------------------------------------

Summary of changes:
utils/index.py | 19 ++++++++++---------
webapp.py | 9 +++++++--
2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/utils/index.py b/utils/index.py
index 27f039e..c9aac4c 100644
--- a/utils/index.py
+++ b/utils/index.py
@@ -73,6 +73,7 @@ def group(seq, maxsize):
size = 0
while size < maxsize:
x = seq.next()
+ if not x: break
size += itemlen(x)
yield x

@@ -105,7 +106,7 @@ $if title != "index": <a href="../index.html">Back to index</a>
make_sitemap = web.template.Template(t_sitemap)
make_index = web.template.Template(t_index)
pagesize = 99*1024 #1K for overheads like <h1> and back links
-entries_per_page = pagesize/30
+entries_per_page = pagesize/50 #len('<a href="index_xxxxx.html">index_xxxxx.html</a>') = 47

def write(filename, text):
f = open(filename, 'w')
@@ -113,30 +114,30 @@ def write(filename, text):
print filename, len(text)/1024
f.close()

-def write_sitemap(i, seq):
- dir = 'index/%02d' % (i/entries_per_page)
+def write_sitemap(i, seq, index_dir):
+ dir = index_dir + '/%02d' % (i/entries_per_page)
filename = "%s/index_%05d.html" % (dir, i)
if not os.path.exists(dir):
os.mkdir(dir)
write(filename, str(make_sitemap(filename, seq)))

-def write_sitemaps(data):
+def write_sitemaps(data, index_dir):
for i, x in enumerate(group(data, pagesize)):
- write_sitemap(i, x)
+ write_sitemap(i, x, index_dir)

def create_index(index_dir, _test=False):
if not os.path.exists(index_dir):
os.mkdir(index_dir)

- data = getindex(petition.app, _test)
- write_sitemaps(data)
+ data = getindex(webapp.app, _test)
+ write_sitemaps(data, index_dir)

dirs = [d for d in os.listdir(index_dir) if os.path.isdir(os.path.join(index_dir, d))]
write(index_dir + '/index.html', str(make_index(index_dir, [d+'/index.html' for d in dirs])))

for d in dirs:
- d = os.path.join('index', d)
+ d = os.path.join(index_dir, d)
write(d + '/index.html', str(make_index('index %s' % (d), os.listdir(d))))

if __name__ == "__main__":
- create_index('index', _test=False)
+ create_index('static/index', _test=False)
diff --git a/webapp.py b/webapp.py
index 35c786c..cec8513 100755
--- a/webapp.py
+++ b/webapp.py
@@ -320,7 +320,12 @@ class bill:

class contributor:
def index(self):
- return ('/contrib/%s/%s' % (c.zip, (c.name or '').lower()) \
+ def format(name):
+ names = name.lower().split(', ')
+ if len(names) > 1:
+ return '_'.join(names[1].split() + [names[0]])
+ return name
+ return ('/contrib/%s/%s' % (c.zip, format(c.name)) \
for c in db.select('contribution', what='zip, name'))

def GET(self, zipcode, name):
@@ -539,7 +544,7 @@ def get_capitolwords(bioguideid):
class politician_lobby:
def index(self):
#/p/(.*?)/lobby
- return ('/p/%s/lobby' % (p.id)
+ return ('/p/%s/lobby' % (p.politician_id)
for p in db.query('select distinct(politician_id) from lob_contribution'))

def GET(self, polid, format=None):


hooks/post-receive
--
watchdog

Reply all
Reply to author
Forward
0 new messages