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 #2026 (closed defect: fixed)

Opened 11 years ago

Last modified 10 years ago

TG2.0 Wiki20 database initialization script is missing a flush()?

Reported by: llucax Owned by: mramm
Priority: highest Milestone:
Component: TurboGears Version: 1.9.x
Severity: normal Keywords:
Cc:

Description

Following the 20 minutes Wiki tutorial, in the script to initialize the database it finally says:

# Save the page object to the in memory DBSession
DBSession.save(page)

But no INSERT is displayed in the log, and then, que .query(Page).filter(...).one() fails complaining there is no data.

If I add:

DBSession.flush()

at the end of the DB initialization script, it works fine.

Change History

comment:1 Changed 11 years ago by llucax

I'm sorry, that doesn't fix the problem. The INSERT is shown but no COMMIT. If I do:

DBSession.commit()

I get this error:

Traceback (most recent call last):
  File "<stdin>", line 18, in <module>
  File "/tmp/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/scoping.py", line 106, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/tmp/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py", line 663, in commit
    self.transaction.commit()
  File "/tmp/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py", line 376, in commit
    self._prepare_impl()
  File "/tmp/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/session.py", line 352, in _prepare_impl
    self.session.extension.before_commit(self.session)
  File "/tmp/tg2env/lib/python2.5/site-packages/zope.sqlalchemy-0.3-py2.5.egg/zope/sqlalchemy/datamanager.py", line 191, in before_commit
    assert zope_transaction.get().status == 'Committing', "Transaction must be committed by zope"
AssertionError: Transaction must be committed by zope

comment:2 follow-up: ↓ 4 Changed 11 years ago by llucax

Other 20 min wiki bugs:

wikiwords = re.compile(r"\\b([A-Z]\\w+[A-Z]+\\w+)")

Should be:

wikiwords = re.compile(r"\b([A-Z]\\w+[A-Z]+\w+)")

(note the \, both r and
are used)


Same in:

content = wikiwords.sub(r'<a href="%s\\1">\\1</a>' % root, content)

Should be:

content = wikiwords.sub(r'<a href="%s\1">\1</a>' % root, content)

The pagelist.html template is missing.


There is an error in the .rst file:

System Message: WARNING/2 (/Users/markramm-christensen/python/turbogears/docs/2.0/docs/main/Wiki20/wiki20.rst, line 429) Reading file u’Wwiki_root/snapshots/1/wiki20/templates/page.html’ failed: “[Errno 2] No such file or directory: u’/Users/markramm-christensen/python/turbogears/docs/2.0/docs/project_code/Wwiki_root/snapshots/1/wiki20/templates/page.html’”

(near "Adding Views (Templates)")

comment:3 Changed 11 years ago by mramm

  • Owner changed from faide to mramm
  • Status changed from new to assigned
  • Priority changed from normal to highest

comment:4 in reply to: ↑ 2 Changed 11 years ago by mramm

Replying to llucax:

hmm, there should be an

import transaction; trasaction.commit()

in that file somewhere.

Other 20 min wiki bugs:

wikiwords = re.compile(r"\\b([A-Z]\\w+[A-Z]+\\w+)")

Should be:

wikiwords = re.compile(r"\b([A-Z]\\w+[A-Z]+\w+)")

(note the \, both r and
are used)


Same in:

content = wikiwords.sub(r'<a href="%s\\1">\\1</a>' % root, content)

Should be:

content = wikiwords.sub(r'<a href="%s\1">\1</a>' % root, content)

The pagelist.html template is missing.


There is an error in the .rst file:

System Message: WARNING/2 (/Users/markramm-christensen/python/turbogears/docs/2.0/docs/main/Wiki20/wiki20.rst, line 429) Reading file u’Wwiki_root/snapshots/1/wiki20/templates/page.html’ failed: “[Errno 2] No such file or directory: u’/Users/markramm-christensen/python/turbogears/docs/2.0/docs/project_code/Wwiki_root/snapshots/1/wiki20/templates/page.html’”

(near "Adding Views (Templates)")

comment:5 Changed 11 years ago by mramm

  • Status changed from assigned to closed
  • Resolution set to fixed

Should all be fixed in trunk. Site docs should be updated too.

comment:6 Changed 11 years ago by llucax

NameError: name 'trasaction' is not defined

May it's import xxx.transaction?

comment:7 Changed 11 years ago by llucax

Woops! You had a typo in the comment (the second "transaction" is missing an "n"), and I copy&pasted it =)

Never mind, that works.

comment:8 Changed 10 years ago by anonymous

  • Milestone 1.9.7b1 deleted

Milestone 1.9.7b1 deleted

Note: See TracTickets for help on using tickets.