[TurboGears] Re: elixir with turbogears2

2017-05-11 Thread D R Dinesh Kumar
I have moved the code out of Elixir and using tg sqlalchemy itself. 
For now, I am not seeing the issue. This has brought up a new issue though, 
AdminController updates are not working.
I am getting: 
ResourceClosedError: This transaction is closed

one after another hopefully I will get some help or resolve it.

With Regards,
Dinesh.

On Wednesday, 3 May 2017 23:51:56 UTC-7, D R Dinesh Kumar wrote:
>
> Hi All,
>
> We were using Elixir with TG1 and we have recently migrated to TG2.
> Finding difficulty in hooking the TG2 session to Elixir session and 
> metadata. 
>
> we were using the following statement in TG1 for the hook:
> from turbogears.database import metadata as __metadata__
> from elixir import sqlalchemy
> __metadata__ = sqlalchemy.MetaData()
> __engine__ = sqlalchemy.create_engine("...')
> __metadata__.engine = __engine__
> setup_all()
> create_all()
>
> The above code was doing very good and didnt find any issues at all.
>
> Can you please help how to do the same in TG2? turbogears.database is not 
> available anymore.
>
> With Regards,
> Dinesh.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to turbogears+unsubscr...@googlegroups.com.
To post to this group, send email to turbogears@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.


[TurboGears] Re: TG2 / Elixir Transaction Issue

2017-05-11 Thread D R Dinesh Kumar
Hi Erisian,

have you found the solution for this? I got stuck with the same issue. 
Please help.

With Regards,
Dinesh.

On Wednesday, 2 March 2011 16:48:21 UTC-8, erisian wrote:
>
> I used to be a serious user of Elixir / SQLAlchemy a few years ago and 
> really liked it.   So when I needed to deploy a light application for 
> our workgroup I naturally turned to TG.  TG2 looked to be the most 
> flexible so I went with that.  I installed it on Linux, walked through 
> the quick start installed web site and started hacking on the default 
> web app. 
>
> So far everything has been straight forward.  I'm learning TG2 by the 
> seat of my pants etc. 
>
> I've run into a problem though.   My object model was created in 
> Elixir and it worked fine under interactive testing in IPython etc. 
> There was a little bit of an impedance mismatch because I had to 
> retrofit my Elixir code into the TG2 demo app, but I found most of the 
> code I needed in various examples.  I converted the repoze User/Group/ 
> Perm model into Elixir and integrated it with the rest of my model.  I 
> can login, look at restricted pages etc.I was very pleased to see 
> that the "admin" page introspected my object model and was offering to 
> let me perform CRUD ops. 
>
> Here's my issue: 
>
> In admin I examined my User/Group/Perm objects.  It properly displayed 
> my users and groups so I thought I'd try editing a user. 
>
> 1. I was able to bring a user up in the editing form. 
> 2. I modified the display name and hit 'submit' and received: 
>
> ResourceClosedError: The transaction is closed 
>
> I tried hunting this error down, but I think it might take a while 
> considering that I'm new to the framework.   Has anyone seen anything 
> like this or know of a likely place to fix it? 
>
> I did notice that some of the older Elixir demo code that I tried also 
> used a transaction option when creating the session, but it was a 
> different transaction subsystem.  The new transaction manager seems to 
> have come from Zope and it might be possible that it's interface isn't 
> totally transparent to Elixir. 
>
> Anyway, I'll keep looking for the solution but if anyone knows a 
> solution to this I'd really appreciate it. 
>
> Thanks, 
>
> erisian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to turbogears+unsubscr...@googlegroups.com.
To post to this group, send email to turbogears@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.


[TurboGears] Admin controller issue with ZTE

2017-05-11 Thread D R Dinesh Kumar
Hi All,

I am using the following statement to create DB session

maker = sessionmaker(autoflush=True, autocommit=False,
  extension=ZopeTransactionExtension())
DBSession = scoped_session(maker)

and in my app, I have created model view admin controllers for user,group 
etc.
when I try to edit users, I am hitting the following issue.

File 
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/transaction/_transaction.py",
 
line 423, in _commitResources
rm.tpc_vote(self)
File 
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py",
 
line 109, in tpc_vote
self.tx.commit()
File 
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
 
line 459, in commit
self._assert_active(prepared_ok=True)
File 
"/remote/vtghome9/vgtools2/VPython2.7.13/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
 
line 285, in _assert_active
raise sa_exc.ResourceClosedError(closed_msg)
ResourceClosedError: This transaction is closed

Any help is greatly appreciated.!!

Possible issue:: Since ZTE is used, calling .commit() explicitly is not 
required. 

is there a way to handle this to create different session (without ZTE) for 
AdminController to use?

With Regards,
Dinesh.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to turbogears+unsubscr...@googlegroups.com.
To post to this group, send email to turbogears@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.