Re: New SQLAlchemy tutorial; SAContext is dead
On 8/15/07, Jose Galvez [EMAIL PROTECTED] wrote: Wow a lot to digest. I use assign_mapper which needs the session_context how do I get that with the the new setup? It was pretty easy to get with sacontext, I'm not sure how to get at it with this new setup Use Session.mapper instead of mapper. This gives you MyClass.query and auto-saves new instances so you don't have to call Session.save(obj). The query methods are on the .query property rather than on the class itself. The session methods are on the Session object so they aren't repeated on the class. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
Ok I think I posted to soon, I needed to read the website a little more closely before firing off stupid questions. Jose Jose Galvez wrote: Wow a lot to digest. I use assign_mapper which needs the session_context how do I get that with the the new setup? It was pretty easy to get with sacontext, I'm not sure how to get at it with this new setup Jose Mike Orr wrote: I've updated SQLAlchemy for people in a hurry with the new SQLAlchemy 0.4 programming pattern designed by Ben, MikeB, and myself. We're no longer using SAContext but instead putting the engine, metadata, and contextual session directly in our application code. This allows you to apply advanced concepts directly from the SQLAlchemy manual. http://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry SQLAlchemy 0.4 beta 2 has a new 'engine_from_config' function that creates an engine based on a Pylons-format configuration file. The article uses this function. SQLAlchemy 0.4 contains many refactorings and simplifications, and the manual has been rewritten to address many FAQs which have come up over the past several months. This is the main reason SAContext was deprecated; it's not needed in 0.4. I'll release SAContext 0.3.5 momentarily, which is forward-compatible with SQLAlchemy 0.4 but keeps the existing API and uses deprecated SQLAlchemy features. SAContext is now in bugfix-only mode. You may want to check the article again in 24 hours in case SQLAlchemy experts have corrected any errors. One thing I'm adding right now is the pylons_scope function. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: iframe issue
the error is because the test1.html should not be relative to the template, but rather in your public folder Jose Alagu Madhu wrote: Hi templates/ test.mako test1.html test.mako: iframe src=test1.html / I am getting error... Error 404 .. NOT FOUND Thanks Madhu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: iframe issue
On Aug 16, 9:03 am, Jose Galvez [EMAIL PROTECTED] wrote: the error is because the test1.html should not be relative to the template, but rather in your public folder Jose if i place the test1.html in public foder is working,but i need in templates folder. Thanks Madhu Alagu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
Jose, Jose Galvez wrote: Wow a lot to digest. I use assign_mapper which needs the session_context how do I get that with the the new setup? It was pretty easy to get with sacontext, I'm not sure how to get at it with this new setup this could be some more ressource for you: I posted my setup, setting SA 0.4 + Pylons 0.9.6rc2, the assign_mapper style, as I'm still using it as well: http://groups.google.com/group/pylons-devel/browse_thread/thread/2b82c7093f50afc4/a6c4d7986266ddb0#a6c4d7986266ddb0 Regards, -- Alexandre CONRAD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: CSS/Javascript in Pylons
OK, but: 1. what if I use 50+ pages? I need to write 50+ if clauses 2. when I add a new page, I must to remember to add a new if clause 3. my pages def (style with CSS, behaviour with Javascript and content with HTML) are distributed in 2+ documents. This is not the better case for me. It's possibe to include CCS/Javascript refs inside a child template orderly (locating, finally, inside the head html clause)? |-- parent mako --| ... head ... ${ h.stylesheet_link_tag('/css/parent.css') } ... /head ... |-- child mako --| ... ${ h.stylesheet_link_tag('/css/child.css') } ... results in: html head ... link rel=stylesheet href=/css/parent.css type=text/css / link rel=stylesheet href=/css/child.css type=text/css / ... /head ... Or, perhaps, with Pylons code in my controller. Cheers, Jose F. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: [Paste] Can't start pylons app
On 8/16/07, Cliff Wells [EMAIL PROTECTED] wrote: On Wed, 2007-08-15 at 19:15 +0200, Neil Blakey-Milner wrote: Or, even better, use virtual-python or workingenv, and never install moving targets into your core Python library location. Out of curiosity, what does workingenv offer over the standard setuptools way of doing things? http://peak.telecommunity.com/DevCenter/EasyInstall#administrator-installation I use virtual-python, but workingenv works similarly enough, so I'll just answer as per virtual-python. Basically, I maintain a project directory per separate application that runs on a server. At work, I have projectA (a Django server), projectB (a port of that application to TurboGears), and projectC (a new TurboGears project). In development, each one has a totally separate virtual-python environment. This environment is periodically cleared and restarted. The data in setup.py's install_requires is used to install all the packages that are necessary (using dependency_links to use a common local storage location for both third-party and our own packages) for that, so we can be sure that when we go live, we'll have all the packages and versions of them necessary to run. On live, we actually have two totally separate virtual-python environments. Basically, it's the current live running environment, and the previous live environment. When we install a new (major) version, we create a new environment and install the egg package produced by our project, which then fetches all its dependencies. We then shut down the running live environment, back up the database, run the database upgrade scripts, and start up the new live environment. We then run tests, and if all goes well, we move forward with this environment. If things don't work well, we restore the database, and start up the previous live environment. Using workingenv or virtual-python means being able to create these in any location, with any user, and generally be flexible about it. workingenv also has some additional useful functionality - but I just found virtual-python first, and the additional functionality in workingenv is dealt with in my egg package installs anyway. Also, generally our live environments are installed with one user, and run with another user (who can't change the code/resources). The user installation wouldn't work in this scenario. Neil -- Neil Blakey-Milner http://nxsy.org/ [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: iframe issue
2007/8/16, [EMAIL PROTECTED] [EMAIL PROTECTED]: On Aug 16, 9:03 am, Jose Galvez [EMAIL PROTECTED] wrote: the error is because the test1.html should not be relative to the template, but rather in your public folder Jose if i place the test1.html in public foder is working,but i need in templates folder. why for? is it template or just static file? If test1.html is a template then use it as a template - call controller/action. otherwise it's pointless to keep it in template folder, which is not available via http requests. Best regards Cezary Statkiewicz -- Cezary Statkiewicz - http://thelirium.net rlu#280280 gg#5223219 jabber://[EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
On Wed, Aug 15, 2007 at 06:04:22PM -0700, Mike Orr wrote: I've updated SQLAlchemy for people in a hurry with the new SQLAlchemy 0.4 programming pattern designed by Ben, MikeB, and myself. We're no longer using SAContext but instead putting the engine, metadata, and contextual session directly in our application code. This allows you to apply advanced concepts directly from the SQLAlchemy manual. http://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry Oh, well, the whole project seems to be a increasingly moving target. First pylons.database is deprecated and replaced by SAContext. Then SAContext is deprected. Takes some getting used to. Rants aside. I'm converting my project to comply with the suggestions of SQLAlchemy for people in a hurry. One typo seems to be the sqlalchemy.default.uri and sqlalchemy.uri in the development.ini that leads to key errors not finding the url key. Changing it to sqlalchemy.url works better. That one was easy to find and I added a comment to that page. Worse is that I can't query for objects through paster shell. I get this exception: /home/chaas/projekte/dnsdhcp/dnsdhcp/model/__init__.py in pylons_scope() 16 import thread 17 from pylons import config --- 18 return Pylons|%s|%s % (thread.id, id(config)) 19 20 # Global session manager. Session() returns the session object appropriate for the current web request. AttributeError: 'module' object has no attribute 'id' I'm not threading expert so I don't know where to look. In ipython the thread module doesn't have an id. Thanks for any hints. Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
On Aug 16, 5:26 am, Christoph Haas [EMAIL PROTECTED] wrote: Worse is that I can't query for objects through paster shell. I get this exception: /home/chaas/projekte/dnsdhcp/dnsdhcp/model/__init__.py in pylons_scope() 16 import thread 17 from pylons import config --- 18 return Pylons|%s|%s % (thread.id, id(config)) 19 20 # Global session manager. Session() returns the session object appropriate for the current web request. AttributeError: 'module' object has no attribute 'id' I'm not threading expert so I don't know where to look. In ipython the thread module doesn't have an id. the proper call is thread.get_ident(), changed in r92 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
On Aug 16, 5:34 am, Vegard Svanberg [EMAIL PROTECTED] wrote: * Christoph Haas [EMAIL PROTECTED] [2007-08-16 11:26]: Oh, well, the whole project seems to be a increasingly moving target. First pylons.database is deprecated and replaced by SAContext. Then SAContext is deprected. Takes some getting used to. Without intending to rant, I'm also a little concerned about the constant change of more or less fundamental parts. It seems this would mean that an application would have to be rewritten every so often and this could be quite tedious with a large and complex application, not to mention that everything would have to be tested and re-tested all over again. It seems to me the world is moving too fast :-) honestly, we've tried a few things and we are watching how the userbase responds. Theres two things at play here : 1. SQLAlchemy 0.4 offers better configurational options than SA 0.3, and is in the process of being released. SAContext was designed around 0.3 and doesn't have as strong a place with 0.4. 2. SAContext was pretty good but at the same time people put all their faith into it as the solver-of-all-problemsand we saw a fair amount of confusion remain. While I liked the idea of a single configurational object to do everything, at the same time I think the setup works out better when the two or three individual pieces of the configuration go where they really should go. this latest approach is also better: 3. SA0.4 improves the user experience here a little bit by providing more succinct objects, like Session.save instead of sacontext.ctx.save() or whatever it was. 4. this configuration supports transactions quite nicely, and embeds raw SQL in the same transaction smoothly. previous patterns didnt include any of this. so we apologize for getting the story different a few times but im pretty sure we'll be reaching cruising altitude very soon. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
It looks like there are some issues with threading. I put the lines try: model.Session.configure(bind = g.sa_engine) return WSGIController.__call__(self, environ, start_response) finally: assert hasattr(model.Session, 'registry') model.Session.remove() ...long traceback skipped... File '***/lib/base.py', line 28 in __call__ model.Session.remove() File 'build/bdist.linux-i686/egg/sqlalchemy/orm/scoping.py', line 47 in remove AttributeError: type object 'ScopedSession' has no attribute 'registry' So it had the attribute registry right before the remove() call, but somewhere deep inside the attribute vanished. And, by the way, the config parameter now is not sqlalchemy.default.uri, but is sqlalchemy.default.url (it's rather SQLAlchemy issue). I mean, L instead of I. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
So it had the attribute registry right before the remove() call, but somewhere deep inside the attribute vanished. the remove() call is actually not correct in release beta2, so ive updated the article to reference beta3 and/or the current trunk. also i changed the configure call above it which was incorrect. Wheres beta3 ? later today :) also added some WARNING BLEEDING EDGE caveats since this tutorial went up *really* fast. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
ive released beta3 which fixes the remove() issue. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: iframe issue
The point is that you are calling the iframe source incorrectly. If your test1.html is a static file then it needs to be in your public folder, if its a template then you need to tie it to a controller and call the appropriate controller Jose On 8/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: why for? is it template or just static file? test1.html is just like... % for item in data: tr % for col in item: % endfor /tr % endfor I like to call using iframe.iframe src=test1.html / templates/ test.mako test1.html test.mako: iframe src=test1.html / test1.html % for item in data: tr % for col in item: % endfor /tr Thanks Madhu Alagu If test1.html is a template then use it as a template - call controller/action. otherwise it's pointless to keep it in template folder, which is not available via http requests. Best regards Cezary Statkiewicz -- Cezary Statkiewicz -http://thelirium.net rlu#280280 gg#5223219 jabber://[EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
formencode
I'm trying to use formencode to validate a simple form. The question I have is: How can I make a field conditionally required? This is what I have, I have a pull down, with an other option. What I want to do is if other is selected then have a textbox become visible and be required, but only be required if Other is selected from the pulldown. Is this possible? if so how? Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
Well for me, I think in my production stuff I'll stick with sacontext and sqlalchemy 3x until this sorts out a little. Having said that I will play with the new stuff in a separate workingenv to get a taste of how things are going to work in the near future. What would be really nice is if pylons had an sqlalchemy template that added some of the code mentioned in the tutorial, maybe it could add everything that is needed to for single default database? then all we would have to do is edit the model, as I'm sure I'll forget one or two configuration things and spend lots of time chasing my tail trying to figure out why my simple query is not working :) Jose On 8/16/07, Michael Bayer [EMAIL PROTECTED] wrote: ive released beta3 which fixes the remove() issue. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: iframe issue
On Aug 16, 2007, at 11:14 AM, Jose Galvez wrote: The point is that you are calling the iframe source incorrectly. If your test1.html is a static file then it needs to be in your public folder, if its a template then you need to tie it to a controller and call the appropriate controller Right. TemplateController and a catch-all route directing to it are provided to simply pass thru requests to templates, if you need that kind of functionality. By default the TemplateController is disabled, it just returns a 404. Edit it and change the abort(404) to something similar to the example provided in its docstring to enable it. -- Philip Jenvey --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
+1 on a pylons-sqlalchemy template since if youre *really* in a hurry, thats the best --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
First, apologies for the mistakes in the tutorial. I'm going to convert my own application today, so that will be a practical test. But I did say to check back in 24 hours in case there are corrections. Let's make that 48 hours from now, to take care of any remaining beasties. On 8/16/07, Christoph Haas [EMAIL PROTECTED] wrote: Oh, well, the whole project seems to be a increasingly moving target. First pylons.database is deprecated and replaced by SAContext. Then SAContext is deprected. Takes some getting used to. Whatever's happening to the rest of the project, Pylons' relationship to SQLAlchemy has evolved. pylons.database built it in. SAContext attempted to correct some deficiencies in it. It succeeded in some ways but failed in others, which is why it's been retired. Throughout SAContext's life there has been a debate whether to include it in Pylons. Ben wanted to get all database APIs out of Pylons core: (1) to make it database-neutral, (2) to avoid making another bad API decision, and (3) to avoid tying it to Pylons' release cycle which may be too slow. That meant SAContext needed a home. We're considering a Pylons extras package for things like this,which can be updated quickly regardless of Pylons' release cycle, but so far this package does not exist. Then SQLAlchemy 0.4 made some standardizations and simplifications and improved the manual, which lessened the need for SAContext. Simultaneously I wasn't sure how to adapt SAContext to 0.4: bound metadatas? one global metadata? scoped_session or custom code? Inline BoundSessionStrategy and remove the other strategies? Subclass for multiple engines? Turn PylonsSAContext into a config-parsing function? When MikeB and Ben came up with drafts of this tutorial,and SQLAlchemy added the engine_from_config function I'd long been lobbying for, it was clear that this would be cleaner than shoehorning SQLAlchemy 0.4 into SAContext's arbitrary structure. So i wanted to stop supporting a dead-end class, provide a viable configuration that people (including me) can use now, and get the wiki articles consistent with each other. Thus the quickness of getting the tutorial up, which led to some errors creeping in. The eventual plan is to include this in an application template so you can do something like paster create -t pylons,sqlalchemy,genshi Foo and get it all preconfigured. But that will take time to verify the right template and get it incorporated. In the meantime people need a viable database configuration NOW, so this is what we've got. Improvements to the pattern will improve the eventual application template. One typo seems to be the sqlalchemy.default.uri and sqlalchemy.uri in the development.ini that leads to key errors not finding the url key. Changing it to sqlalchemy.url works better. That one was easy to find and I added a comment to that page. I checked with MikeB and he wants to stick with 'url', so I changed the tutorial. This means those upgrading from SAContext or pylons.database will have to change their config key from 'uri' to 'url'. --- 18 return Pylons|%s|%s % (thread.id, id(config)) AttributeError: 'module' object has no attribute 'id' I'm not threading expert so I don't know where to look. In ipython the thread module doesn't have an id. It should have been thread.get_ident(). I misremembered the syntax. MikeB and Ben removed the app_scope function entirely from the article, saying it's only needed in a rare circumstance. I re-added it in a section at the bottom for those who need it. You only need it if you have multiple instances of the SAME Pylons application running in the same WSGi process; e.g, with Paste HTTPServer 's composite. It prevents those instances from sharing session objects. paster shell use needs to be tested, along with standalone applications using the model. I believe standalone apps can just borrow the config code in websetup.py. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
On Thu, Aug 16, 2007 at 01:55:26PM -0700, Mike Orr wrote: First, apologies for the mistakes in the tutorial. I'm going to convert my own application today, so that will be a practical test. But I did say to check back in 24 hours in case there are corrections. Let's make that 48 hours from now, to take care of any remaining beasties. I should have taken that warning more seriously. :) Something made we want to be on the bleeding edge and I wasted hours until I understood that the in a hurry article couldn't have worked as it was. And the link to the previous revision explaining how things are supposed to work with SAContext was wrong. Thanks to Mike Bayer who jumped in when I bugged him on IRC and made some quick corrections. I'm glad he works so closely with the Pylons project so that database access is getting well connected to Pylons. Please don't take my posting as ranting and demanding. I appreciate the work invested into Pylons, SQLAlchemy, Paster and SAContext. I chose to try 0.9.6r1 then 0.9.6rc2. I wanted to be top-of-the-line with SQLAlchemy 4.0 beta1 and beta2. Of course I would have had less trouble if I were still using Pylons 0.9.5. I somehow thought that it might be a nice idea to use the newer APIs already but I shouldn't be too surprised that things are still evolving. Especially with release candidates and beta versions. All changes have been improvements so far. 0.9.6 is a bit clearer than 0.9.5. SQLAlchemy 0.3.9 suddenly started to make easy things easy. So I would miss something if the API were stable but ugly. Let it evolve. paster shell use needs to be tested, along with standalone applications using the model. I believe standalone apps can just borrow the config code in websetup.py. Paster shell failed sooner today and I had to bind to an engine manually: model.Session.configure(bind=g.sa_engine) After changing my model/__init__.py it works without manually binding the engine. Thanks for the correction. There is one problem left for me now. The code in lib/base.py doesn't seem to do its job properly: File '/home/chaas/projekte/dnsdhcp/dnsdhcp/lib/base.py', line 43 in __call__ model.Session.remove() File '/usr/lib/python2.4/site-packages/sqlalchemy/orm/scoping.py', line 47 in remove self.registry.clear() AttributeError: type object 'ScopedSession' has no attribute 'registry' Once that's sorted out I hope to be back on the track. Thanks again, Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
On 8/16/07, Christoph Haas [EMAIL PROTECTED] wrote: There is one problem left for me now. The code in lib/base.py doesn't seem to do its job properly: File '/home/chaas/projekte/dnsdhcp/dnsdhcp/lib/base.py', line 43 in __call__ model.Session.remove() File '/usr/lib/python2.4/site-packages/sqlalchemy/orm/scoping.py', line 47 in remove self.registry.clear() AttributeError: type object 'ScopedSession' has no attribute 'registry' I don't know about that. Somebody else got a 'registry' error too. Mike? model.Sesson.close() or model.Session.clear() would also be adequate, if they work better for you. They all discard active data, which is what we need. -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
update to beta3 plz I'm not able to install it it creates an empty directory # easy_install SQLAlchemy-0.4.0beta3.tar.gz Processing SQLAlchemy-0.4.0beta3.tar.gz Running SQLAlchemy-0.4.0beta3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-99467Z/SQLAlchemy-0.4.0beta3/egg-dist-tmp-Cri_zJ zip_safe flag not set; analyzing archive contents... Adding SQLAlchemy 0.4.0beta3 to easy-install.pth file Installed /usr/lib/python2.5/site-packages/SQLAlchemy-0.4.0beta3-py2.5.egg Processing dependencies for SQLAlchemy==0.4.0beta3 Finished processing dependencies for SQLAlchemy==0.4.0beta3 # ls -R /usr/lib/python2.5/site-packages/SQLAlchemy-0.* /usr/lib/python2.5/site-packages/SQLAlchemy-0.4.0beta3-py2.5.egg any suggestion? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
Il giorno ven, 17/08/2007 alle 01.49 +0200, xlyz ha scritto: update to beta3 plz I'm not able to install it it creates an empty directory /usr/lib/python2.5/site-packages/SQLAlchemy-0.4.0beta3-py2.5.egg never mind. it's not a directory, but a zipped file /me hides in a corner --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
You may want to check the article again in 24 hours in case SQLAlchemy experts have corrected any errors. One thing I'm adding right now is the pylons_scope function. I'm not an expert, but in your model you need to add: import pylons or you get: type 'exceptions.NameError': name 'pylons' is not defined and there is a typo on line 14: -table1 = table(table1, metadata, +table1 = Table(table1, metadata, bye --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: [Paste] Can't start pylons app
On 8/15/07, Christoph Haas [EMAIL PROTECTED] wrote: Morale: never install eggs on a Debian-based system. Use workingenv when trying out a new version of Pylons, so that you can delete the entire environment easily. It's also great for developing an application and trying them out under several different version scenarios. You can also use it in production by running 'activate' in a wrapper shell script (or init.d script in some distros), or otherwise setting the PYTHONPATH and PATH to point into the workingenv for that application. If you want to install eggs systemwide and you aren't convinced by Christoph's dire prophetic warnings, *don't* install into the /usr/lib/python2.5/site-packages your distro provides. That's for your distro's packages. Install under /usr/local/lib instead, or ~/lib. Debian/Ubuntu automatically search for packages in /usr/local/lib/python2.5/site-packages. Macintosh has another directory for local Python packages. But that doesn't help the fact that easy_install installs into /usr/lib by default. So you have to tell it to install packages elsewhere. The instructions are in http://peak.telecommunity.com/DevCenter/EasyInstall#custom-installation-locations (That's EasyInstall's home page.) You can do a straight Administrator installation and that will give each user their own Python library in their home directory. Setting it up in /usr/local requires a slight modification of the instructions: 1) Create a file /usr/lib/python2.5/site-packages/local,pth containing /usr/local/lib/python2.5/site-packages. (You can leave off the site-packages part or choose any other directory.) 2) Create a file /usr/lib/python2.5/distutils/distutils.cfg containing: [install] install_lib = /usr/local/lib/python2.5/site-packages install_scripts = /usr/local/bin [easy_install] site_dirs = /usr/local/lib/python2.5/site-packages zip_ok = 0 (zip_ok=0 forces all eggs to be installed as directories rather than zipfiles. I prefer that because it's easier to browse the source.) 3) Create the lib and bin directories if they don't exist. 4) Download the latest Setuptools from PyPI and run it as a shell script. http://pypi.python.org/pypi/setuptools/0.6c6. Now packages you easy_install will go into the local directory, and Debian/Ubuntu packages will go into the system site-packages (even if they're eggs). -- Mike Orr [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: New SQLAlchemy tutorial; SAContext is dead
Il giorno ven, 17/08/2007 alle 02.34 +0200, xlyz ha scritto: You may want to check the article again in 24 hours in case SQLAlchemy experts have corrected any errors. One thing I'm adding right now is the pylons_scope function. I'm not an expert, but in your model you need to add: import pylons or you get: type 'exceptions.NameError': name 'pylons' is not defined and there is a typo on line 14: -table1 = table(table1, metadata, +table1 = Table(table1, metadata, bye and in the relation example Address and Person class are not defined. bye --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
turning binary data into a file.
Guys, I have one short question and this relates to the FieldStorage Pylons file object in the way it represents a posted image. Does anybody know what the 'file' attribute's type is in the object on which read/write/close is invoked? I'm trying to do the following: I'm reading in binary data from somewhere into memory, and I want to now convert that into an image file. What are the steps to do that: buf = urllib.urlopner().read() f = open(buf, 'wb') But this has created a file descriptor...What's happening is that after I call read() on f, I'm getting a bad file descriptor error. How do I fix this problem? Thanks, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: turning binary data into a file.
have you tried buf = urllib.urlopener().read() f = file('/somefile.jpg', 'wb') f.write(buf) f.close() Jose SamDonaldson wrote: Guys, I have one short question and this relates to the FieldStorage Pylons file object in the way it represents a posted image. Does anybody know what the 'file' attribute's type is in the object on which read/write/close is invoked? I'm trying to do the following: I'm reading in binary data from somewhere into memory, and I want to now convert that into an image file. What are the steps to do that: buf = urllib.urlopner().read() f = open(buf, 'wb') But this has created a file descriptor...What's happening is that after I call read() on f, I'm getting a bad file descriptor error. How do I fix this problem? Thanks, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: turning binary data into a file.
Actually, what I'd like to be able to do is not physically create a file. I'd like to just hold that buf as a file object in memory on which the read/write api's can get applied. In other words, I don't want a somefile.jpg on my filesystem. I want to pass that buffer as a file object on to some other layer in my code that will take care of making that a file, similar to what I do with the 'file' attribute in the FieldStorage object. Thanks, SAm. On Aug 16, 8:40 pm, Jose Galvez [EMAIL PROTECTED] wrote: have you tried buf = urllib.urlopener().read() f = file('/somefile.jpg', 'wb') f.write(buf) f.close() Jose SamDonaldson wrote: Guys, I have one short question and this relates to the FieldStorage Pylons file object in the way it represents a posted image. Does anybody know what the 'file' attribute's type is in the object on which read/write/close is invoked? I'm trying to do the following: I'm reading in binary data from somewhere into memory, and I want to now convert that into an image file. What are the steps to do that: buf = urllib.urlopner().read() f = open(buf, 'wb') But this has created a file descriptor...What's happening is that after I call read() on f, I'm getting a bad file descriptor error. How do I fix this problem? Thanks, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---