/[collab-qa]/udd/udd/pts_gatherer.py
ViewVC logotype

Contents of /udd/udd/pts_gatherer.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1710 - (show annotations) (download) (as text)
Wed Mar 3 16:15:56 2010 UTC (3 years, 2 months ago) by lucas
File MIME type: text/x-python
File size: 1037 byte(s)
also remove ANALYZE for pts_public
1 # Last-Modified: <Sun Aug 10 12:16:12 2008>
2
3 # This file is a part of the Ultimate Debian Database Project
4
5 from gatherer import gatherer
6 from aux import ConfigException, quote
7 from time import strptime
8
9 ZERO_DATE = '0000-01-01'
10
11 def get_gatherer(config, connection, source):
12 return pts_gatherer(config, connection, source)
13
14
15 class pts_gatherer(gatherer):
16 """This class imports PTS subscribers"""
17
18 def __init__(self, connection, config, source):
19 gatherer.__init__(self, connection, config, source)
20 self.assert_my_config('path')
21
22 def run(self):
23 src_cfg = self.my_config
24
25 c = self.connection.cursor()
26
27 c.execute("DELETE FROM pts")
28
29 c.execute("PREPARE pts_insert AS INSERT INTO pts (source, email) VALUES ($1, $2)")
30
31 f = open(src_cfg['path'])
32 for line in f:
33 (package, subs) = line.split("\t")
34 for sub in subs.split(", "):
35 sub = sub.strip()
36 c.execute("EXECUTE pts_insert(%s, %s)", (package, sub))
37
38 c.execute("DEALLOCATE pts_insert")
39 c.execute("ANALYZE pts")
40

  ViewVC Help
Powered by ViewVC 1.1.5