Sfoglia il codice sorgente

Code cleanup and bugfixes

tags/v0.1^2
Ben Kurtovic 12 anni fa
parent
commit
00ae6f8e46
4 ha cambiato i file con 6 aggiunte e 10 eliminazioni
  1. +0
    -2
      earwigbot/commands/praise.py
  2. +2
    -2
      earwigbot/config.py
  3. +1
    -1
      earwigbot/wiki/site.py
  4. +3
    -5
      earwigbot/wiki/sitesdb.py

+ 0
- 2
earwigbot/commands/praise.py Vedi File

@@ -20,8 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import random

from earwigbot.commands import BaseCommand

class Command(BaseCommand):


+ 2
- 2
earwigbot/config.py Vedi File

@@ -90,7 +90,7 @@ class BotConfig(object):
with open(filename, 'r') as fp:
try:
self._data = yaml.load(fp)
except yaml.YAMLError as error:
except yaml.YAMLError:
print "Error parsing config file {0}:".format(filename)
raise

@@ -137,7 +137,7 @@ class BotConfig(object):
"""Try to decrypt the contents of a config node. Use self.decrypt()."""
try:
node._decrypt(self._decryption_key, nodes[:-1], nodes[-1])
except blowfish.BlowfishError as error:
except blowfish.BlowfishError:
print "Error decrypting passwords:"
raise



+ 1
- 1
earwigbot/wiki/site.py Vedi File

@@ -138,7 +138,7 @@ class Site(object):
if logger:
self._logger = logger
else: # Just set up a null logger to eat up our messages:
self._logger = getLogger("earwigbot.wiki").getChild(self._name)
self._logger = getLogger("earwigbot.wiki")
self._logger.addHandler(NullHandler())

# If we have a name/pass and the API says we're not logged in, log in:


+ 3
- 5
earwigbot/wiki/sitesdb.py Vedi File

@@ -22,7 +22,6 @@

from cookielib import LWPCookieJar, LoadError
import errno
from getpass import getpass
from os import chmod, path
from platform import python_version
import stat
@@ -87,8 +86,8 @@ class SitesDB(object):
if e.errno == errno.ENOENT: # "No such file or directory"
# Create the file and restrict reading/writing only to the
# owner, so others can't peak at our cookies:
open(cookie_file, "w").close()
chmod(cookie_file, stat.S_IRUSR|stat.S_IWUSR)
open(self._cookie_file, "w").close()
chmod(self._cookie_file, stat.S_IRUSR|stat.S_IWUSR)
else:
raise

@@ -344,7 +343,6 @@ class SitesDB(object):
assert_edit = config.wiki.get("assert")
maxlag = config.wiki.get("maxlag")
wait_between_queries = config.wiki.get("waitTime", 5)
logger = self._logger.getChild(name)
search_config = config.wiki.get("search")

# Create a Site object to log in and load the other attributes:
@@ -352,7 +350,7 @@ class SitesDB(object):
login=login, cookiejar=cookiejar, user_agent=user_agent,
use_https=use_https, assert_edit=assert_edit,
maxlag=maxlag, wait_between_queries=wait_between_queries,
logger=logger, search_config=search_config)
search_config=search_config)

self._add_site_to_sitesdb(site)
self._sites[site.name()] = site


Caricamento…
Annulla
Salva