#!/usr/bin/env python2.5
from zope.interface import Interface, implements
from axiom import item, attributes, store
from pysqlite2 import dbapi2
from epsilon import extime
import time
import md5
import sys
sys.path.append("..")
from skyliveDaemon.Database.dbschema import SubscriptionsType

s = store.Store('../AxiomDB')


#SubscriptionsType(store=s, name=u'FULL', telescopes=['1','2','4','5','6','7'], price=150, duration=12, public=True)
#SubscriptionsType(store=s, name=u'Pedara', telescopes=['1','2','4','7'], price=100, duration=12, public=True)
#SubscriptionsType(store=s, name=u'TRE', telescopes=['3'], price=0, duration=1200, public=False)
#SubscriptionsType(store=s, name=u'GCO', telescopes=['5','6'], price=50, duration=12, public=False)
#SubscriptionsType(store=s, name=u'SoloOre', telescopes=[], price=0, duration=None, public=False)
#SubscriptionsType(store=s, name=u'ADMIN', telescopes=['1','2','3','4','5','6','7'], price=0, duration=1200, public=False)

#SubscriptionsType(store=s, name=u'FULL_1m', telescopes=['1','2','4','5','6','7'], price=18, duration=1, public=True)
#SubscriptionsType(store=s, name=u'Pedara_1m', telescopes=['1','2','4','7'], price=13, duration=1, public=True)
#SubscriptionsType(store=s, name=u'GCO_1m', telescopes=['5','6'], price=5, duration=1, public=False)

#SubscriptionsType(store=s, name=u'FULL_3m', telescopes=['1','2','4','5','6','7'], price=45, duration=3, public=True)
#SubscriptionsType(store=s, name=u'Pedara_3m', telescopes=['1','2','4','7'], price=32, duration=3, public=True)
#SubscriptionsType(store=s, name=u'GCO_3m', telescopes=['5','6'], price=50, duration=13, public=False)

#SubscriptionsType(store=s, name=u'FULL_6m', telescopes=['1','2','4','5','6','7'], price=85, duration=6, public=True)
#SubscriptionsType(store=s, name=u'Pedara_6m', telescopes=['1','2','4','7'], price=58, duration=6, public=True)
#SubscriptionsType(store=s, name=u'GCO_6m', telescopes=['5','6'], price=50, duration=27, public=False)



a = list(s.query(SubscriptionsType))
for i in a:
   print i

usub = s.findFirst(SubscriptionsType, SubscriptionsType.name==u'GCO_3m')
#usub.telescopes = ['1','2','4','5','6','7']
usub.duration=3 
usub.price=13
usub = s.findFirst(SubscriptionsType, SubscriptionsType.name==u'GCO_6m')
usub.duration=6
usub.price=27


