Fix all last changes for pre-production test

This commit is contained in:
2015-02-14 12:01:04 +01:00
parent bf7fdc00bf
commit 12d69abf83
15 changed files with 228 additions and 130 deletions
+29 -5
View File
@@ -4,7 +4,7 @@ import sys
import transaction
import time
import lxml.etree as ET
from datetime import datetime
from sqlalchemy import engine_from_config
from sqlalchemy import create_engine
import unicodedata
@@ -13,14 +13,13 @@ import urllib
from slugify import slugify
from sqlite3 import dbapi2 as sqlite
from os import path
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from jm2l.models import *
from datetime import datetime
def usage(argv):
cmd = os.path.basename(argv[0])
@@ -39,5 +38,30 @@ def main(argv=sys.argv):
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
admin = User(nom=u'jm2l', prenom='contact', slug='contact jm2l', password=u'jm2l', mail=u'contact@jm2l.linux-azur.org')
DBSession.add(admin)
admin = User(nom=u'jm2l', prenom='contact',
slug='contact jm2l', password=u'jm2l',
mail=u'contact@jm2l.linux-azur.org',
Staff=1
)
DBSession.add(admin)
# Create 2015 year event
jm2l = JM2L_Year(year_uid=2015,
state="Ongoing",
description=u"%d, %dème édition des JM2L." % ( 2015, 9 ),
start_time=datetime.strptime("28-11-2015 10:00","%d-%m-%Y %H:%M"),
end_time=datetime.strptime("28-11-2015 19:00","%d-%m-%Y %H:%M")
)
DBSession.add(jm2l)
# Create 2015 Physic room event
phy_salle = SallePhy( name=u"Polytech salle 211",
description=u"Salle informatique, présence de postes de travail",)
DBSession.add(phy_salle)
DBSession.flush()
# Create matching room place (Name could change each year)
salle = Salles(name=u"Mystère", description=u"Salle Mystère",
phy_salle_id = phy_salle.uid,
year_uid = jm2l.year_uid)
DBSession.add(salle)