Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of WikiDiffTutorial


Ignore:
Timestamp:
11/18/05 13:17:06 (14 years ago)
Author:
SuperJared <jared.kuolt@…>
Comment:

Added information to links; Added python beautification

Legend:

Unmodified
Added
Removed
Modified
  • WikiDiffTutorial

    v1 v2  
    3131 * Page highlights 
    3232 {{{ 
     33 #!python 
    3334class Page(SQLObject): 
    3435    entries = MultipleJoin('Entry') 
     
    3738 * Entry (new) highlights 
    3839 {{{ 
     40#!python 
    3941class Entry(SQLObject): 
    4042    data = StringCol() 
     
    4446 #model.py 
    4547 {{{ 
     48#!python 
    4649from sqlobject import * 
    4750from turbogears.database import PackageHub 
     
    8386 * The code could be cleaner, esp with respect to the try/except blocks in the addPageEntry (but it's working, it's late, and it's going in as is :o) ) 
    8487 {{{ 
     88#!python 
    8589page = Page.byPagename(pagename) 
    8690uploads = [item.filename for item in page.attached_files] 
     
    97101 #WikiDBWrapper.py 
    98102 {{{ 
     103#!python 
    99104from turbogears import controllers 
    100105from model import Page, UploadedFile, Entry 
     
    157162 * init the wiki db wrapper 
    158163   {{{ 
     164#!python 
    159165wiki = WikiDBWrapper() 
    160166   }}} 
    161167 * change the index method to use the wrapper 
    162168   {{{ 
     169#!python 
    163170@turbogears.expose(html="toddswiki.templates.page") 
    164171def index(self, pagename="FrontPage"): 
     
    169176 * pass back the expected dict, only referencing the dict returned from getLatestPage  
    170177   {{{ 
     178#!python 
    171179return dict(data=content, pagename=page.get('pagename'), \ 
    172180uploads=page.get('uploads'), date=page.get('entry').mod_date_time, \ 
     
    178186 #controller.py 
    179187 {{{ 
     188#!python 
    180189import turbogears, cherrypy, re 
    181190from turbogears import controllers, validators 
     
    296305 * We use don't use the db wrapper here, but these calls could be in that class, too. 
    297306 {{{ 
     307#!python     
    298308    @turbogears.expose(html="toddswiki.templates.diffs") 
    299309    def diffLastEntry(self, pagename, rev): 
     
    311321 * Use the difflib.Differ class to generate the diffs 
    312322   {{{ 
     323#!python 
    313324    def diffTwoEntries(self, textA, textB): 
    314325        from difflib import Differ 
     
    346357 
    347358== References == 
    348 http://sqlobject.org/SQLObject.html 
    349 http://www-128.ibm.com/developerworks/library/os-pythonsqlo/?ca=drs 
    350 http://groups.google.com/group/turbogears/search?group=turbogears&q=sqlobject&qt_g=1&searchnow=Search+this+group 
     359 * [http://sqlobject.org/SQLObject.html SQLObject Documentation] 
     360 * [http://www-128.ibm.com/developerworks/library/os-pythonsqlo/?ca=drs IBM Developer Works Article: Connecting databases to Python with SQLObject] 
     361 * [http://groups.google.com/group/turbogears/search?group=turbogears&q=sqlobject&qt_g=1&searchnow=Search+this+group SQLObject Information on the TurboGears Group]