remove our ReadOnly option, which was an ugly hack, and use PersistentCache instead
This commit is contained in:
@ -23,26 +23,6 @@ class SpaceSeparatedListOfTypes(registry.SpaceSeparatedListOf):
|
||||
Value = ValidTypes
|
||||
|
||||
|
||||
# This little hack allows me to store last time bans were checked for review
|
||||
# and guarantee that nobody will edit it.
|
||||
# I'm using a registry option instead of the SQL db because this is much simpler.
|
||||
class ReadOnlyValue(registry.Integer):
|
||||
"""This is a read only option."""
|
||||
def __init__(self, *args, **kwargs):
|
||||
registry.Integer.__init__(self, *args, **kwargs)
|
||||
self.value = None
|
||||
|
||||
def set(self, s):
|
||||
try:
|
||||
if not self.value:
|
||||
self.setValue(int(s))
|
||||
else:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
#self.error() # commented, this causes a lot of trouble.
|
||||
pass
|
||||
|
||||
|
||||
def configure(advanced):
|
||||
conf.registerPlugin('Bantracker', True)
|
||||
|
||||
@ -74,9 +54,6 @@ conf.registerChannelValue(Bantracker.commentRequest.forward, 'channels',
|
||||
|
||||
|
||||
# temp config
|
||||
conf.registerGlobalValue(Bantracker, 'reviewTime',
|
||||
ReadOnlyValue(0,
|
||||
"Timestamp used internally for identify bans that need review. Can't and shouldn't be edited."))
|
||||
conf.registerGlobalValue(Bantracker, 'reviewAfterTime',
|
||||
registry.Float(7,
|
||||
"Days after which the bot will request for review a ban. Can be an integer or decimal value."))
|
||||
|
Reference in New Issue
Block a user