From c89600433d4e7be5ee1efe58360b71cc00176f96 Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 1 Nov 2015 18:42:39 -0800 Subject: [PATCH] Bugfix / update docs for AttributeStorageLite, NickUser --- docs/api/modules/attributestoragelite.rst | 2 +- docs/api/modules/nickuser.rst | 20 +++++++++++++++++++- pyircbot/modules/AttributeStorageLite.py | 15 ++++++++------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/api/modules/attributestoragelite.rst b/docs/api/modules/attributestoragelite.rst index 29b719e..1ad4b68 100644 --- a/docs/api/modules/attributestoragelite.rst +++ b/docs/api/modules/attributestoragelite.rst @@ -1,7 +1,7 @@ :mod:`AttributeStorageLite` --- Item key/value storage ====================================================== -With a SQLite backend. +:doc:`AttributeStorage ` with a SQLite backend. Class Reference --------------- diff --git a/docs/api/modules/nickuser.rst b/docs/api/modules/nickuser.rst index 1906665..73c3d3e 100644 --- a/docs/api/modules/nickuser.rst +++ b/docs/api/modules/nickuser.rst @@ -1,7 +1,25 @@ :mod:`NickUser` --- A simple authentication service =================================================== -A module providing a simple login/logout account service +A module providing a simple login/logout account service. "Trust" is based upon +hostname - logging in autorizes your current hostname for your account data, +which is tied to your nick. + +Commands +-------- + +.. cmdoption:: .setpass + + Set or change your password. Users with a password already must provide the + old password to set a new one. + +.. cmdoption:: .login + + Log into your account (authorize your current hostname) + +.. cmdoption:: .logout + + Log out of account (deauthorize your current hostname) Class Reference --------------- diff --git a/pyircbot/modules/AttributeStorageLite.py b/pyircbot/modules/AttributeStorageLite.py index 0669047..0f2322b 100755 --- a/pyircbot/modules/AttributeStorageLite.py +++ b/pyircbot/modules/AttributeStorageLite.py @@ -17,13 +17,14 @@ class AttributeStorageLite(ModuleBase): self.db = None serviceProviders = self.bot.getmodulesbyservice("sqlite") if len(serviceProviders)==0: - self.log.error("AttributeStorage: Could not find a valid sqlite service provider") + self.log.error("Could not find a valid sqlite service provider") + raise Exception("No sqlite provider available") else: - self.log.info("AttributeStorage: Selecting sqlite service provider: %s" % serviceProviders[0]) + self.log.info("Selecting sqlite service provider: %s" % serviceProviders[0]) self.db = serviceProviders[0].opendb("attributes.db") if not self.db.tableExists("attribute"): - self.log.info("AttributeStorage: Creating table: attribute") + self.log.info("Creating table: attribute") c = self.db.query("""CREATE TABLE IF NOT EXISTS `attribute` ( `id` INTEGER PRIMARY KEY, `attribute` varchar(128) UNIQUE @@ -31,7 +32,7 @@ class AttributeStorageLite(ModuleBase): c.close() if not self.db.tableExists("items"): - self.log.info("AttributeStorage: Creating table: items") + self.log.info("Creating table: items") c = self.db.query("""CREATE TABLE IF NOT EXISTS `items` ( `id` INTEGER PRIMARY KEY, `item` varchar(512) @@ -39,7 +40,7 @@ class AttributeStorageLite(ModuleBase): c.close() if not self.db.tableExists("values"): - self.log.info("AttributeStorage: Creating table: values") + self.log.info("Creating table: values") c = self.db.query("""CREATE TABLE IF NOT EXISTS `values` ( `itemid` INTEGER NOT NULL, `attributeid` INTEGER NOT NULL, @@ -160,9 +161,9 @@ class AttributeStorageLite(ModuleBase): if value == None: # delete it c = self.db.query("DELETE FROM `values` WHERE `itemid`=? AND `attributeid`=? ;", (itemId, attributeId)) - self.log.debug("AttributeStorage: Stored item %s attribute %s value: %s (Deleted)" % (itemId, attributeId, value)) + self.log.debug("Stored item %s attribute %s value: %s (Deleted)" % (itemId, attributeId, value)) else: # add attribute c = self.db.query("REPLACE INTO `values` (`itemid`, `attributeid`, `value`) VALUES (?, ?, ?);", (itemId, attributeId, value)) - self.log.debug("AttributeStorage: Stored item %s attribute %s value: %s" % (itemId, attributeId, value)) + self.log.debug("Stored item %s attribute %s value: %s" % (itemId, attributeId, value)) c.close()