Update ancient hacking version

This version should work with modern python.  Fix up a few minor
formatting things it picks up.

Change-Id: Ie9bebfa5eacc53aa8cbc857c48c7b71c55141864
This commit is contained in:
Ian Wienand 2022-11-16 08:27:31 +11:00
parent 37fb799a1e
commit a973d8572b
No known key found for this signature in database
2 changed files with 19 additions and 12 deletions

View File

@ -167,11 +167,14 @@ class SuccessPage(object):
self.backend = backend(config)
self.ready = False
if isinstance(self.backend, WikiPage):
self.backend.pageid = config.get('wiki', 'successpageid', fallback=None)
self.backend.pageurl = config.get('wiki', 'successpageurl', fallback=None)
self.backend.pageid = config.get('wiki', 'successpageid',
fallback=None)
self.backend.pageurl = config.get('wiki', 'successpageurl',
fallback=None)
self.ready = self.backend.pageid is not None
elif isinstance(self.backend, EtherPage):
self.backend.pad = config.get('etherpad', 'successpad', fallback=None)
self.backend.pad = config.get('etherpad', 'successpad',
fallback=None)
self.ready = self.backend.pad is not None
if config.has_option('irclogs', 'url'):
self.irclogs_url = config.get('irclogs', 'url')
@ -200,11 +203,14 @@ class ThanksPage(object):
def __init__(self, config, backend):
self.backend = backend(config)
if isinstance(self.backend, WikiPage):
self.backend.pageid = config.get('wiki', 'thankspageid', fallback=None)
self.backend.pageurl = config.get('wiki', 'thankspageurl', fallback=None)
self.backend.pageid = config.get('wiki', 'thankspageid',
fallback=None)
self.backend.pageurl = config.get('wiki', 'thankspageurl',
fallback=None)
self.ready = self.backend.pageid is not None
elif isinstance(self.backend, EtherPage):
self.backend.pad = config.get('etherpad', 'thankspad', fallback=None)
self.backend.pad = config.get('etherpad', 'thankspad',
fallback=None)
self.ready = self.backend.pad is not None
if config.has_option('irclogs', 'url'):
self.irclogs_url = config.get('irclogs', 'url')
@ -266,7 +272,7 @@ class Tweet(UpdateInterface):
if len(tweets) > 1:
for i in range(0, len(tweets)):
tweet = tweets[i]
tweets[i] = tweet + " %d/%d" % (i+1, len(tweets))
tweets[i] = tweet + " %d/%d" % (i + 1, len(tweets))
try:
prior_tweet = None
@ -274,10 +280,11 @@ class Tweet(UpdateInterface):
if not prior_tweet:
prior_tweet = self.api.update_status(status=tweet)
else:
prior_tweet = self.api.update_status(status=tweet,
in_reply_to_status_id = prior_tweet.id,
auto_populate_reply_metadata=True)
except tweepy.TweepyException as e:
prior_tweet = self.api.update_status(
status=tweet,
in_reply_to_status_id=prior_tweet.id,
auto_populate_reply_metadata=True)
except tweepy.TweepyException:
self.logger.exception("Failed to tweet")
def alert(self, msg=None):

View File

@ -1 +1 @@
hacking<0.11,>=0.10.0
hacking