Aller au contenu. | Aller à la navigation

Outils personnels

Navigation

Ex de script

target_mem = context.mementoeleves
target_memens = context.mementoenseignants
target_memgestion = context.mementogestion
target_memsport = context.mementosport
target_memarts = context.mementoarts
target_memtm3e = context.mementotm3e
target_memtm4e = context.mementotm4e
target_memcinema = context.mementocinema
target_memcinema = context.mementovacances

form = request.form

target = form['typeevent']

from DateTime import DateTime
uid = str(DateTime().millis())

if target == 'Memento':
target_mem.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_mem[uid]
if target == 'Memento enseignants':
target_memens.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memens[uid]
if target == 'Memento arts':
target_memarts.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memarts[uid]
if target == 'Memento sport':
target_memsport.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memsport[uid]
if target == 'Memento gestion':
target_memgestion.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memgestion[uid]
if target == 'TM 3e':
target_memtm3e.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memtm3e[uid]
if target == 'TM 4e':
target_memtm4e.invokeFactory("Event", id=uid, title=form['titre'])
obj = target_memtm4e[uid]

 


obj.setFormat('text/plain')
obj.setText(form['contenu'])
obj.setLocation(form['lieu'])
obj.setStartDate(form['debut'])
obj.setEndDate(form['fin'])
obj.setSubject(form['typeevent'])

obj.reindexObject()

 

 


# target_obj = None

# if 'Memento' == 'Memento':
# target_mem.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_mem
# if target == 'Memento enseignants':
# target_memens.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_memens
# if target == 'Memento arts':
# target_memarts.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = targetmemarts
# if target == 'Memento sport':
# target_memsport.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_memsport
# if target == 'Memento gestion':
# target_memgestion.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_memgestion
# if target == 'TM 3e':
# target_memtm3e.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_memtm3e
# if target == 'TM 4e':
# target_memtm4e.invokeFactory("Event", id=uid, title=form['titre'])
# target_obj = target_memtm4e

 

# obj = target_obj[uid]
# obj.setFormat('text/plain')
# obj.setText(form['contenu'])
# obj.setLocation(form['lieu'])
# obj.setStartDate(form['debut'])
# obj.setEndDate(form['fin'])
# obj.setSubject(form['typeevent'])

# obj.reindexObject()