remove our ReadOnly option, which was an ugly hack, and use PersistentCache instead

This commit is contained in:
Elián Hanisch
2010-04-02 18:32:19 -03:00
parent 9b0a5d4180
commit fd55f019e1
2 changed files with 7 additions and 27 deletions

View File

@ -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."))