Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def output_metadata(label, arg_name, option_list, selected):
self.output('<p>%s: <select name="%s">\n' % (label, arg_name))
for item in option_list:
self.output('<option>%s</option>\n' % (item, item))
self.output('</select></p>\n')
output_metadata('Severity', 'severity', config.issues['severity'], issue['Severity'])
output_metadata('Priority', 'priority', config.issues['priority'], issue['Priority'])
output_metadata('State', 'state', config.issues['state'], issue['State'])
output_metadata('Resolution', 'resolution', config.issues['resolution'], issue['Resolution'])
output_metadata('Type', 'type', config.issues['type'], issue['Type'])
output_metadata('Owner', 'owner', config.users, issue['Owner'])
output_metadata('Fix_By', 'fix_by', config.issues['fix_by'], issue['Fix_By'])
output_metadata('Component', 'component', config.issues['components'], issue['Component'])
def shorten_and_link_issues(issue_list_string):
issue_list = issue_list_string.split(' ')
output = ''
for issue in issue_list:
output += '%s ' % (self.format_issue(issue))
return output
self.output('<p>Depends_On: %s</p>\n' % shorten_and_link_issues(issue['Depends_On']))
self.output('<p> <textarea name="depends_on" cols="80" rows="1">%s</textarea></p>\n' % issue['Depends_On'])
dependents = db.issue_dependent_of(issue_hash)
self.output('<p>Dependent_Of: %s</p>\n' % shorten_and_link_issues(dependents))
if line == '\n':
continue
work_units = re.search('(.*) \(([0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+)\)', line)
if work_units == None:
name = line
work_units = '0,0,0,0,0,0,0'
else:
name = work_units.group(1)
work_units = work_units.group(2)
name = string.strip(name)
if name not in config.users:
config.users.append(name)
config.users_times[name] = work_units.split(',')
if config.vcs == None:
for key in ['vcs']:
if key in conf.keys() and conf[key] in BACKENDS:
config.vcs = BACKENDS[conf[key]]
if config.project_name == 'Nitpick Project':
if 'project_name' in conf.keys():
config.project_name = conf['project_name']
if config.use_schedule == False and 'schedule' in conf.keys():
if conf['schedule'] == 'True':
config.use_schedule = True
else:
config.use_schedule = False
config.users = []
config.users_times = {}
for line in fileinput.input(repo_path + 'config/users'):
if line == '\n':
continue
work_units = re.search('(.*) \(([0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+,[0-9.]+)\)', line)
if work_units == None:
name = line
work_units = '0,0,0,0,0,0,0'
else:
name = work_units.group(1)
work_units = work_units.group(2)
name = string.strip(name)
for key in ['components', 'fix_by', 'priority', 'severity', 'state', 'resolution', 'type']:
config.issues[key] = []
_load_config(config.db_path)
# Try to figure out the username to use.
if 'NITPICK_USERNAME' in os.environ:
config.username = os.environ['NITPICK_USERNAME']
else:
# Try to match the current user against the username list
if 'USER' not in os.environ:
print "Warning: Unable to determine username. Please set NITPICK_USERNAME"
else:
user = os.environ['USER']
for row in config.users:
if user in row:
if config.username != '':
print "Warning: Unable to determine username. Please set NITPICK_USERNAME"
break
else:
config.username = row
return True
self.output('<div class="filter_select_box">\n')
if db.has_foreign():
output_filter_options('Project', 'filter_repo', db.repos(), filter_repo)
output_filter_options('Components', 'filter_components', config.issues['components'], filter_components)
output_filter_options('Fix_By', 'filter_fix_by', config.issues['fix_by'], filter_fix_by)
output_filter_options('Severity', 'filter_severity', config.issues['severity'], filter_severity)
output_filter_options('Priority', 'filter_priority', config.issues['priority'], filter_priority)
output_filter_options('State', 'filter_state', config.issues['state'], filter_state)
output_filter_options('Resolution', 'filter_resolution', config.issues['resolution'], filter_resolution)
output_filter_options('Type', 'filter_type', config.issues['type'], filter_type)
possible_owners = []
if config.username != '':
possible_owners = [config.username]
possible_owners.extend(config.users)
output_filter_options('Owner', 'filter_owner', possible_owners, filter_owner)
self.output('</div>\n')
if config.readonly:
self.output('<input value="Sort and Filter" type="button">')
else:
self.output('<input value="Sort and Filter" type="submit">')
self.output('<div class="issue_list"><table name="issue_list" cellspacing="0" class="issue_list"> <tbody><tr class="issue_list"></tr></tbody></table> ')
def output_row_header(bool, label, request_args):
if bool or config.readonly:
if config.readonly:
myargs = {}
else:
myargs = copy.copy(request_args)</div>
self.end_doc()
return
# Here we know that the issue and parent are good to use
self.output('<div class="add_comment">\n')
self.output('<form method="post" action="/add_comment%s" enctype="multipart/form-data" name="comment">\n'
% self.session_query())
self.output('<input value="%s" name="issue" type="hidden">\n' % issue)
self.output('<input value="%s" name="parent" type="hidden">\n' % parent)
localdate = time.strftime(DATEFORMAT, time.localtime())
date = time.strftime(DATEFORMAT, time.gmtime())
self.output('<p>Date: %s<input value="%s" name="date" type="hidden"></p>\n' % (localdate, date))
self.output('<p>User: <select name="username">\n')
for username in config.users:
self.output('<option>%s</option>\n' % (username, username))
self.output('</select></p>\n')
self.output('<p>Attachment: <input name="attachment" type="file"> ')
self.output('<input size="40" value="%s" name="attachment_name" type="text"></p>\n' % USE_UPLOADED_NAME)
self.output('<p><textarea cols="80" rows="20" name="content">Enter comment here</textarea></p>\n')
self.output('<input value="Submit" type="submit"><br>\n')
self.output('</form>\n')
self.output('</div>\n')
self.end_doc()
self.output('<p>Resolution: <select name="resolution">\n')
for resolution in config.issues['resolution']:
self.output('<option value="%s">%s</option>\n' % (resolution, resolution))
self.output('</select></p>\n')
self.output('<p>Reported_By: <select name="reported_by">\n')
for user in config.users:
self.output('<option>%s</option>\n' % (user, user))
self.output('</select></p>\n')
self.output('<p>Owner: <select name="owner">\n')
for user in config.users:
self.output('<option>%s</option>\n' % (user, user))
self.output('</select></p>\n')
self.output('<p>Seen_In_Build: <input value="" name="seen_in_build" type="text"></p>\n')
self.output('<p>Fix_By: <select name="fix_by">\n')
for fix_by in config.issues['fix_by']:
self.output('<option value="%s">%s</option>\n' % (fix_by, fix_by))
self.output('</select></p>\n')
self.output('<p>Depends_On: <input value="" name="depends_on" type="text"></p>\n')
self.output('<p>Duplicate_Of: <input value="" name="duplicate_of" type="text"></p>\n')
for resolution in config.issues['resolution']:
self.output('<option value="%s">%s</option>\n' % (resolution, resolution))
self.output('<p></p>\n')
self.output('<p>Reported_By: <select name="reported_by">\n')
for user in config.users:
self.output('<option>%s</option>\n' % (user, user))
self.output('</select></p>\n')
self.output('<p>Owner: <select name="owner">\n')
for user in config.users:
self.output('<option>%s</option>\n' % (user, user))
self.output('</select></p>\n')
self.output('<p>Seen_In_Build: <input value="" name="seen_in_build" type="text"></p>\n')
self.output('<p>Fix_By: <select name="fix_by">\n')
for fix_by in config.issues['fix_by']:
self.output('<option value="%s">%s</option>\n' % (fix_by, fix_by))
self.output('</select></p>\n')
self.output('<p>Depends_On: <input value="" name="depends_on" type="text"></p>\n')
self.output('<p>Duplicate_Of: <input value="" name="duplicate_of" type="text"></p>\n')
hide = ''
if not config.use_schedule: