(self)
return {key: value for key, value in ret.items() if value}
Translates this config into something formplayer wants to work with
Translates this config into something formplayer wants to work with
Translates this config into something formplayer wants to work with
def _get_start_session_data(self):
        """
        Translates this config into something formplayer wants to work with
        """

        ret = {
            "action": "new-form",
            "form-content": self.form_content,
            "session-data": self.session_data,
            "lang": self.language,
            'username': self.session_data.get('username'),
            'domain': self.session_data.get('domain'),
            'app_id': self.session_data.get('app_id'),
        }

        if self.restore_as_case_id:
            # The contact starting the survey is a case who will be
            # filling out the form for itself.
            ret['restoreAsCaseId'] = self.restore_as_case_id
        elif self.restore_as:
            # The contact starting the survey is a user.
            ret['restoreAs'] = self.restore_as
        else:
            raise ValueError("Unable to determine 'restore as' contact for formplayer")

        # only include anything with a value, or touchforms gets mad
        return {key: value for key, value in ret.items() if value}
def _get_start_session_data ( self ) : ret = { "action" : "new-form" , "form-content" : self . form_content , "session-data" : self . session_data , "lang" : self . language , 'username' : self . session_data . get ( 'username' ) , 'domain' : self . session_data . get ( 'domain' ) , 'app_id' : self . session_data . get ( 'app_id' ) , } if self . restore_as_case_id : # The contact starting the survey is a case who will be # filling out the form for itself. ret [ 'restoreAsCaseId' ] = self . restore_as_case_id elif self . restore_as : # The contact starting the survey is a user. ret [ 'restoreAs' ] = self . restore_as else : raise ValueError ( "Unable to determine 'restore as' contact for formplayer" ) # only include anything with a value, or touchforms gets mad return { key : value for key , value in ret . items ( ) if value }