mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Aka: Fix support for non-ascii commands name with Python 2 (bug introduced in 64300b8a02).
This commit is contained in:
parent
dd37f8dd3f
commit
e1d0ab2774
@ -100,9 +100,9 @@ if sqlalchemy:
|
|||||||
|
|
||||||
|
|
||||||
def has_aka(self, channel, name):
|
def has_aka(self, channel, name):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
count = self.get_db(channel).query(Alias) \
|
count = self.get_db(channel).query(Alias) \
|
||||||
.filter(Alias.name == name) \
|
.filter(Alias.name == name) \
|
||||||
.count()
|
.count()
|
||||||
@ -112,9 +112,9 @@ if sqlalchemy:
|
|||||||
return list_
|
return list_
|
||||||
|
|
||||||
def get_alias(self, channel, name):
|
def get_alias(self, channel, name):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
try:
|
try:
|
||||||
return self.get_db(channel).query(Alias.alias) \
|
return self.get_db(channel).query(Alias.alias) \
|
||||||
.filter(Alias.name == name).one()[0]
|
.filter(Alias.name == name).one()[0]
|
||||||
@ -135,17 +135,17 @@ if sqlalchemy:
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def remove_aka(self, channel, name):
|
def remove_aka(self, channel, name):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
db = self.get_db(channel)
|
db = self.get_db(channel)
|
||||||
db.query(Alias).filter(Alias.name == name).delete()
|
db.query(Alias).filter(Alias.name == name).delete()
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def lock_aka(self, channel, name, by):
|
def lock_aka(self, channel, name, by):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
db = self.get_db(channel)
|
db = self.get_db(channel)
|
||||||
try:
|
try:
|
||||||
aka = db.query(Alias) \
|
aka = db.query(Alias) \
|
||||||
@ -160,9 +160,9 @@ if sqlalchemy:
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def unlock_aka(self, channel, name, by):
|
def unlock_aka(self, channel, name, by):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
db = self.get_db(channel)
|
db = self.get_db(channel)
|
||||||
try:
|
try:
|
||||||
aka = db.query(Alias) \
|
aka = db.query(Alias) \
|
||||||
@ -177,9 +177,9 @@ if sqlalchemy:
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def get_aka_lock(self, channel, name):
|
def get_aka_lock(self, channel, name):
|
||||||
|
name = callbacks.canonicalName(name)
|
||||||
if sys.version_info[0] < 3 and isinstance(name, str):
|
if sys.version_info[0] < 3 and isinstance(name, str):
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
name = callbacks.canonicalName(name)
|
|
||||||
try:
|
try:
|
||||||
return self.get_db(channel) \
|
return self.get_db(channel) \
|
||||||
.query(Alias.locked, Alias.locked_by, Alias.locked_at)\
|
.query(Alias.locked, Alias.locked_by, Alias.locked_at)\
|
||||||
|
Loading…
Reference in New Issue
Block a user