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:
parent
ede5e5ac27
commit
272dd3e157
|
@ -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
|
||||
|
||||
|
|
|
@ -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: ] )
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "select distinct email_address from luminotes_user_current;" | psql -U luminotes -A -t -q
|
Reference in New Issue