def test_patch_raven_config(self): apps.patch_raven_config() expected = { 'release': '{}{}'.format(otree.get_version(), ',dbg' if settings.DEBUG else '') } self.assertEquals(settings.RAVEN_CONFIG, expected)
def patch_raven_config(): # patch settings with info that is only available # after other settings loaded if hasattr(settings, 'RAVEN_CONFIG'): settings.RAVEN_CONFIG['release'] = '{}{}'.format( otree.get_version(), # need to pass the server if it's DEBUG # mode. could do this in extra context or tags, # but this seems the most straightforward way ',dbg' if settings.DEBUG else '')
def patch_raven_config(): # patch settings with info that is only available # after other settings loaded if hasattr(settings, 'RAVEN_CONFIG'): settings.RAVEN_CONFIG['release'] = '{}{}'.format( otree.get_version(), # need to pass the server if it's DEBUG # mode. could do this in extra context or tags, # but this seems the most straightforward way ',dbg' if settings.DEBUG else '' )
def get_context_data(self, **kwargs): ctx = super(ExtendedPage, self).get_context_data(**kwargs) ctx.update({ 'page_title': self.get_page_title(), 'timeout_warning_seconds': self.timeout_warning_seconds, 'timeout_warning_message': self.timeout_warning_message, 'debug': DEBUG_FOR_TPL, # allows to retrieve a debug state in the templates 'use_legacy_timer_code': StrictVersion(otree.get_version()) < StrictVersion('1.4'), }) return ctx
def otree_and_django_version(*args, **kwargs): otree_ver = otree.get_version() django_ver = django.get_version() return "oTree: {} - Django: {}".format(otree_ver, django_ver)
def get_timeout_seconds(self): if StrictVersion(otree.get_version()) >= StrictVersion( '1.4') and self.has_timeout_warning(): return self.timeout_warning_seconds else: return None
def test_patch_raven_config(self): apps.patch_raven_config() expected = { 'release': '{}{}'.format( otree.get_version(), ',dbg' if settings.DEBUG else '')} self.assertEquals(settings.RAVEN_CONFIG, expected)
def test_get_version(self): self.assertEquals(otree.get_version(), otree.__version__)