extract_abbonatimail.py 2.05 KB
#!/usr/bin/env python2.5
from zope.interface import Interface, implements
from axiom import item, attributes, store
from epsilon import extime
import time
import md5
import sys,  os

sys.path.append(os.path.basename(sys.argv[0]))

# costo orario e ore utente


class ISkyliveUsers(Interface):
   """ ISkyliveUsers Interface """

class SkyliveUsers(item.Item):

   implements(ISkyliveUsers)
   schemaVersion=2

   typeName = "SkyliveUsers"

   nome = attributes.text(allowNone=True, indexed=True)
   cognome = attributes.text(allowNone=True, indexed=True)
   telescopio = attributes.boolean(default=False)
   preferenza = attributes.text(allowNone=True)
   giudizio = attributes.text(allowNone=True)
   email = attributes.text(allowNone=False, indexed=True)
   citta = attributes.text(allowNone=True)
   nazione = attributes.text(allowNone=True)
   username = attributes.text(allowNone=False, indexed=True)
   password = attributes.text(allowNone=False, indexed=True)
   admin = attributes.boolean(default=False, indexed=True)
   lingua = attributes.text(default="it", indexed=True)
   tsiscrizione = attributes.timestamp(indexed=True)
   lastlogin = attributes.timestamp(indexed=True, allowNone=True)
   active = attributes.boolean(default=False, indexed=True)
   uniqueid = attributes.text(allowNone=False, indexed=True)
   hourtypes = attributes.textlist(allowNone=False, indexed=True, default=['default'])
   banned = attributes.boolean(indexed=True, default=False)
   mlist = attributes.boolean(indexed=True, default=True)
   privacycommercial = attributes.boolean(indexed=True, default=True)
   privacydefault = attributes.boolean(indexed=True, default=True)
   timezone = attributes.text(indexed=True, default='Europe/Rome')

   def updateLastLogin(self):
      self.lastlogin = extime.Time.fromPOSIXTimestamp(time.time())




s = store.Store('AxiomDB')
print s.getItemByID(1)
#f= open("userlist.txt", "w")
#users = list(s.query(UserSubscriptions))
#for user in users:
#   u = s.findFirst(SkyliveUsers, SkyliveUsers.username == user.username)
#   f.write(str(u.email)+"\r\n")
#f.close()