Ejemplo n.º 1
0
    def run(self):
        print "expiring expired tickets"
        print
        seen = {}
        s = None
        expired = Ticket.query.filter(Ticket.expires <= datetime.utcnow(),
                                      Ticket.paid == False).all()
        for t in expired:
            # test that the ticket has a payment... not all do.
            if t.payment:
                if t.payment.id not in seen:
                    seen[t.payment.id] = True

        for p in seen:
            p = Payment.query.get(p)
            print "expiring %s payment %d" % (p.provider, p.id)
            p.state = "expired"
            if not s:
                s = db.object_session(p)

            for t in p.tickets:
                print "deleting expired %s ticket %d" % (t.type.name, t.id)
                s.delete(t)

        if s:
            s.commit()
Ejemplo n.º 2
0
  def run(self):
    print "expiring expired tickets"
    print
    seen = {}
    s = None
    expired = Ticket.query.filter(Ticket.expires <= datetime.utcnow(), Ticket.paid == False).all()
    for t in expired:
      # test that the ticket has a payment... not all do.
      if t.payment:
        if t.payment.id not in seen:
          seen[t.payment.id] = True

    for p in seen:
      p = Payment.query.get(p)
      print "expiring %s payment %d" % (p.provider, p.id)
      p.state = "expired"
      if not s:
        s = db.object_session(p)

      for t in p.tickets:
        print "deleting expired %s ticket %d" % (t.type.name, t.id)
        s.delete(t)

    if s:
      s.commit()
Ejemplo n.º 3
0
    def run(self, userid):
        if not userid:
            userid = 1
        user = User.query.get(userid)
        user.admin = True
        s = db.object_session(user)
        s.commit()

        print 'userid 1 (%s) is now an admin' % (user.name)
Ejemplo n.º 4
0
  def run(self, userid):
    if not userid:
      userid = 1
    user = User.query.get(userid)
    user.admin = True
    s = db.object_session(user)
    s.commit()

    print 'userid 1 (%s) is now an admin' % (user.name)
Ejemplo n.º 5
0
    def run(self, userid):
        if not userid:
            userid = 1
        user = User.query.get(userid)
        user.arrivals = True
        s = db.object_session(user)
        s.commit()

        print '%s is now an arrivals operator' % (user.name)
Ejemplo n.º 6
0
    def run(self, userid):
        if not userid:
            userid = 1
        user = User.query.get(userid)
        user.arrivals = True
        s = db.object_session(user)
        s.commit()

        print '%s is now an arrivals operator' % (user.name)