Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# if they're using Django models, this won't work.
Rule(
'= models.CharField',
'= models.StringField',
), # what about initial=None and default=None? maybe do a simple lookahead
# if they're using Django models, this won't work.
Rule(
'= models.TextField',
'= models.LongStringField',
), # what about initial=None and default=None?
Rule(
'form_model = models.Group',
"form_model = 'group'",
"change to "
),
Rule(
'before_session_starts',
'creating_session',
),
# if they are using Django models, or if there are migrations, this won't work.
# Rule(
# 'verbose_name',
# 'label',
# ),
Rule(
'SliderInput',
'Slider',
)
]
TESTS_RULES = [
Rule(
self.print_rule_header()
if os.path.isfile('.gitignore'):
temp_wildcard = '__temp*'
with open('.gitignore', 'r') as file:
temp_wildcard_found = temp_wildcard in file.read()
if not temp_wildcard_found:
if dry_run:
self.print_change('ADD "__temp*" to .gitignore\n')
else:
with open('.gitignore', 'a') as file:
file.write('\n' + temp_wildcard)
self.print_rule_header()
for fn in ['_templates/global/Base.html', '_templates/global/Page.html']:
rule = Rule(
'{% extends "otree/FormPage.html" %}',
'{% extends "otree/Page.html" %}',
)
if os.path.isfile(fn):
self.apply_rule_to_file(fn, rule)
),
Rule(
'otree_tags',
'otree',
),
# someone might have created their own next button;
# we don't want to break the selector for that.
#Rule(
# '.next-button',
# '.otree-btn-next'
#),
Rule(
'.otree-next-button',
'.otree-btn-next'
),
Rule(
'#otree-body',
'.otree-body'
),
Rule(
'#otree-title',
'.otree-title'
),
Rule(
'#otree-timeout',
'.otree-timer'
),
Rule(
'#otree-form-errors',
'.otree-form-errors'
),
# rarely used rules...will just slow things down
'.otree-next-button',
'.otree-btn-next'
),
Rule(
'#otree-body',
'.otree-body'
),
Rule(
'#otree-title',
'.otree-title'
),
Rule(
'#otree-timeout',
'.otree-timer'
),
Rule(
'#otree-form-errors',
'.otree-form-errors'
),
# rarely used rules...will just slow things down
#Rule(
# '#otree-wait-page-body',
# '.otree-wait-page'
#),
#Rule(
# '#otree-wait-page-title-text',
# '.otree-wait-page__title'
#),
#Rule(
# '#otree-wait-page-body-text',
# '.otree-wait-page__body'
#),
return line.replace(self.old_token, self.new_token)
PYTHON_RULES = [
Rule(
'form_model = models.Player',
"form_model = 'player'",
"change to "
),
# if they're using Django models, this won't work.
Rule(
'= models.CharField',
'= models.StringField',
), # what about initial=None and default=None? maybe do a simple lookahead
# if they're using Django models, this won't work.
Rule(
'= models.TextField',
'= models.LongStringField',
), # what about initial=None and default=None?
Rule(
'form_model = models.Group',
"form_model = 'group'",
"change to "
),
Rule(
'before_session_starts',
'creating_session',
),
# if they are using Django models, or if there are migrations, this won't work.
# Rule(
# 'verbose_name',
# 'label',
),
# someone might have created their own next button;
# we don't want to break the selector for that.
#Rule(
# '.next-button',
# '.otree-btn-next'
#),
Rule(
'.otree-next-button',
'.otree-btn-next'
),
Rule(
'#otree-body',
'.otree-body'
),
Rule(
'#otree-title',
'.otree-title'
),
Rule(
'#otree-timeout',
'.otree-timer'
),
Rule(
'#otree-form-errors',
'.otree-form-errors'
),
# rarely used rules...will just slow things down
#Rule(
# '#otree-wait-page-body',
# '.otree-wait-page'
#),
# '#otree-wait-page-title-text',
# '.otree-wait-page__title'
#),
#Rule(
# '#otree-wait-page-body-text',
# '.otree-wait-page__body'
#),
]
PROCFILE_RULES = [
Rule(
'web: otree webandworkers',
'web: otree runprodserver1of2',
),
Rule(
'timeoutworker: otree timeoutworker',
'worker: otree runprodserver2of2',
)
# '.next-button',
# '.otree-btn-next'
#),
Rule(
'.otree-next-button',
'.otree-btn-next'
),
Rule(
'#otree-body',
'.otree-body'
),
Rule(
'#otree-title',
'.otree-title'
),
Rule(
'#otree-timeout',
'.otree-timer'
),
Rule(
'#otree-form-errors',
'.otree-form-errors'
),
# rarely used rules...will just slow things down
#Rule(
# '#otree-wait-page-body',
# '.otree-wait-page'
#),
#Rule(
# '#otree-wait-page-title-text',
# '.otree-wait-page__title'
#),
Rule(
'form_model = models.Player',
"form_model = 'player'",
"change to "
),
# if they're using Django models, this won't work.
Rule(
'= models.CharField',
'= models.StringField',
), # what about initial=None and default=None? maybe do a simple lookahead
# if they're using Django models, this won't work.
Rule(
'= models.TextField',
'= models.LongStringField',
), # what about initial=None and default=None?
Rule(
'form_model = models.Group',
"form_model = 'group'",
"change to "
),
Rule(
'before_session_starts',
'creating_session',
),
# if they are using Django models, or if there are migrations, this won't work.
# Rule(
# 'verbose_name',
# 'label',
# ),
Rule(
'SliderInput',
'Slider',
'pages',
'fix references to views.py'
),
]
HTML_RULES = [
Rule(
'{% load otreechat %}',
''
),
Rule(
'with label=',
'label=',
'remove unnecessary "with" in formfield tag'
),
Rule(
'otree_tags',
'otree',
),
# someone might have created their own next button;
# we don't want to break the selector for that.
#Rule(
# '.next-button',
# '.otree-btn-next'
#),
Rule(
'.otree-next-button',
'.otree-btn-next'
),
Rule(
'#otree-body',
'.otree-body'