witten
/
luminotes
Archived
1
0
Fork 0

Converted dump_emails.sh to dump_emails.py so that it can run on a separate server from the database.

This commit is contained in:
Dan Helfman 2008-04-07 04:47:07 +00:00
parent ede5e5ac27
commit 272dd3e157
3 changed files with 32 additions and 5 deletions

View File

@ -59,8 +59,9 @@ class Database( object ):
self.__cache = cache
try:
import cmemcache
print "using memcached"
if self.__cache is None:
import cmemcache
print "using memcached"
except ImportError:
return None

29
tools/dump_emails.py Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/python2.4
import os
import os.path
from controller.Database import Database
class Dumper( object ):
def __init__( self, database ):
self.database = database
self.dump_emails()
def dump_emails( self ):
email_addresses = self.database.select_many( unicode, u"select distinct email_address from luminotes_user_current where email_address is not null;" )
for address in email_addresses:
if address:
print address
def main( args ):
database = Database( cache = {} )
ranker = Dumper( database )
if __name__ == "__main__":
import sys
main( sys.argv[ 1: ] )

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo "select distinct email_address from luminotes_user_current;" | psql -U luminotes -A -t -q