gurudesh/pytracebugs huggingface dataset:
# Buggy code
def deserialize_value(self, serialized_value):
    """
    Convert a string into the object it represents depending on the type of field
    """
    if serialized_value is "":
        return None
    if self.type == CF_TYPE_INTEGER:
        return int(serialized_value)
    if self.type == CF_TYPE_BOOLEAN:
        return bool(int(serialized_value))
    if self.type == CF_TYPE_DATE:
        # Read date as YYYY-MM-DD
        return date(*[int(n) for n in serialized_value.split("-")])
    if self.type == CF_TYPE_SELECT:
        return self.choices.get(pk=int(serialized_value))
    return serialized_value


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/django/contrib/auth/mixins.py", line 92, in dispatch
return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/views.py", line 196, in post
obj = form.save()
File "/opt/netbox/netbox/extras/forms.py", line 123, in save
self._save_custom_fields()
File "/opt/netbox/netbox/extras/forms.py", line 116, in _save_custom_fields
cfv.save()
File "/opt/netbox/netbox/extras/models.py", line 169, in save
if self.pk and self.value is None:
File "/opt/netbox/netbox/extras/models.py", line 161, in value
return self.field.deserialize_value(self.serialized_value)
File "/opt/netbox/netbox/extras/models.py", line 140, in deserialize_value
return self.choices.get(pk=int(serialized_value))
ValueError: invalid literal for int() with base 10: ''

# Fixed code
def deserialize_value(self, serialized_value):
    """
    Convert a string into the object it represents depending on the type of field
    """
    if serialized_value == "":
        return None
    if self.type == CF_TYPE_INTEGER:
        return int(serialized_value)
    if self.type == CF_TYPE_BOOLEAN:
        return bool(int(serialized_value))
    if self.type == CF_TYPE_DATE:
        # Read date as YYYY-MM-DD
        return date(*[int(n) for n in serialized_value.split("-")])
    if self.type == CF_TYPE_SELECT:
        return self.choices.get(pk=int(serialized_value))
    return serialized_value
# Buggy code
def get_return_url(self, request, imageattachment):
    return imageattachment.obj.get_absolute_url()


# Traceback (AttributeError)
Internal Server Error: /extras/image-attachments/1/delete/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/mixins.py", line 92, in dispatch
return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/utilities/views.py", line 261, in get
'return_url': self.get_return_url(request, obj),
File "/opt/netbox/extras/views.py", line 30, in get_return_url
return imageattachment.obj.get_absolute_url()
AttributeError: 'ImageAttachment' object has no attribute 'obj'

# Fixed code
def get_return_url(self, request, imageattachment):
    return imageattachment.parent.get_absolute_url()
# Buggy code
def add_message_event(proto_message, span, message_event_type, message_id=1):
    """Adds a MessageEvent to the span based off of the given protobuf
    message
    """
    span.add_message_event(
        time_event.MessageEvent(
            datetime.utcnow(),
            message_id,
            type=message_event_type,
            uncompressed_size_bytes=proto_message.ByteSize(),
        )
    )


# Traceback (AttributeError)
Traceback (most recent call last):
File "/redacted.py", line 167, in redacted
public_key = client.get_public_key(request={"name": key_name})
File "/usr/local/lib/python3.7/site-packages/google/cloud/kms_v1/services/key_management_service/client.py", line 1026, in get_public_key
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
File "/usr/local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
on_error=on_error,
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 184, in retry_target
return target()
File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
return callable_(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/grpc/_interceptor.py", line 221, in __call__
compression=compression)
File "/usr/local/lib/python3.7/site-packages/grpc/_interceptor.py", line 256, in _with_call
request)
File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/client_interceptor.py", line 166, in intercept_unary_unary
next(new_request))
File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/utils.py", line 33, in wrap_iter_with_message_events
message_id=message_id)
File "/usr/local/lib/python3.7/site-packages/opencensus/ext/grpc/utils.py", line 18, in add_message_event
uncompressed_size_bytes=proto_message.ByteSize()
File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 525, in __getattr__
raise AttributeError(str(ex))
AttributeError: 'ByteSize'

# Fixed code
def add_message_event(proto_message, span, message_event_type, message_id=1):
    """Adds a MessageEvent to the span based off of the given protobuf
    message
    """
    span.add_message_event(
        time_event.MessageEvent(
            datetime.utcnow(),
            message_id,
            type=message_event_type,
            uncompressed_size_bytes=extract_byte_size(proto_message),
        )
    )
# Buggy code
def register_view(self, view):
    """register_view will create the needed structure
    in order to be able to sent all data to Prometheus
    """
    v_name = get_view_name(self.options.namespace, view)

    if v_name not in self.registered_views:
        desc = {
            "name": v_name,
            "documentation": view.description,
            "labels": list(view.columns),
        }
        self.registered_views[v_name] = desc
        self.registry.register(self)


# Traceback (ValueError)
Exception happened during processing of request from ('127.0.0.1', 64332)
Traceback (most recent call last):
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 652, in __init__
self.handle()
File "/Users/prakritibansal/anaconda2/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/Users/prakritibansal/anaconda2/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/exposition.py", line 146, in do_GET
output = encoder(registry)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/exposition.py", line 89, in generate_latest
for metric in registry.collect():
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/registry.py", line 75, in collect
for metric in collector.collect():
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/opencensus/stats/exporters/prometheus_exporter.py", line 226, in collect
metric = self.to_metric(desc, tag_values, agg_data)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/opencensus/stats/exporters/prometheus_exporter.py", line 186, in to_metric
labels=label_keys)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/metrics_core.py", line 185, in __init__
Metric.__init__(self, name, documentation, 'histogram', unit)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/metrics_core.py", line 27, in __init__
raise ValueError('Invalid metric name: ' + name)
ValueError: Invalid metric name: oc_python_demo/latency

# Fixed code
def register_view(self, view):
    """register_view will create the needed structure
    in order to be able to sent all data to Prometheus
    """
    v_name = get_view_name(self.options.namespace, view)

    if v_name not in self.registered_views:
        desc = {
            "name": v_name,
            "documentation": view.description,
            "labels": list(map(sanitize, view.columns)),
        }
        self.registered_views[v_name] = desc
        self.registry.register(self)
# Buggy code
def get_view_name(namespace, view):
    """create the name for the view"""
    name = ""
    if namespace != "":
        name = namespace + "_"
    return name + view.name


# Traceback (ValueError)
Exception happened during processing of request from ('127.0.0.1', 64332)
Traceback (most recent call last):
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/prakritibansal/anaconda2/lib/python2.7/SocketServer.py", line 652, in __init__
self.handle()
File "/Users/prakritibansal/anaconda2/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/Users/prakritibansal/anaconda2/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/exposition.py", line 146, in do_GET
output = encoder(registry)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/exposition.py", line 89, in generate_latest
for metric in registry.collect():
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/registry.py", line 75, in collect
for metric in collector.collect():
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/opencensus/stats/exporters/prometheus_exporter.py", line 226, in collect
metric = self.to_metric(desc, tag_values, agg_data)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/opencensus/stats/exporters/prometheus_exporter.py", line 186, in to_metric
labels=label_keys)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/metrics_core.py", line 185, in __init__
Metric.__init__(self, name, documentation, 'histogram', unit)
File "/Users/prakritibansal/anaconda2/lib/python2.7/site-packages/prometheus_client/metrics_core.py", line 27, in __init__
raise ValueError('Invalid metric name: ' + name)
ValueError: Invalid metric name: oc_python_demo/latency

# Fixed code
def get_view_name(namespace, view):
    """create the name for the view"""
    name = ""
    if namespace != "":
        name = namespace + "_"
    return sanitize(name + view.name)
# Buggy code
def _extract_tags(attr):
    if attr is None:
        return None
    tags = []
    for attribute_key, attribute_value in attr.items():
        tag = _convert_attribute_to_tag(attribute_key, attribute_value)
        if tag is None:
            continue
        tags.append(tag)
    return tags


# Traceback (AttributeError)
Traceback (most recent call last):
File "main.py", line 37, in <module>
main()
File "main.py", line 33, in main
more_work()
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/span.py", line 251, in __exit__
self.context_tracer.end_span()
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/tracers/context_tracer.py", line 123, in end_span
self.exporter.export(span_datas)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/jaeger_exporter.py", line 160, in export
self.transport.export(span_datas)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/transports/sync.py", line 23, in export
self.exporter.emit(span_datas)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/jaeger_exporter.py", line 140, in emit
jaeger_spans = self.translate_to_jaeger(span_datas)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/jaeger_exporter.py", line 208, in translate_to_jaeger
logs = _extract_logs_from_span(span)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/jaeger_exporter.py", line 283, in _extract_logs_from_span
fields = _extract_tags(annotation.attributes)
File "/Users/tw/.local/share/virtualenvs/census-K4PTEclS/lib/python3.6/site-packages/opencensus/trace/exporters/jaeger_exporter.py", line 302, in _extract_tags
for attribute_key, attribute_value in attr.items():
AttributeError: 'Attributes' object has no attribute 'items'

# Fixed code
def _extract_tags(attr):
    if attr is None:
        return []
    tags = []
    for attribute_key, attribute_value in attr.items():
        tag = _convert_attribute_to_tag(attribute_key, attribute_value)
        if tag is None:
            continue
        tags.append(tag)
    return tags
# Buggy code
def parse_get_bucket_location(parsed, http_response, **kwargs):
    # s3.GetBucketLocation cannot be modeled properly.  To
    # account for this we just manually parse the XML document.
    # The "parsed" passed in only has the ResponseMetadata
    # filled out.  This handler will fill in the LocationConstraint
    # value.
    if "LocationConstraint" in parsed:
        # Response already set - a stub?
        return
    response_body = http_response.content
    parser = xml.etree.cElementTree.XMLParser(
        target=xml.etree.cElementTree.TreeBuilder(), encoding="utf-8"
    )
    parser.feed(response_body)
    root = parser.close()
    region = root.text
    parsed["LocationConstraint"] = region


# Traceback (AttributeError)
Traceback (most recent call last):
File "untitled.py", line 24, in <module>
client.get_bucket_location(Bucket="meh")
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 655, in _make_api_call
model=operation_model, context=request_context
File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/usr/local/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/usr/local/lib/python3.7/site-packages/botocore/handlers.py", line 485, in parse_get_bucket_location
response_body = http_response.content
File "/usr/local/lib/python3.7/site-packages/botocore/awsrequest.py", line 587, in content
self._content = bytes().join(self.raw.stream()) or bytes()
AttributeError: 'NoneType' object has no attribute 'stream'

# Fixed code
def parse_get_bucket_location(parsed, http_response, **kwargs):
    # s3.GetBucketLocation cannot be modeled properly.  To
    # account for this we just manually parse the XML document.
    # The "parsed" passed in only has the ResponseMetadata
    # filled out.  This handler will fill in the LocationConstraint
    # value.
    if http_response.raw is None:
        return
    response_body = http_response.content
    parser = xml.etree.cElementTree.XMLParser(
        target=xml.etree.cElementTree.TreeBuilder(), encoding="utf-8"
    )
    parser.feed(response_body)
    root = parser.close()
    region = root.text
    parsed["LocationConstraint"] = region
# Buggy code
def _parse_error_from_body(self, response):
    xml_contents = response["body"]
    root = self._parse_xml_string_to_dom(xml_contents)
    parsed = self._build_name_to_xml_node(root)
    self._replace_nodes(parsed)
    if root.tag == "Error":
        # This is an S3 error response.  First we'll populate the
        # response metadata.
        metadata = self._populate_response_metadata(response)
        # The RequestId and the HostId are already in the
        # ResponseMetadata, but are also duplicated in the XML
        # body.  We don't need these values in both places,
        # we'll just remove them from the parsed XML body.
        parsed.pop("RequestId", "")
        parsed.pop("HostId", "")
        return {"Error": parsed, "ResponseMetadata": metadata}
    elif "RequestId" in parsed:
        # Other rest-xml serivces:
        parsed["ResponseMetadata"] = {"RequestId": parsed.pop("RequestId")}
    return parsed


# Traceback (KeyError)
from boto3.session import Session
sess = Session(region_name='us-east-1')
r53 = sess.client('route53')
zone = r53.list_hosted_zones_by_name(DNSName='example.com.')['HostedZones'][0]
zid = zone['Id']
r53.list_resource_record_sets(HostedZoneId=zid, StartRecordType='SOA')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mike/venv/stacker/lib/python2.7/site-packages/botocore-0.106.0-py2.7.egg/botocore/client.py", line 199, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/mike/venv/stacker/lib/python2.7/site-packages/botocore-0.106.0-py2.7.egg/botocore/client.py", line 254, in _make_api_call
raise ClientError(parsed_response, operation_name)
File "/Users/mike/venv/stacker/lib/python2.7/site-packages/botocore-0.106.0-py2.7.egg/botocore/exceptions.py", line 300, in __init__
error_message=error_response['Error']['Message'],
KeyError: 'Message'

# Fixed code
def _parse_error_from_body(self, response):
    xml_contents = response["body"]
    root = self._parse_xml_string_to_dom(xml_contents)
    parsed = self._build_name_to_xml_node(root)
    self._replace_nodes(parsed)
    if root.tag == "Error":
        # This is an S3 error response.  First we'll populate the
        # response metadata.
        metadata = self._populate_response_metadata(response)
        # The RequestId and the HostId are already in the
        # ResponseMetadata, but are also duplicated in the XML
        # body.  We don't need these values in both places,
        # we'll just remove them from the parsed XML body.
        parsed.pop("RequestId", "")
        parsed.pop("HostId", "")
        return {"Error": parsed, "ResponseMetadata": metadata}
    elif "RequestId" in parsed:
        # Other rest-xml serivces:
        parsed["ResponseMetadata"] = {"RequestId": parsed.pop("RequestId")}
    default = {"Error": {"Message": "", "Code": ""}}
    merge_dicts(default, parsed)
    return default
# Buggy code
def startElement(self, name, attrs):
    if name == "elliot":
        self.elliottag = True
    if name == "exploit" and self.elliottag:
        self.exploittag = True

    if self.exploittag:
        self.tag = name
        if self.tag == "name":
            self.nametag = True
            self.name = ""
        elif self.tag == "url":
            self.urltag = True
            self.url = ""
        elif self.tag == "ref":
            self.reftag = True
            self.reftype = attrs.getValue("type")
            if self.reftype == "CVE":
                self.refcvetag = True
                self.cveref = ""
            elif self.reftype != "CVE":
                self.refcvetag = False


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def startElement(self, name, attrs):
    if name == "elliot":
        self.elliottag = True
    if name == "exploit" and self.elliottag:
        self.exploittag = True

    if self.exploittag:
        self.tag = name
        if self.tag == "name":
            self.nametag = True
            self.name = ""
        elif self.tag == "url":
            self.urltag = True
            self.url = ""
        elif self.tag == "ref":
            self.reftag = True
            self.reftype = attrs.getValue("type")
            if self.reftype == "CVE":
                self.refcvetag = True
                self.cveref = ""
            elif self.reftype != "CVE":
                self.refcvetag = False
                self.cveref = False
# Buggy code
def endElement(self, name):
    if name == "ref":
        if self.cveref != "":
            self.refl.append(self.cveref.rstrip())
        self.reftag = False
    if name == "name":
        self.nametag = False
    if name == "url":
        self.urltag = False
    if name == "ref":
        self.reftag = False
    if name == "exploit":
        for refl in self.refl:
            self.d2sec.append({"name": self.name, "url": self.url, "id": refl})
        self.exploittag = False
        self.refl = []
    if name == "elliot":
        self.elliottag = False


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def endElement(self, name):
    if name == "ref":
        if self.cveref != "" and self.cveref:
            self.refl.append(self.cveref.rstrip())
        self.reftag = False
    if name == "name":
        self.nametag = False
    if name == "url":
        self.urltag = False
    if name == "ref":
        self.reftag = False
    if name == "exploit":
        for refl in self.refl:
            self.d2sec.append({"name": self.name, "url": self.url, "id": refl})
        self.exploittag = False
        self.refl = []
    if name == "elliot":
        self.elliottag = False
# Buggy code
def apiCVEFor(cpe):
    cpe = urllib.parse.unquote_plus(cpe)
    cpe = toStringFormattedCPE(cpe)
    if not cpe:
        cpe = "None"
    r = []
    cvesp = cves.last(
        rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False
    )
    for x in dbLayer.cvesForCPE(cpe):
        r.append(cvesp.getcve(x["id"]))
    return json.dumps(r)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apiCVEFor(cpe):
    cpe = urllib.parse.unquote_plus(cpe)
    cpe = toStringFormattedCPE(cpe)
    if not cpe:
        cpe = "None"
    r = []
    cvesp = cves.last(
        rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False
    )
    for x in dbLayer.cvesForCPE(cpe):
        r.append(cvesp.getcve(x["id"]))
    return json.dumps(r, default=json_util.default)
# Buggy code
def apiCVE(cveid):
    cvesp = cves.last(
        rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True
    )
    cve = cvesp.getcve(cveid=cveid)
    if cve is None:
        cve = {}
    return jsonify(cve)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apiCVE(cveid):
    cvesp = cves.last(
        rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True
    )
    cve = cvesp.getcve(cveid=cveid)
    if cve is None:
        cve = {}
    return jsonify(cve)
# Buggy code
def apibrowse(vendor=None):
    if vendor is not None:
        vendor = urllib.parse.quote_plus(vendor).lower()
    browseList = getBrowseList(vendor)
    if isinstance(browseList, dict):
        return jsonify(browseList)
    else:
        return jsonify({})


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apibrowse(vendor=None):
    if vendor is not None:
        vendor = urllib.parse.quote_plus(vendor).lower()
    browseList = getBrowseList(vendor)
    if isinstance(browseList, dict):
        return jsonify(browseList)
    else:
        return jsonify({})
# Buggy code
def apilast():
    limit = 30
    cvesp = cves.last(
        rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True
    )
    cve = cvesp.get(limit=limit)
    return jsonify({"results": cve})


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apilast():
    limit = 30
    cvesp = cves.last(
        rankinglookup=True, namelookup=True, vfeedlookup=True, capeclookup=True
    )
    cve = cvesp.get(limit=limit)
    return jsonify({"results": cve})
# Buggy code
def apisearch(vendor=None, product=None):
    if vendor is None or product is None:
        return jsonify({})
    search = vendor + ":" + product
    return json.dumps(dbLayer.cvesForCPE(search))


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apisearch(vendor=None, product=None):
    if vendor is None or product is None:
        return jsonify({})
    search = vendor + ":" + product
    return json.dumps(dbLayer.cvesForCPE(search), default=json_util.default)
# Buggy code
def apidbInfo():
    return json.dumps(dbLayer.getDBStats())


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apidbInfo():
    return json.dumps(dbLayer.getDBStats(), default=json_util.default)
# Buggy code
def apiCVEFor(cpe):
    cpe = urllib.parse.unquote_plus(cpe)
    cpe = toStringFormattedCPE(cpe)
    r = []
    cvesp = cves.last(
        rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False
    )
    for x in db.cvesForCPE(cpe):
        r.append(cvesp.getcve(x["id"]))
    return json.dumps(r)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apiCVEFor(cpe):
    cpe = urllib.parse.unquote_plus(cpe)
    cpe = toStringFormattedCPE(cpe)
    r = []
    cvesp = cves.last(
        rankinglookup=False, namelookup=False, vfeedlookup=True, capeclookup=False
    )
    for x in db.cvesForCPE(cpe):
        r.append(cvesp.getcve(x["id"]))
    return json.dumps(r, default=json_util.default)
# Buggy code
def apisearch(vendor=None, product=None):
    if vendor is None or product is None:
        return jsonify({})
    search = vendor + ":" + product
    return json.dumps(db.cvesForCPE(search))


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apisearch(vendor=None, product=None):
    if vendor is None or product is None:
        return jsonify({})
    search = vendor + ":" + product
    return json.dumps(db.cvesForCPE(search), default=json_util.default)
# Buggy code
def apidbInfo():
    return json.dumps(db.getDBStats())


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def apidbInfo():
    return json.dumps(db.getDBStats(), default=json_util.default)
# Buggy code
def getFilterSettingsFromPost(r):
    filters = dict(request.form)
    filters = {x: filters[x][0] for x in filters.keys()}
    errors = False
    # retrieving data
    try:
        cve = filter_logic(filters, pageLength, r)
    except:
        cve = db.getCVEs(limit=pageLength, skip=r)
        errors = True
    return (filters, cve, errors)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def getFilterSettingsFromPost(r):
    filters = dict(request.form)
    filters = {x: filters[x][0] for x in filters.keys()}
    errors = False
    # retrieving data
    try:
        cve = filter_logic(filters, pageLength, r)
    except:
        cve = dbLayer.getCVEs(limit=pageLength, skip=r)
        errors = True
    return (filters, cve, errors)
# Buggy code
def isURLFilter(string):
    return isURL(string)


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 109, in <module>
parser.parse(f)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "../Modules/pyexpat.c", line 459, in EndElement
File "/usr/lib/python3.4/xml/sax/expatreader.py", line 307, in end_element
self._cont_handler.endElement(name)
File "/home/PidgeyL/git/PidgeyL/cve-search/sbin/db_mgmt_d2sec.py", line 74, in endElement
if self.cveref != "":
AttributeError: 'ExploitHandler' object has no attribute 'cveref'

# Fixed code
def isURLFilter(s):
    return isinstance(s, list)
# Buggy code
def masterLogin():
    master = input("Master account username: ")
    masterPass = hashlib.sha256(
        bytes(getpass.getpass("Master password:"), "utf-8")
    ).hexdigest()
    if (
        collection.find(
            {"username": master, "password": masterPass, "master": True}
        ).count()
        == 0
    ):
        sys.exit("Master user/password combination does not exist")
    return True


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def masterLogin():
    master = input("Master account username: ")
    masterPass = buildPassword(getpass.getpass("Master password:"), user=master)
    if (
        collection.find(
            {"username": master, "password": masterPass, "master": True}
        ).count()
        == 0
    ):
        sys.exit("Master user/password combination does not exist")
    return True
# Buggy code
def existsInDB(user):
    return True if collection.find({"username": username}).count() > 0 else False


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def existsInDB(user):
    return True if collection.find({"username": user}).count() > 0 else False
# Buggy code
def login_check():
    # validate username and password
    username = request.form.get("username")
    password = hashlib.sha256(bytes(request.form.get("password"), "utf-8")).hexdigest()

    person = User.get(username)
    if person and person.password == password:
        login_user(person)
        return render_template("admin.html", status=["logged_in", "success"])
    else:
        return render_template("login.html", status=["wrong_combination", "error"])


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def login_check():
    users = db.mgmt_users
    # validate username and password
    username = request.form.get("username")
    # get salt
    if users.find({"username": username}).count() > 0:
        if users.find({"username": username, "salt": {"$exists": True}}).count() > 0:
            salt = (list(users.find({"username": username}))[0])["salt"]
        else:
            return render_template("login.html", status=["outdated_database", "error"])
        # catch empyt
    else:
        salt = bytearray()
    password = hashlib.sha256(
        salt + bytes(request.form.get("password"), "utf-8")
    ).hexdigest()
    person = User.get(username)
    if person and person.password == password:
        login_user(person)
        return render_template("admin.html", status=["logged_in", "success"])
    else:
        return render_template("login.html", status=["wrong_combination", "warning"])
# Buggy code
def importList(self, importFile):
    count = 0
    # read each line from the import file and regex them to a cpe format
    try:
        for line in open(importFile):
            if self.insert(line):
                count += 1
        if self.args.v:
            print("{:d} products added to the list".format(count))
    except IOError:
        print("Could not open the file")
        sys.exit()


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def importList(self, importFile):
    count = 0
    # read each line from the import file and regex them to a cpe format
    try:
        for line in importFile:
            if self.insert(line):
                count += 1
        if self.args.v:
            print("{:d} products added to the list".format(count))
    except IOError:
        print("Could not open the file")
        sys.exit()
# Buggy code
def whitelistImport(force=None, path=None):
    path = request.form.get("file")
    force = request.form.get("force")
    if matchFilePath(path):
        if os.path.isfile(path):
            count = countWhitelist()
            if (count == 0) | (not count) | (force == "f"):
                dropWhitelist()
                importWhitelist(path)
                status = ["wl_imported", "success"]
            else:
                status = ["wl_already_filled", "info"]
        else:
            status = ["invalid_path", "error"]
    else:
        status = ["invalid_path_format", "error"]
    return render_template("admin.html", status=status)


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def whitelistImport(force=None, path=None):
    file = request.files["file"]
    force = request.form.get("force")
    count = countWhitelist()
    if (count == 0) | (not count) | (force == "f"):
        dropWhitelist()
        importWhitelist(TextIOWrapper(file.stream))
        status = ["wl_imported", "success"]
    else:
        status = ["wl_already_filled", "info"]
    return render_template("admin.html", status=status)
# Buggy code
def whitelistExport(force=None, path=None):
    path = request.form.get("file")
    force = request.form.get("force")
    if matchFilePath(path):
        if (force == "df") and (os.path.isfile(path)):
            status = ["wl_file_already_exists", "warning"]
        else:
            if os.path.isfile(path):
                os.remove(path)
            exportWhitelist(path)
            status = ["wl_exported", "success"]
    else:
        status = ["invalid_path", "error"]
    return render_template("admin.html", status=status)


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def whitelistExport(force=None, path=None):
    file = request.files["file"]
    filename = secure_filename(file.filename)
    force = request.form.get("force")
    if (force == "df") and (os.path.isfile(filename)):
        status = ["wl_file_already_exists", "warning"]
    else:
        if os.path.isfile(filename):
            os.remove(filename)
        exportWhitelist(filename)
        status = ["wl_exported", "success"]
    return render_template("admin.html", status=status)
# Buggy code
def blacklistImport():
    path = request.form.get("file")
    force = request.form.get("force")
    if matchFilePath(path):
        if os.path.isfile(path):
            count = countBlacklist()
            if (count == 0) | (not count) | (force == "f"):
                dropBlacklist()
                importBlacklist(path)
                status = ["bl_imported", "success"]
            else:
                status = ["bl_already_filled", "info"]
        else:
            status = ["invalid_path", "error"]
    else:
        status = ["invalid_path_format", "error"]
    return render_template("admin.html", status=status)


# Traceback (TypeError)
Starting vendor
Traceback (most recent call last):                           ] 0/1440
File ".../cve-search/db_mgmt_vendorstatements.py", line 83, in <module>
bulk.find({'id': statement['id']}).upsert().update({'id': statement['id']}, {"$set":{'statement': statement['statement'], 'id': statement['id'], 'organization': statement['organization'], 'contributor': statement['contributor'], 'lastmodified': statement['lastmodified']}})
TypeError: update() takes 2 positional arguments but 3 were given

# Fixed code
def blacklistImport():
    file = request.files["file"]
    force = request.form.get("force")
    count = countBlacklist()
    if (count == 0) | (not count) | (force == "f"):
        dropBlacklist()
        importBlacklist(TextIOWrapper(file.stream))
        status = ["bl_imported", "success"]
    else:
        status = ["bl_already_filled", "info"]
    return render_template("admin.html", status=status)