Hi all,
  I actually raised my problem before but it ended up with going
nowhere for solution. But I do believe there's sort of solution for it,
so I decide to put it up here again for some suggestion:

I have a model for my wiki management system.

class Wiki(SQLObject):
    wikiname = StringCol(alternateID=True, length=30)
    frontpage = StringCol()
    pages = MultipleJoin('Page')

class Page(SQLObject):
    pagename = StringCol(alternateID=True, length=30)
    data = StringCol()
    wikiId = ForeignKey('Wiki')

I can have as many wikis as I want ( create, add, delete options) and
upon visiting each wiki from wiki manager master page, I can go
straight to that wiki's FrontPage and be able to visit other pages
within this wiki.
  As you can see from my model, the database build 1 table for Wiki and
1 table for Page. Wiki table contains all wiki created and same to Page
table, the only different is that in Page table, the pagename can be
repeated as long as they belong to different wiki. Say...2 wikis have 2
FrontPages accordingly. However, my model actually create the pagename
in Page table to be unique across the table (alternateID = true).
  What I want to do is to set it to false, which allows the pagename is
repeated in database and I will build a method in application level to
check the pagename duplication in a wiki (instead of letting MySQL
handle it). However, when I set alternateID to False, I can't visit the
page andymore and got this error!

-------------------------------
Traceback (most recent call last):
  File
"c:\python24\lib\site-packages\CherryPy-2.1.0-py2.4.egg\cherrypy\_cphttptools.py",
line 271, in run
    main()
  File
"c:\python24\lib\site-packages\CherryPy-2.1.0-py2.4.egg\cherrypy\_cphttptools.py",
line 502, in main
    body = page_handler(*args, **cherrypy.request.paramMap)
  File
"c:\python24\lib\site-packages\TurboGears-0.8a4-py2.4.egg\turbogears\controllers.py",
line 121, in newfunc
    output = func(self, *args, **kw)
  File "C:\Documents and Settings\E59744\My
Documents\MyFolder\Phuong\Ontology Works\Turbo
Gears\TurboSiaWiki\TurboSiaWiki\controllers.py", line 154, in default
    return self.index(pagename)
  File
"c:\python24\lib\site-packages\TurboGears-0.8a4-py2.4.egg\turbogears\controllers.py",
line 121, in newfunc
    output = func(self, *args, **kw)
  File "C:\Documents and Settings\E59744\My
Documents\MyFolder\Phuong\Ontology Works\Turbo
Gears\TurboSiaWiki\TurboSiaWiki\controllers.py", line 19, in index
    page = Page.byPagename(pagename)
AttributeError: type object 'Page' has no attribute 'byPagename'
---------------------------------

 So why "type object 'Page' has no attribute 'byPagename'"? Anyone can
suggest me how to build this model? Thankx.

Reply via email to