Commit a0133226 authored by Oliver Rümpelein's avatar Oliver Rümpelein

Merge branch 'hotfixes' into 'master'

Hotfixes

Primarily renaming

See merge request !1
parents 12b94ea2 e01639dc
[Core]
Name = CiteSystem
Module = cite
Module = citesystem
[Python]
Version = 3
......
......@@ -19,7 +19,7 @@ CONFIG_TEMPLATES = {
}
class CiteSystem:
class Cite:
# noinspection PyShadowingBuiltins
def __init__(self, id=0, cite="",
added="", addedby="",
......@@ -33,7 +33,7 @@ class CiteSystem:
@staticmethod
def json_to_cite(jsoncite):
return CiteSystem(**jsoncite)
return Cite(**jsoncite)
@staticmethod
def __needsdecode(tstr):
......@@ -124,7 +124,7 @@ class CiteSqlite:
answer = self.db.fetchone()
if answer:
# Extract Infos from reply
return CiteSystem(
return Cite(
id=answer[0],
cite=answer[1],
added=answer[2],
......@@ -133,7 +133,7 @@ class CiteSqlite:
changedby=answer[5]
)
else:
return CiteSystem()
return Cite()
def get(self, index):
self.db.execute(self.__q_getCite, str(index))
......@@ -141,7 +141,7 @@ class CiteSqlite:
print(answer)
if answer and len(answer) == 6:
# Extract Infos from reply
return CiteSystem(
return Cite(
id=answer[0],
cite=answer[1],
added=answer[2],
......@@ -150,7 +150,7 @@ class CiteSqlite:
changedby=answer[5]
)
else:
return CiteSystem()
return Cite()
def add_cite(self, cite, name):
self.db.execute(self.__q_addCite, (cite, name))
......@@ -180,17 +180,17 @@ class JsonCiteAPI:
def get_random_cite(self):
reply = self.requests.get(self.getUrl)
if reply.status_code == 200:
return CiteSystem.json_to_cite(reply.json())
return Cite.json_to_cite(reply.json())
else:
return CiteSystem()
return Cite()
def get(self, index):
reply = self.requests.get(self.getUrl + "/" + str(index))
print(reply.status_code)
if reply.status_code == 200:
return CiteSystem.json_to_cite(reply.json())
return Cite.json_to_cite(reply.json())
else:
return CiteSystem()
return Cite()
def add_cite(self, cite, name):
payload = {"author": name, "cite": cite}
......@@ -202,7 +202,7 @@ class JsonCiteAPI:
return "Adding failed."
class CiteAPI(BotPlugin):
class CiteSystem(BotPlugin):
"""API to the F3LCite system"""
# Uncomment this to use sqlite
# db_location = "/home/oliver/.f3lcites.db"
......@@ -292,7 +292,7 @@ a valid index?"
)
else:
config = CONFIG_TEMPLATES
super(CiteAPI, self).configure(config)
super(CiteSystem, self).configure(config)
def check_configuration(self, configuration: Mapping):
if configuration is {}:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment