| DataGlove | WorkShops | HackGPRS | 
Hack SupybotThe first plugin prove that shows the ranking top pages at TikiWiki in the irc whit the command tikitoppages (a modification on http://supybot.com/documentation/help/tutorial/plugin-author-tutorial/tutorial-all-pages): TikiTopPages$ ls config.py __init__.py plugin.py README.txt test.py TikiTopPages/config.py 
import supybot.conf as conf
import supybot.registry as registry
def configure(advanced):
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('TikiTopPages', True)
    
TikiTopPages = conf.registerPlugin('TikiTopPages')
TikiTopPages/plugin.py 
plugin.pyimport supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
import MySQLdb
class Tdb:
    """Helper class to connect to database."""
    def __init__(self):
        try:
            connection = MySQLdb.connect(host="localhost",
            user="tikiwiki", passwd="xxxxxxx", db="tikidb" )
            cursor = connection.cursor()
            cursor.execute( "select `pageName`, `hits` from `tiki_pages` order by `hits` desc " )
        except MySQLdb.OperationalError, message:
                errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] )
                return
        else:
            self.data =    cursor.fetchall()                                                                          
            self.fields = cursor.description
            cursor.close()
            connection.close()
class TikiTopPages(callbacks.Plugin):
    """This plugin shows the top pages at TikiWiki."""
    def __init__(self, irc):
        self.__parent = super(TikiTopPages, self)
        self.__parent.__init__(irc)
        db = Tdb()
        lineas=""
        for row in range(len(db.data)):
            self.lineas=lineas+db.data[row][0]+"-->"+str(db.data[row][1])+"\n"
    def tikitoppages(self, irc, msg, args):
        """Returns the top pages."""
        irc.reply(self.lineas)
    tikitoppages = wrap(tikitoppages)
Class = TikiTopPages
version 2I used your code but ran the supy-newplugin command, that generated a TikiTop.py file with everything in it. So I made a one-file plugin instead of a dir.
###
# Copyright (c) 2005, Dankajh, Mose
# 
# 
###
"""
Experimental plugin too request a tikiwiki database.
"""
import supybot
__revision__ = "1.0"
__author__ = "dankajh"
__contributors__ = { }
import supybot.conf as conf
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs
import supybot.registry as registry
import supybot.callbacks as callbacks
import MySQLdb
def configure(advanced): 
  from supybot.questions import expect, anything, something, yn
  conf.registerPlugin('TikiTop', True)
conf.registerPlugin('TikiTop')
# This is where your configuration variables (if any) should go.
class Tdb:
  """Helper class to connect to database."""
  def __init__(self, irc):
    try:
      connection = MySQLdb.connect(host="localhost", user="xxx", passwd="xxx", db="tiki_xxx" )
      cursor = connection.cursor()
      cursor.execute( "select `pageName`, `hits` from `tiki_pages` order by `hits` desc limit 5" )
    except MySQLdb.OperationalError, message:
      errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] )
      return
    else:
      self.data = cursor.fetchall()
      self.fields = cursor.description
      cursor.close()
      connection.close()
class TikiTop(callbacks.Privmsg):
  def tikitop(self, irc, msg, args):
    """Returns the top pages."""
    db = Tdb(irc)
    lineas=""
    for row in range(len(db.data)):
      lineas = lineas + db.data[row][0] + " (" + str(db.data[row][1]) + ") - "
    irc.reply(lineas)
  tikitop = wrap(tikitop)
Class = TikiTop
# vim:set shiftwidth=2 tabstop=2 textwidth=120:
Version 3I hacked further and reached some dirty result. That code should be enhanced it's noob work.plugins/Tiki.py 
###
# Copyright (c) 2005, Dankajh, Mose
# 
# 
###
"""
Experimental plugin to request a tikiwiki database.
"""
import supybot
__revision__ = "1.0"
__author__ = "dankajh"
__contributors__ = { }
import supybot.conf as conf
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.privmsgs as privmsgs
import supybot.registry as registry
import supybot.callbacks as callbacks
import supybot.webutils as webutils
import MySQLdb
def configure(advanced):
  from supybot.questions import expect, output, anything, something, yn
  conf.registerPlugin('Tiki', True)
conf.registerPlugin('Tiki')
class Tiki(callbacks.Privmsg):
  threaded = True
  def tiki(self, irc, msg, args, word):
    """Returns pages found."""
    try:
      connection = MySQLdb.connect(host="localhost", user="xxx", passwd="xxx", db="tiki_xxx" )
      cursor = connection.cursor()
      cursor.execute("select pageName, hits from tiki_pages where pageName like '%" + word + "%' order by pageName limit 3")
    except MySQLdb.OperationalError, message:
      irc.reply(errorMessage)
    else:
      data = cursor.fetchall()
      for row in range(len(data)):
        irc.reply( "http://caracas.trollparty.org/" + webutils.urlquote(data[row][0]) + " (" + str(data[row][1]) + " hits)")
  tiki = wrap(tiki, ['text'])
Class = Tiki
# vim:set shiftwidth=2 tabstop=2 textwidth=120:
RequirementsItems' list that should be implemented as Tiki class' methods and corresponds to different queries to the TikiWiki DB:
 Who works on it ? | ||
| DataGlove | WorkShops | HackGPRS |