コード例 #1
0
from urllib.parse import unquote, urlsplit
from six.moves.html_parser import HTMLParser

from otree.models_concrete import ParticipantToPlayerLookup
from django import test
from django.core.urlresolvers import resolve
from django.conf import settings
from otree.currency import Currency
from django.apps import apps
from otree import constants_internal
from otree.models import Participant, Session
from otree import common_internal
from otree.common_internal import (get_dotted_name, get_bots_module,
                                   get_admin_secret_code, get_models_module)

ADMIN_SECRET_CODE = get_admin_secret_code()

logger = logging.getLogger('otree.bots')

INTERNAL_FORM_FIELDS = {
    'csrfmiddlewaretoken', 'must_fail', 'timeout_happened',
    'admin_secret_code', 'error_fields'
}

DISABLE_CHECK_HTML_INSTRUCTIONS = '''
Checking the HTML may not find all form fields and buttons
(e.g. those added with JavaScript),
so you can disable this check by yielding a Submission
with check_html=False, e.g.:

yield Submission(views.PageName, {{...}}, check_html=False)
コード例 #2
0
ファイル: session.py プロジェクト: ross2604/otree-core
import django.test
from django.core.urlresolvers import reverse

from otree import constants_internal
import otree.common_internal
from otree.common_internal import (
    random_chars_8, random_chars_10, get_admin_secret_code)
from otree.db import models
from otree.models_concrete import ParticipantToPlayerLookup, RoomToSession
from .varsmixin import ModelWithVars

logger = logging.getLogger('otree')

client = django.test.Client()

ADMIN_SECRET_CODE = get_admin_secret_code()


# for now removing SaveTheChange

class Session(ModelWithVars):

    class Meta:
        app_label = "otree"
        # if i don't set this, it could be in an unpredictable order
        ordering = ['pk']

    config = models._JSONField(default=dict, null=True)  # type: dict
    vars = models._JSONField(default=dict)  # type: dict

    # label of this session instance