euphorie.client.profile

euphorie.client.profile.AddToTree(root, node, zodb_path=[], title=None, profile_index=0)

Add a new node to the session tree.

Parameters:
  • root (py:class:euphorie.client.model.SurveySession or euphorie.client.model.SurveyTreeItem) – parent node of the new child
  • node (one of the euphorie.content content types) – ZODB object to add to the node.
  • zodb_path – list of ids of all parents of the root in the session tree
  • title (unicode or None) – title for the generated node. Defaults to the title of the ZODB object
  • profile_index – profile answer index (for repetable profile questions)
  • profile_index – int
euphorie.client.profile.BuildSurveyTree(survey, profile={}, dbsession=None)

(Re)build the survey SQL tree. The existing tree for the session is deleted before a new tree is created.

Parameters:
  • survey (euphorie.content.survey.Survey) – survey to build tree for
  • profile (dictionary) – desired profile to be used for the tree
  • dbsession (euphorie.client.model.SurveySession) – session to build tree in. Defaults to currently active session.
euphorie.client.profile.extractProfile(survey)

Determine the current profile for the current survey. The euphorie.client.session.SessionManager is used to find the current session.

The profile is returned as a dictionary. The id of the profile questions are used as keys. For optional profile questions the value is a boolean. For repetable profile questions the value is a list of titles as provided by the user. This format is compatible with Profile.getDesiredProfile().

Parameters:survey (euphorie.client.model.Survey) – current survey
Return type:dictionary with profile answers
class euphorie.client.profile.Profile(context, request)

Determine the profile for the current survey and build the session tree.

All profile questions in the survey are shown to the user in one screen. The user can then determine the profile for his organisation. If there are no profile questions user is directly forwarded to the inventory phase.

This view assumes there already is an active session for the current survey.

ProfileQuestions()

Return information for all profile questions in this survey.

The data is returned as a list of dictionaries with the following keys:

  • id: object id of the question
  • title: title of the question
  • type: question type, one of repeat or optional
getDesiredProfile()

Get the requested profile from the request.

The profile is returned as a dictionary. The id of the profile questions are used as keys. For optional profile questions the value is a boolean. For repetable profile questions the value is a list of titles as provided by the user. This format is compatible with extractProfile().

Return type:dictionary with profile answers
setupSession()

Setup the session for the context survey. This will rebuild the session tree if the profile has changed.

class euphorie.client.profile.Update(context, request)

Update a survey session after a survey has been republished. If a the survey has a profile the user is asked to confirm the current profile before continueing.

The behaviour is exactly the same as the normal start page for a session (see the Profile view), but uses a different template with more detailed instructions for the user.

Previous topic

euphorie.client.navigation

Next topic

euphorie.client.publish

This Page