I now get the same behaviour on Ubuntu, Windows XP, and Fedora Core
8 :-(...

Can anyone who has this working properly tell me how they installed
turbogears?

I basically use 'python tgsetup.py' and then easy_install the rest of
the components:
SQLObject
SQLAlchemy
Elixir
ToscaWidgets
Genshi
gsquickstart

This must have to do with the way I'm installing.  The exact project
(with config) works for others but not me.

Help please?  This is my last resort.

On Feb 16, 2:33 pm, lorax <[EMAIL PROTECTED]> wrote:
> Get this.. Another person on IRC took my code (with the flush) and ran
> it fine.  I downloaded the entire project that he build and I still
> get the error.  I get the error with mysql and sqlite.  His worked on
> mysql and sqlite.
>
> He had (on fedora):
> cherrypy-2.3.0, TurboGears-1.0.4.2, sqlalchemy-0.4.2-1.p3,
> python-2.5.1, mysql-server-5.0.45-6.fc8, MySQL-python-1.2.2-4.fc8
>
> I have (on ubuntu):
> CherryPy-2.3.0, TG 1.0.4.3-py2.5, SQLAlchemy-0.4.2p3
>
> I get the error on windows with mysql as well.  I'm starting to think
> something of mine didn't easy_install properly.. That's the only thing
> I can think of.
>
> On Feb 15, 8:33 am, lorax <[EMAIL PROTECTED]> wrote:
>
> > I had checked the config files for anything to do with transactions..
> > or transactions being disabled.  I couldn't find anything..  I know
> > with SQLObject there was the 'notrans_' option in the connect string
> > but with sqlalchemy there is nothing about configuring transactions.
> > I also searched the forum and the documentation for anything to do
> > with a transaction config option and found nothing.
>
> > I did try session.commit().  I get an error that commit doesn't exist.
>
> > I'll try the manual thing tonight.  I hope it provides some clue!
>
> > On Feb 14, 10:33 pm, "Kevin Horn" <[EMAIL PROTECTED]> wrote:
>
> > > On Thu, Feb 14, 2008 at 8:54 PM, lorax <[EMAIL PROTECTED]> wrote:
>
> > > > I have the exact same problem with Elixir + sqlalchemy.  :-(
>
> > > > On Feb 14, 3:05 pm, lorax <[EMAIL PROTECTED]> wrote:
> > > > > Ok a few people have recommended that I go with Elixir now, so I'm
> > > > > going to give that a shot.  I hope it works because I really want TG
> > > > > to work out for me!
>
> > > > > On Feb 14, 9:36 am, lorax <[EMAIL PROTECTED]> wrote:
>
> > > > > > Ok I'm starting to wonder if I've found a bug in Turbogears and/or
> > > > > > sqlalchemy.  I decided to start with a fresh project and add only 
> > > > > > the
> > > > > > required pieces so I could test this.  I'm still getting an error 
> > > > > > when
> > > > > > I execute session.flush().
>
> > > > > > I started with the following:
> > > > > > tg-admin quickstart --sqlalchemy -t tgbig snifflemap
>
> > > > > > Then I added a 'widgets' folder with login_widgets.py containing the
> > > > > > following:
>
> > > > > > from turbogears import widgets,validators
>
> > > > > > class registrationFields(widgets.WidgetsList):
> > > > > >     user_id = widgets.TextField('user_id', label="User ID")
> > > > > >     password = widgets.PasswordField('password', label="Password")
> > > > > >     password_verify = widgets.PasswordField('password_verify',
> > > > > > label="Verify Password")
> > > > > >     first_name = widgets.TextField('first_name', label="First Name")
> > > > > >     last_name = widgets.TextField('last_name', label="Last Name")
> > > > > >     email = widgets.TextField('email', label="Email Address")
>
> > > > > > class registrationFormSchema(validators.Schema):
> > > > > >     user_id = validators.UnicodeString(not_empty=True)
> > > > > >     password = validators.UnicodeString(not_empty=True)
> > > > > >     password_verify = validators.UnicodeString(not_empty=True)
> > > > > >     first_name = validators.UnicodeString(not_empty=True)
> > > > > >     last_name = validators.UnicodeString(not_empty=True)
> > > > > >     email = validators.Email(not_empty=True)
> > > > > >     chained_validators = [
> > > > > >         validators.FieldsMatch('password','password_verify')
> > > > > >     ]
>
> > > > > > registration_form = widgets.TableForm(
> > > > > >     fields=registrationFields(),
> > > > > >     action="process_registration",
> > > > > >     validator=registrationFormSchema()
> > > > > > )
>
> > > > > > I added a register.kid to templates, containing:
>
> > > > > > <body>
> > > > > >     <div id="content">
> > > > > >     ${form.display()}
> > > > > >     </div>
> > > > > > </body>
>
> > > > > > Finally, to root.py I added a couple imports and registration
> > > > > > functions:
>
> > > > > > from snifflemap.widgets import login_widgets
> > > > > > from snifflemap.model import User
> > > > > > from turbogears.database import session
>
> > > > > >     @expose(template="snifflemap.templates.register")
> > > > > >     def register(self):
> > > > > >         return (dict(form=login_widgets.registration_form))
>
> > > > > >     @expose()
> > > > > >     def process_registration(self, **data):
> > > > > >         user=User()
> > > > > >         user.user_name = data['user_id']
> > > > > >         user.email_address = data['email']
> > > > > >         user.password = data['password']
> > > > > >         session.save(user)
> > > > > >         try:
> > > > > >            session.flush()
> > > > > >         except:
> > > > > >            flash('There was an error!')
> > > > > >         raise redirect('/')
>
> > > > > > When I include the flush as above, I get the following error in my
> > > > > > browser:
> > > > > > File "c:\python25\lib\site-packages\sqlalchemy-0.4.2p3-py2.5.egg
> > > > > > \sqlalchemy\orm\session.py", line 489, in commit
> > > > > >     raise exceptions.InvalidRequestError("No transaction is begun.")
> > > > > > InvalidRequestError: No transaction is begun
>
> > > > > > If I do not include the flush, I cannot trap the exception
> > > > > > (IntegrityError) which occurs after I duplicate a user record.
>
> > > > > > Is this a bug?
>
> > > > > > On Feb 13, 8:39 pm, lorax <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I converted my tables to innodb and no luck.  I still miss the
> > > > > > > exception without the session.flush() and get a 'no open
> > > > transaction'
> > > > > > > error if I add the session.flush().
>
> > > > > > > On Feb 13, 1:20 pm, lorax <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > I'm having trouble trapping an IntegrityError with sqlalchemy.  
> > > > > > > > I
> > > > have
> > > > > > > > the following:
>
> > > > > > > > from turbogears.database import session
> > > > > > > > from myproject.model import User
>
> > > > > > > > user = User()
> > > > > > > > user.user_name = "Harry"
> > > > > > > > user.password = "mypass"
>
> > > > > > > > try:
> > > > > > > >     session.save(user)
> > > > > > > > except:
> > > > > > > >     flash("Duplicate entry!")
> > > > > > > >     raise redirect ("register")
>
> > > > > > > > ..but it doesn't catch the error and it comes back to me in the
> > > > > > > > browser.  I tried adding a session.flush() in the try block but
> > > > there
> > > > > > > > is an error about no transaction being created.  I'm assuming 
> > > > > > > > that
> > > > is
> > > > > > > > because I'm using mysql myISAM
>
> > > > > > > > Can anyone help?  Thanks so much.
>
> > > Not sure whether this will help, but I think you should double-check the
> > > following
>
> > > 1) make sure automatic transaction wrapping is turned on.  There should 
> > > be a
> > > config option for this...not sur ewhat itis off the top of my head though
> > > 2) have you tried manually creating the transaction?  that might give you 
> > > a
> > > clue.  could the creation of the transaction be failing somehow, so that 
> > > it
> > > isn't there when you call flush()?
> > > 3) maybe try session.commit() instead of flush()? not sure if that will do
> > > any good.
>
> > > I'm really not a SQLAlchemy expert...
>
> > > Kevin Horn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to