[tg-trunk] Re: init_model changes in tg2 template
percious wrote: So, I did some experimentation tonight using the engine as an identifier. The problem is that I have no way of knowing which class is mapped to which engine without binding them. Maybe I'm missing something here... from sqlalchemy import orm mapper = orm.class_mapper(MyClass) # introspect the mapper... This is how RumAlchemy gets information about a mapped class' properties: http://toscawidgets.org/hg/RumAlchemy/file/tip/rumalchemy/util.py IIRC, you don't *need* a connection to a database (engine) to introspect the mapper. For CRUD operations you just need a reference to DBSession so you can create Query objects from a mapped class. You can safely assume that DBSession has already been bound to an engine somehow I guess. Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: init_model changes in tg2 template
Yes, and I am doing that. The problem becomes when you have two models that have the same named classes. I check to make sure the mapper points to the proper metadata before returning the class. Question: why is it ok to bind the DBSession, and not the metadata? This seems contradictory in my mind. In case anyone is wondering, DBSprockets need the ability to query the database so it can fill in the proper data for the drop-down menus, as well as to fill in table data. cheers. -chris On Dec 19, 1:29 am, Alberto Valverde albe...@toscat.net wrote: percious wrote: So, I did some experimentation tonight using the engine as an identifier. The problem is that I have no way of knowing which class is mapped to which engine without binding them. Maybe I'm missing something here... from sqlalchemy import orm mapper = orm.class_mapper(MyClass) # introspect the mapper... This is how RumAlchemy gets information about a mapped class' properties:http://toscawidgets.org/hg/RumAlchemy/file/tip/rumalchemy/util.py IIRC, you don't *need* a connection to a database (engine) to introspect the mapper. For CRUD operations you just need a reference to DBSession so you can create Query objects from a mapped class. You can safely assume that DBSession has already been bound to an engine somehow I guess. Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] chameleon.genshi in TG2?
Mark, I have seen that chameleon.genshi is supporting xinclude (since 2 weeks) ! Are you ok if I add a chameleon.genshi renderer to TG2 ? :p It would be optional (since chameleon.core has a lot of dependencies: lxml, zope.*) but I think it would be nice to have such an addition to our framework. Florent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: init_model changes in tg2 template
On Dec 19, 2008, at 15:36, percious ch...@percious.com wrote: Yes, and I am doing that. The problem becomes when you have two models that have the same named classes. How is that? AFAIK, as long as they're declared in different modules, two classes with the same name are different objects altogether. I check to make sure the mapper points to the proper metadata before returning the class. Question: why is it ok to bind the DBSession, and not the metadata? This seems contradictory in my mind. As Mark has pointed out in this thread, the session is thread-local (ie: can be configured dynamically on a per-request basis which can be very useful in some situations) while the metadata has a module scope (process scope) which makes some advanced use-cases impossible. In case anyone is wondering, DBSprockets need the ability to query the database so it can fill in the proper data for the drop-down menus, as well as to fill in table data. Can't it query it with the good old DBSession.query(SomeClass) ? Alberto cheers. -chris On Dec 19, 1:29 am, Alberto Valverde albe...@toscat.net wrote: percious wrote: So, I did some experimentation tonight using the engine as an identifier. The problem is that I have no way of knowing which class is mapped to which engine without binding them. Maybe I'm missing something here... from sqlalchemy import orm mapper = orm.class_mapper(MyClass) # introspect the mapper... This is how RumAlchemy gets information about a mapped class' properties:http://toscawidgets.org/hg/RumAlchemy/file/tip/rumalchemy/util.py IIRC, you don't *need* a connection to a database (engine) to introspect the mapper. For CRUD operations you just need a reference to DBSession so you can create Query objects from a mapped class. You can safely assume that DBSession has already been bound to an engine somehow I guess. Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: init_model changes in tg2 template
No, right now that part of it is table-based (this is going to change in the near future). Therefore it uses the table objects, and hence select, insert, etc. need to have bindings. Maybe i'll just pass in the dbsession, get the binding from that, and simply reflect the tables... options options. cheers. -chris On Dec 19, 10:12 am, Alberto Valverde albe...@toscat.net wrote: On Dec 19, 2008, at 15:36, percious ch...@percious.com wrote: Yes, and I am doing that. The problem becomes when you have two models that have the same named classes. How is that? AFAIK, as long as they're declared in different modules, two classes with the same name are different objects altogether. I check to make sure the mapper points to the proper metadata before returning the class. Question: why is it ok to bind the DBSession, and not the metadata? This seems contradictory in my mind. As Mark has pointed out in this thread, the session is thread-local (ie: can be configured dynamically on a per-request basis which can be very useful in some situations) while the metadata has a module scope (process scope) which makes some advanced use-cases impossible. In case anyone is wondering, DBSprockets need the ability to query the database so it can fill in the proper data for the drop-down menus, as well as to fill in table data. Can't it query it with the good old DBSession.query(SomeClass) ? Alberto cheers. -chris On Dec 19, 1:29 am, Alberto Valverde albe...@toscat.net wrote: percious wrote: So, I did some experimentation tonight using the engine as an identifier. The problem is that I have no way of knowing which class is mapped to which engine without binding them. Maybe I'm missing something here... from sqlalchemy import orm mapper = orm.class_mapper(MyClass) # introspect the mapper... This is how RumAlchemy gets information about a mapped class' properties:http://toscawidgets.org/hg/RumAlchemy/file/tip/rumalchemy/util.py IIRC, you don't *need* a connection to a database (engine) to introspect the mapper. For CRUD operations you just need a reference to DBSession so you can create Query objects from a mapped class. You can safely assume that DBSession has already been bound to an engine somehow I guess. Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: chameleon.genshi in TG2?
On Fri, Dec 19, 2008 at 10:16 AM, Florent Aide florent.a...@gmail.com wrote: Mark, I have seen that chameleon.genshi is supporting xinclude (since 2 weeks) ! Are you ok if I add a chameleon.genshi renderer to TG2 ? :p It would be optional (since chameleon.core has a lot of dependencies: lxml, zope.*) but I think it would be nice to have such an addition to our framework. Florent. That sounds like a nice addition, from the first time I head about chameleon I was impress by it. don't we need pylons to support it too? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: chameleon.genshi in TG2?
On Fri, Dec 19, 2008 at 9:40 PM, Jorge Vargas jorge.var...@gmail.com wrote: That sounds like a nice addition, from the first time I head about chameleon I was impress by it. don't we need pylons to support it too? done in tg2. Now we can see how we propose this to the pylons folks. But there is nearly no support code, just a few lines. Florent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] repoze.what 1.0rc2 / XML plugin
Hello, everybody. There's a new release candidate for repoze.what. Changelog = * Fixed the constructor of the Not predicate, which didn't call its parent and therefore it was not possible to specify a custom message. * From now on, predicates that are not met will have only *one* error message, even in compound predicates. It didn't make sense to have a list of errors and thus this behavior has been changed in this release. This will affect you if you deal with :func:`repoze.what.authorize.check_authorization` directly and handled the errors of :class:`repoze.what.authorize.NotAuthorizedError` as in:: try: check_authorization(predicate, environ) except NotAuthorizedError, exc: for error in exc.errors: print error The code above may be updated this way:: try: check_authorization(predicate, environ) except NotAuthorizedError, exc: print exc .. note:: This doesn't affect TurboGears 2 users because TG itself deals with this function and it's already updated to work with :mod:`repoze.what` 1.0rc2. Keep in mind that for this release to work on TurboGears 2, you need TurboGears 2 Beta 1 (not yet released as of this writing) or the latest revision in the repository. * For forward compatibility, it's no longer mandatory to use the groups/permissions-based authorization pattern in order to use :mod:`repoze.what`. This package should support several authorization patterns and they must all be optional, such as the upcoming support for roles-based authorization in :mod:`repoze.what` 1.5. As a result, now you can skip the definition of group and permission adapters and use :func:`repoze.what.middleware.setup_auth` as a simple proxy for :class:`repoze.who.middleware.PluggableAuthenticationMiddleware`:: app_with_auth = setup_auth( app, identifiers=identifiers, challengers=challengers, mdproviders=mdproviders, classifier=classifier, challenge_decider=challenge_decider ) TG2 trunk users: To use this release candidate, you have to update your TG2 working copy, and vice versa, if you update your working copy you'll need this repoze.what release (just run `python setup.py develop` to have it installed). I'd also like to highly a new adapters plugins which makes repoze.what support groups and permissions stored in XML files: http://code.gustavonarea.net/repoze.what.plugins.xml/ So now you're able to store your groups in databases, Ini files (thanks to José Dinuncio) and XML files. On my part, I won't work on more adapters so that I can work on repoze.what itself, but if somebody wants to create a new one, I'd love to see one to re-use Htgroups files. On a side note, I'd like to let you know that I'll be on vacations from today until Jan 11 and I may not be able to check my email very often during this time (although I may be wrong). Cheers! -- Gustavo Narea http://gustavonarea.net/. Get rid of unethical constraints! Get freedomware: http://www.getgnulinux.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---
[tg-trunk] Re: login box
I've reopened 2033, http://trac.turbogears.org/attachment/ticket/2033/login_handler.diff The new template in tg.devtools is missing few tg.url. I'm attaching a patch to fixes it in templates but after a user logs in the page gets redirected to '/' instead of tg.url('/'). I cannot find where in the code the process gets redirected. The logout button seem to redirect at the end to /login?came_from instead of tg.url('/login')?came_from . Also, Is there a way to make the actual widget that asks for password have a white or light gray background wher you type in the user/password instead of black/dark gray. Thanks, Lucas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears Trunk group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to turbogears-trunk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~--~~~~--~~--~--~---