Experiment.member()#

Experiment.member(_member=None, *, of_section: str = '_content', admin: bool = False)[source]#

Decorator for adding pages and sections to the experiment.

Works both with and without arguments.

Parameters
  • of_section (str) – Name of the section to which the new member belongs.

  • admin (bool) – If True, the new member will be added to the admin mode instead of the normal experiment.

Examples

Adding a page directly to the main content section:

import alfred3 as al
exp = al.Experiment()

@exp.member
class HelloWorld(al.Page):
    name = "hello_world"

    def on_exp_access(self):
        self += al.Text("This is a 'hello, world!' Page.")

Adding a page to a specific section:

import alfred3 as al
exp = al.Experiment()

exp += al.Section(name="main")

@exp.member(of_section="main")
class HelloWorld(al.Page):
    title = "Hello, World!"

    def on_exp_access(self):
        self += al.Text("This is a 'hello, world!' Page.")