Article Contribution Detail (version 0.1a)
index
/Users/tim/Counter.py

acd - Interface for contribution detail in Mediawiki databases.
 
A collection of classes allowing one to count the total number of edits to a specific article in a Mediawiki database, as well as list the users who have edited it with their number of edits.
 
Copyright (C) 2007 Tim Abdulla. All rights reserved.

 
Modules
       
MySQLdb

 
Classes
       
Counter
CustomCounter
HTMLCounter
ParsableCounter

 
class Counter
    Counts the number of edits in a specific article and lists the user who have contributed to said article.
 
Used as an ancestor class for a variety of sub-classes that utilise this output.
 
  Methods defined here:
__init__(self, connection, pageName, namespace)
Constructor.
 
Arguments:
connection: a valid MySQL database connection
pageName  : a well formatted article name (must be preprocessed before being sent here)
namespace : an English, human-readable name of a Mediawiki namespace
 
Returns zip.
countContributions(self, hideMinorEdits=False)
Counts the amount of edits to a specific article. Also counts the number of users who have contributed, and creates a tuple of the user and their number of edits.
 
Arguments:
hideMinorEdits: a boolean to stiuplate whether or not to count minor edits
 
Returns:
totalEdits         : the total number of edits to an article
totalUsers         : the total number of users who have contributed to an article
detailedInformation: a tuple of tuples containing the users who have contributed to an article and their number of edits e.g. ( (3, 'Tim'), (2, 'Dave') )

 
class CustomCounter(Counter)
    Sub-class of Counter. Allows one to create a custom view of contribution data.
 
  Methods defined here:
__init__(self, connection, pageName, namespace, hideMinorEdits=False)
__str__(self)
generateOutput(self)
loadTemplate(self, summaryTemplate, morselTemplate)
Loads user-specificed templates into memory.
 
Arguments:
summaryTemplate: the template for the summary of data. Can include the following substitutions: %article% (article name), %namespace%, %totaledits%, %totalusers%
morselTemplate : the template for individual users and their number of edits. Can include the following substitutions: %user% (user who made the edits), %edits% (their number of edits)

Methods inherited from Counter:
countContributions(self, hideMinorEdits=False)
Counts the amount of edits to a specific article. Also counts the number of users who have contributed, and creates a tuple of the user and their number of edits.
 
Arguments:
hideMinorEdits: a boolean to stiuplate whether or not to count minor edits
 
Returns:
totalEdits         : the total number of edits to an article
totalUsers         : the total number of users who have contributed to an article
detailedInformation: a tuple of tuples containing the users who have contributed to an article and their number of edits e.g. ( (3, 'Tim'), (2, 'Dave') )

 
class HTMLCounter(Counter)
    A sub-class of Counter. Same deal, but this time it will output to HTML.
 
  Methods defined here:
__init__(self, connection, pageName, namespace, hideMinorEdits=False)
Constructor.
 
Same arguments as in the ancestor class, except for hideMinorEdits which is a boolean that determines whether or not minor edits will be included in the query.
__str__(self)
Creates string representation of object.
 
Example:
>>> myPage = HTMLCounter (  validConnection, "Tim Abdulla", "Articles", False )
>>> print myPage
>>> <table> [...]
generateOutput(self)
Generates the HTML output.
 
Returns:
htmlOutput: a string containing the HTML output (suprise!)

Methods inherited from Counter:
countContributions(self, hideMinorEdits=False)
Counts the amount of edits to a specific article. Also counts the number of users who have contributed, and creates a tuple of the user and their number of edits.
 
Arguments:
hideMinorEdits: a boolean to stiuplate whether or not to count minor edits
 
Returns:
totalEdits         : the total number of edits to an article
totalUsers         : the total number of users who have contributed to an article
detailedInformation: a tuple of tuples containing the users who have contributed to an article and their number of edits e.g. ( (3, 'Tim'), (2, 'Dave') )

 
class ParsableCounter(Counter)
    Sub-class of Counter. Creates a machine-parsable view of data.
 
  Methods defined here:
__init__(self, connection, pageName, namespace, hideMinorEdits=False)
__str__(self)
generateOutput(self)

Methods inherited from Counter:
countContributions(self, hideMinorEdits=False)
Counts the amount of edits to a specific article. Also counts the number of users who have contributed, and creates a tuple of the user and their number of edits.
 
Arguments:
hideMinorEdits: a boolean to stiuplate whether or not to count minor edits
 
Returns:
totalEdits         : the total number of edits to an article
totalUsers         : the total number of users who have contributed to an article
detailedInformation: a tuple of tuples containing the users who have contributed to an article and their number of edits e.g. ( (3, 'Tim'), (2, 'Dave') )

 
Data
        __author__ = 'Tim Abdulla'
__license__ = 'MIT'
__version__ = '0.1a'

 
Author
        Tim Abdulla