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

Ticket #48 (closed defect: invalid)

Opened 14 years ago

Last modified 12 years ago

Comment on docs/wiki20/page3.html

Reported by: GreenTea Owned by: SuperJared
Priority: normal Milestone: 0.9
Component: Documentation Version:
Severity: normal Keywords:
Cc:

Description

  1. You have to first import Page and hub before you can use the Page item
    from model import Page, hub  
    Page(pagename="FrontPage", data="welcome...doh")  
    
  1. If you run 'tg-admin shell' from a foo/foo instead of foo/, you will be using the 'prod' database, not the 'dev' database
  1. I am finding that even after following these instructions, I still get an error on the web page:
    500 Internal error
    
    Server got itself in trouble
    
    Traceback (most recent call last):
      File "/usr/lib/python2.4/site-packages/CherryPy-2.1.0_rc2-py2.4.egg/cherrypy/_cphttptools.py", line 271, in run
        main()
      File "/usr/lib/python2.4/site-packages/CherryPy-2.1.0_rc2-py2.4.egg/cherrypy/_cphttptools.py", line 502, in main
        body = page_handler(*args, **cherrypy.request.paramMap)
      File "/usr/lib/python2.4/site-packages/TurboGears-0.8a3-py2.4.egg/turbogears/controllers.py", line 121, in newfunc
        output = func(self, *args, **kw)
      File "/home/tgreenwo/working/turbogear/toddswiki/toddswiki/controllers.py", line 15, in index
        page = Page.byPageName(pagename)
    AttributeError: type object 'Page' has no attribute 'byPageName'
    
    Powered by Cherrypy 2.1.0-rc2
    
  1. How do I tell via python that the record has been added to the db? For example, from sqlite3 i can do this:
    turbogear/toddswiki$ sqlite3 ./wiki_db
    
    sqlite> .dump page
    BEGIN TRANSACTION;
    CREATE TABLE page (
        id INTEGER PRIMARY KEY,
        pagename VARCHAR(30) NOT NULL UNIQUE,
        data TEXT
    );
    INSERT INTO "page" VALUES(1, 'FrontPage', 'welcome...doh');
    COMMIT;
    

Change History

comment:1 Changed 14 years ago by GreenTea

Ok. So I've figured this out a bit, but it might be useful for the docs:

toddswiki/toddswiki/controllers.py >

        page = Page.byPagename(pagename)
        #not page = Page.byPageName(pagename)

As far as determining via the interpreter if the command has been added to the db:

In [2]:Page.byPagename("FrontPage")
Out[2]:<Page 1 pagename='FrontPage' data='welcome...doh'>

It would be nice to see an example of selecting something like: select * from page ...or something similar here

btw - the ability to log bugs in the docs is fantastic!

comment:2 Changed 14 years ago by kevin

  • Milestone set to 0.9

comment:3 Changed 14 years ago by SuperJared <jared.kuolt@…>

  • Owner changed from anonymous to SuperJared

comment:4 Changed 14 years ago by SuperJared <jared.kuolt@…>

  • Status changed from new to closed
  • Resolution set to invalid

1) That's already added on the previous page.

2) Fixed. tg-admin now complains when in the wrong dir.

3) User error ;)

4) If no SQLObject exception is thrown after hub.commit(), you're home free.

Note: See TracTickets for help on using tickets.