''' How to use a session parameter in code BEST FOR ANNOUNCING A SMALL AMOUNT / GIVING TIPPS example for an error in the treatment case IF IT DOESNT MATTER and a backfall variant for the show_partner_page for complete code look @ baerlab_intro BEST PRACTICE 3rd way is to set defaults, and overwrite them with the stuff given in the session_config for complete code look into the real effort tasks @slider,countnumbers etc ''' def creating_session(subsession): MSG_TREATMENT_MISSING = """ FAILURE: The Session Config has a not specified Treatment, please check if Constant TREATMENTS has the given config-treatment in its list """ if 'treatment' in subsession.session.config: subsession.Treatment = subsession.session.config['treatment'] if subsession.Treatment not in C.TREATMENTS: raise SystemExit(MSG_TREATMENT_MISSING) else: subsession.Treatment = 0 ### Control std if 'show_partner_page' in subsession.session.config: subsession.SHOW_PARTNER = subsession.session.config['show_partner_page'] defaults = dict( num_sliders=36, # anzahl der Slider num_columns=4, # anzahl der Spalten attempts_per_slider=5, # anzahl versuche pro Slider (mach sehr groß wenn nicht gebraucht) ## Delays hinzufügen? trial_delay=1, retry_delay=1 / 10, ## Zeit zwischen falscher Eingabe und neu Versuch ) subsession.session.params = {} for param in defaults: subsession.session.params[param] = subsession.session.config.get(param, defaults[param])