Re: i18n not work?
Thanks. It works. :) On Sep 5, 8:29 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: replace : outfile = open(mo_file, 'w') outfile = open(mo_file, 'wb') in frontend.py On 8月30日, 上午1時38分, Olli Wang [EMAIL PROTECTED] wrote: Hi, folk. I just follow pylons doc Internationalization and Localization(http://wiki.pylonshq.com/display/pylonsdocs/ Internationalization+and+Localization#testing-the-application) but got something weird. In section 1.4, it said we should get the result as: Default: Hello fr: Bonjour en: Hello es: Hola! But don't know why I got the result as: Default: Hello ['fr']: bel 0.9 ['en']: bel 0 ['es']: bel 0.9 Any help? Thanks. --~--~-~--~~~---~--~~ 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: turbogears style
What are the main differencies between TG2 dispatcher pylons one? Is there any documentation regarding TG dispatcher? Thanks. Regards, skyogre Andrey Gladilin --~--~-~--~~~---~--~~ 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: Pylons and twisted?
plus Twisted's Deferreds and callbacks are enough to make many other programmers run screaming from the room. Heya, they are beautiful ;-) Especially with the @deferredGenerator and @inlineCallback syntaxes. This is pretty: @deferredGenerator def thingummy(): thing = waitForDeferred(makeSomeRequestResultingInDeferred()) yield thing # yeah, other task could run now thing = thing.getResult() print thing #the result! hoorj! and this is even prettier (but require python 2.5): @inlineCallbacks def thingummy(): thing = yield makeSomeRequestResultingInDeferred() print thing #the result! hoorj! So, one ends just writing 'normal' functions, but putting yields where it makes sense to cooperate. But given that the other megaframeworks have not yet been ported to Twisted, we could be the first! Well, maybe some argument why such works can make some sense. Thanks to the single-process, single-stack model Twisted behaves very well in tight memory requirements. Well, machines tend to be faster and greater today but there are embedded systems and ... what is of more importance for pylonsco, there are more and more people hosting web applications on VPS-s. Where one can find himself having 64MB or 96MB RAM, for example. The same context makes it possibly useful to colocate a few apps in single process. Twisted Web 1 had a WSGI server, but it was buggy and wasn't ported to Twisted Web 2. That would be the first hurdle. Searching for wsgi at twistedmatrix.com brings several results suggesting that WSGI support is still in pre-alpha state.(...) Well, I've heard of people using twisted WSGI succesfully, but the main problem is that this WSGI by itself is not very twisted-ish - it just runs deferToThread, so the normal multithreaded WSGI implementation arises. (...cut longer technical discussion...) This more or less confirms, that there are plenty of non-trivial problems to solve. Twisted apps use a special DBAPI wrapper (http://twistedmatrix.com/projects/core/documentation/howto/enterprise.html). Given its callback-style queries and separate connection pool, I don't see how you'd integrate it with SQLAlchemy. Here there were some attempts. I haven't used sAsync yet, but it may be promising: http://foss.eepatents.com/sAsync So it definitely would be much easier to get Twisted WSGI working so that it can run a non-Twisted application in a thread, (...) Well, that is true, but it also defeats the main purpose to some degree. But ... I am not complaining, I was just curious about the state of the things. The alternative, making Pylons and its dependencies into a non-blocking Twisted application, would be much more work, and it may not be possible without making incompatible changes that would break Pylons' normal usage. After reading your post, and some reconsideration, I turn to the opinion that it need not make sense to 'port pylons to twisted' directly. Better idea may be to try to merge parts of twisted.web2 with selected components from pylons (for example, to use routes for url resolution, share some layout and/or configuration ideas). --~--~-~--~~~---~--~~ 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: turbogears style
On 9月6日, 下午3時36分, Andrey Gladilin [EMAIL PROTECTED] wrote: What are the main differencies between TG2 dispatcher pylons one? Is there any documentation regarding TG dispatcher? Pylons use routes as dispatcher. TG2 dispatcher is a cherrypy style object dispatcher, which has similar behavior as TG1 . In current implementation TG2 use these two dispatcher at same time though. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tuning Pylons for tight memory requirements?
How would you tune pylons application to reduce its RAM usage as much as possible? I mean the case of rather-small-application with rather-small-trafic, which is expected to run on machine with 64 or 96MB RAM (sideways some other apps). (*) In case somebody is curious: not, not embedded system. Cheap VPS hosting. --~--~-~--~~~---~--~~ 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: Pylons and twisted?
On 9/6/07, Marcin Kasperski [EMAIL PROTECTED] wrote: plus Twisted's Deferreds and callbacks are enough to make many other programmers run screaming from the room. Heya, they are beautiful ;-) Especially with the @deferredGenerator and @inlineCallback syntaxes. This is pretty: @deferredGenerator def thingummy(): thing = waitForDeferred(makeSomeRequestResultingInDeferred()) yield thing # yeah, other task could run now thing = thing.getResult() print thing #the result! hoorj! and this is even prettier (but require python 2.5): @inlineCallbacks def thingummy(): thing = yield makeSomeRequestResultingInDeferred() print thing #the result! hoorj! So, one ends just writing 'normal' functions, but putting yields where it makes sense to cooperate. That's cool. It didn't exist the last time I tried Twisted. There was talk about how Python 2.5's generator enhancements could allow inlined callbacks within a function. But given that the other megaframeworks have not yet been ported to Twisted, we could be the first! Well, maybe some argument why such works can make some sense. Thanks to the single-process, single-stack model Twisted behaves very well in tight memory requirements. Well, machines tend to be faster and greater today but there are embedded systems and ... what is of more importance for pylonsco, there are more and more people hosting web applications on VPS-s. Where one can find himself having 64MB or 96MB RAM, for example. The same context makes it possibly useful to colocate a few apps in single process. There's also your original reason. Somebody might have a Twisted application that needs a web interface, and they'd like to write it in a normal full-featured framework with integrated Javascript/template/widget support rather than a limited designer-unfriendly framework. So it definitely would be much easier to get Twisted WSGI working so that it can run a non-Twisted application in a thread, (...) Well, that is true, but it also defeats the main purpose to some degree. But ... I am not complaining, I was just curious about the state of the things. It's important in any case for Twisted to be able to run WSGI apps, and for Pylons to be compatible with Twisted even if it has to be an inefficient threaded way. Interoperability is always a good thing, for reasons that may become apparent only later when you need it. The alternative, making Pylons and its dependencies into a non-blocking Twisted application, would be much more work, and it may not be possible without making incompatible changes that would break Pylons' normal usage. After reading your post, and some reconsideration, I turn to the opinion that it need not make sense to 'port pylons to twisted' directly. Better idea may be to try to merge parts of twisted.web2 with selected components from pylons (for example, to use routes for url resolution, share some layout and/or configuration ideas). That's a good idea, and doable. Use Pylons as a starting point, take out what you don't need or is difficult to port, and see if you can find a subset that works well with Twisted. Jython has a subset of CPython's features and adds its own, but it's close enough that you can write apps that run in both. Twisted Pylons has a nice ring to it and suggests a delightful logo of a pylon twisted from a windstorm. (The kind Sid from Toy Story would make.) -- 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 -~--~~~~--~~--~--~---
Locking a page?
Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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: Locking a page?
On 2007-09-06 Jose Galvez wrote: I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. You could look at the model the MoinMoin wiki uses (and probably most wikis). Basically, don't use the database to enforce the edit locking, but rather set an application global lock and timer on a page being edited that expires after some minutes (and make the user aware of it). Then when the time expires, warn the editor that he just lost his lock and will lose his changes permanently (or cause conflict) if he doesn't save/renew ASAP. Meanwhile, other would-be editors receive a page being edited, try again in a few minutes, or deal with conflict message when they try to edit the locked page. As soon as the lock expires you have a race between editors to try and obtain the lock. You could make it more robust with some rotation/priority protocol, but simple is probably better for human page editing. -- _ _ ___ |V|icah |- lliott [EMAIL PROTECTED] http://MicahElliott.com --~--~-~--~~~---~--~~ 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: Locking a page?
Hi Jose! I am going to face the same problem with the application I am coding, it is a sort of CMS. I have thought about adding a boolean field called lock just as you have used in the past. When a user requests a page to edit and the lock field is not set to true, she can edit the page otherwise the user gets a javascript modal window using Jquery and a plugin stating that the page can be viewed but not edited, the textarea containing the editor is then set to editable = no. When the user sets the page as published and not just saved the page, the lock field is reset and her editor is set also to editable=no This is theoretical, as I am still having problems with the Javascript library I am using and Xinha( editor) and cant test at the moment. On Sep 6, 10:07 pm, Jose Galvez [EMAIL PROTECTED] wrote: Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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: Locking a page?
This is the plugin I intend to use, it can effectively block user input if needed with notification: http://www.malsup.com/jquery/block/#page On Sep 6, 10:39 pm, voltron [EMAIL PROTECTED] wrote: Hi Jose! I am going to face the same problem with the application I am coding, it is a sort of CMS. I have thought about adding a boolean field called lock just as you have used in the past. When a user requests a page to edit and the lock field is not set to true, she can edit the page otherwise the user gets a javascript modal window using Jquery and a plugin stating that the page can be viewed but not edited, the textarea containing the editor is then set to editable = no. When the user sets the page as published and not just saved the page, the lock field is reset and her editor is set also to editable=no This is theoretical, as I am still having problems with the Javascript library I am using and Xinha( editor) and cant test at the moment. On Sep 6, 10:07 pm, Jose Galvez [EMAIL PROTECTED] wrote: Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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 -~--~~~~--~~--~--~---
URL/Link generation question
Hi folks, I'm fiddling around with h.link_to and h.url_for - trying to understand the link creation stuff better. What I understood: h.link_to generates the HTML code, h.url_for generates the URL itself based on the routes configuration and the data I provide. What I was wondering which of both methods takes care about the creation of the ? parameters of a link and any encoding of the corrresponding parameters? How does routes handle the ? parameters of a url? I digged around in the docs as well as the source but I didn't find a clue - maybe I looked for the wrong keyword. Regards, Andrew --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Conceptual question for navigation / site structuring
Hi, I have a conceptual question (or idea) I would like to discuss with the experience people out there. My background: experienced developer for GUI commercial apps, newbie for web based applications. Trigger: I found no structural support for handling the navigation = basic application structure inside Pylons. Beeing a GUI kind of developer I'm quite accustomed to something like creating and manipulating menu's to guide the user, and to restrict what the user should be able to access. What I see is that the link structure of a site somehow represents the options and functionalities - and that the main, basic structure of a website is doing primarily the same job - besides the fact that links may represent different things: access to content, access to functionality, access to external stuff, etc. Beeing a orderly and structured nice guy I would like to have a basic functionality that offers me quick and easy design delivery of such basic navigation capabilities - independent from any layout stuff. Thats the idea: all links which are static (in terms of access) are defined more-or-less by the application, to be more precise: in the pylon controllers. Call them NavLinks. All those links should be put into a central storage - call it the Navigator. The navigator is responsible to create the right set of links (they are often called topmenu, leftmenu, rightmenu in the CSS style sheets), and to feed them into the HTML generation processing (using mako templates e.g.). The Navlinks will have attributes like access groups, access roles or application states which defines who is allowed to access the link. The Navigator will then use the data to select/filter the final link structure according to the data provided by the application (user is in group A, has role B, application is in state C). Additionally there is the definition of views necessary - a view is a preselected (hand-choosen) selection of NavLinks which represents a specific basic access structure. The Navigator would take the data of the Navlinks (describing controller, action, id etc), use the selected view for getting the basic structure and would filter the links additionally according to the users/application data. The result would be then put into the HTML generation process. I have implemented a prototype which is quite handy and I'm on extending this approach to support a more generic approach. I did the prototyp for getting a better touch for the conceptual aspect... What I'm interested in: is this approach the way a experienced Pyloniac would go? How do you build the basic structure of a website? Do you hand-code such stuff? Are there libraries used for this? Would such a generic Navigator + View + NavLink class system be interesting for the Pylons community? I would sponsor the stuff since I see that Pylons should offer such functionality beeing a web development environment... Any discussion, critics, ideas welcome... :-) Regards, Andrew --~--~-~--~~~---~--~~ 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: URL/Link generation question
On 9/6/07, A. Smart [EMAIL PROTECTED] wrote: Hi folks, I'm fiddling around with h.link_to and h.url_for - trying to understand the link creation stuff better. What I understood: h.link_to generates the HTML code, h.url_for generates the URL itself based on the routes configuration and the data I provide. What I was wondering which of both methods takes care about the creation of the ? parameters of a link and any encoding of the corrresponding parameters? How does routes handle the ? parameters of a url? I believe it converts any keyword args that don't correspond to route variables into query parameters. I've got another Routes problem so I can't test it right now. -- 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 -~--~~~~--~~--~--~---
Routes config error
I have an application with an initialization function called from environment.py, which uses url_for. This worked fine in earlier svn versions of Pylons 0.9.6, but with rc3 and Routes 1.7 I get: Traceback (most recent call last): File /usr/local/bin/paster, line 8, in module load_entry_point('PasteScript==1.3.6dev-r6893', 'console_scripts', 'paster')() File /usr/local/lib/python2.5/site-packages/PasteScript-1.3.6dev_r6893-py2.5.egg/paste/script/command.py, line 78, in run invoke(command, command_name, options, args[1:]) File /usr/local/lib/python2.5/site-packages/PasteScript-1.3.6dev_r6893-py2.5.egg/paste/script/command.py, line 117, in invoke exit_code = runner.run(args) File /usr/local/lib/python2.5/site-packages/PasteScript-1.3.6dev_r6893-py2.5.egg/paste/script/command.py, line 212, in run result = self.command() File /usr/local/lib/python2.5/site-packages/PasteScript-1.3.6dev_r6893-py2.5.egg/paste/script/serve.py, line 227, in command relative_to=base, global_conf=vars) File /usr/local/lib/python2.5/site-packages/PasteScript-1.3.6dev_r6893-py2.5.egg/paste/script/serve.py, line 250, in loadapp **kw) File /usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg/paste/deploy/loadwsgi.py, line 193, in loadapp return loadobj(APP, uri, name=name, **kw) File /usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg/paste/deploy/loadwsgi.py, line 214, in loadobj return context.create() File /usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg/paste/deploy/loadwsgi.py, line 606, in create return self.object_type.invoke(self) File /usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg/paste/deploy/loadwsgi.py, line 99, in invoke return fix_call(context.object, context.global_conf, **context.local_conf) File /usr/local/lib/python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg/paste/deploy/util/fixtypeerror.py, line 57, in fix_call val = callable(*args, **kw) File /home/mso/svn/hazweb/inews/inews/config/middleware.py, line 39, in make_app load_environment(global_conf, app_conf) File /home/mso/svn/hazweb/inews/inews/config/environment.py, line 37, in load_environment config['pylons.g'] = app_globals.Globals() File /home/mso/svn/hazweb/inews/inews/lib/app_globals.py, line 18, in __init__ config[glossary.pickle_file]) File /home/mso/svn/hazweb/inews/inews/lib/glossary.py, line 105, in get_glossary _glossary = make_glossary(html_file) File /home/mso/svn/hazweb/inews/inews/lib/glossary.py, line 117, in make_glossary _fix_definitions(terms) File /home/mso/svn/hazweb/inews/inews/lib/glossary.py, line 183, in _fix_definitions a[href] = url_for(glossary, page=letter, anchor=link_id) File /usr/local/lib/python2.5/site-packages/Routes-1.7-py2.5.egg/routes/util.py, line 141, in url_for encoding = config.mapper.encoding File /usr/local/lib/python2.5/site-packages/Routes-1.7-py2.5.egg/routes/__init__.py, line 14, in __getattr__ return getattr(self.__shared_state, name) AttributeError: 'thread._local' object has no attribute 'mapper' At first i thought it was using the old syntax for accessing the Pylons config. But it looks like it's a distinct Routes config object that hasn't been initialized properly. Either that or Pylons is setting routes config.mapper later than it used to. Any ideas? -- 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: Locking a page?
Don't do this. There is no way to make 100% certain that you don't end up with stale locks. Sure, you can have an ajaxy thing that pings the server every minute or so to say, I'm still editing this, but then the user goes off to lunch and everyone is stuck until they get home. Or a malicious user can lock up all your pages forever. If you do do it, make sure your locks are merely advisory (Warning: Karl is editing this page right now.). If your data is simple enough, allow both edits and then merge changes programatically and let the user resolve conflicts (like svn). If it's too complex for that, then just show the diff and let the user merge the changes. On Thu, 2007-09-06 at 13:07 -0700, Jose Galvez wrote: Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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: Routes config error
On Sep 6, 2007, at 2:28 PM, Mike Orr wrote: I have an application with an initialization function called from environment.py, which uses url_for. This worked fine in earlier svn versions of Pylons 0.9.6, but with rc3 and Routes 1.7 I get: File /usr/local/lib/python2.5/site-packages/Routes-1.7-py2.5.egg/ routes/__init__.py, line 14, in __getattr__ return getattr(self.__shared_state, name) AttributeError: 'thread._local' object has no attribute 'mapper' At first i thought it was using the old syntax for accessing the Pylons config. But it looks like it's a distinct Routes config object that hasn't been initialized properly. Either that or Pylons is setting routes config.mapper later than it used to. Any ideas? This is probably due to routes being configured after G is initialized: config['pylons.g'] = app_globals.Globals() config['pylons.h'] = ${package}.lib.helpers config['routes.map'] = make_map() Try moving the make_map line before Globals(). The default template should probably do the same. -- 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: Routes config error
On 9/6/07, Philip Jenvey [EMAIL PROTECTED] wrote: On Sep 6, 2007, at 2:28 PM, Mike Orr wrote: I have an application with an initialization function called from environment.py, which uses url_for. This worked fine in earlier svn versions of Pylons 0.9.6, but with rc3 and Routes 1.7 I get: File /usr/local/lib/python2.5/site-packages/Routes-1.7-py2.5.egg/ routes/__init__.py, line 14, in __getattr__ return getattr(self.__shared_state, name) AttributeError: 'thread._local' object has no attribute 'mapper' At first i thought it was using the old syntax for accessing the Pylons config. But it looks like it's a distinct Routes config object that hasn't been initialized properly. Either that or Pylons is setting routes config.mapper later than it used to. Any ideas? This is probably due to routes being configured after G is initialized: config['pylons.g'] = app_globals.Globals() config['pylons.h'] = ${package}.lib.helpers config['routes.map'] = make_map() Try moving the make_map line before Globals(). The default template should probably do the same. Great, that works. I added a ticket for it, which Ben closed before I even finished this email. That eager beaver. :) -- 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 -~--~~~~--~~--~--~---
SQLAlchemy 0.3 transactions inside Pylons controllers
In one of my controller I need to use SQLAlchemy transactions. How must I proceed? Where's the transaction object? Regards, 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: Locking a page?
Hmm..then things would be harder than I expected,maybe just warning the user as David suggested would be enough, when the users ignore the warning, tough luck. I wonder how the other CMS apps take care of this problem. On Sep 7, 1:29 am, Jose Galvez [EMAIL PROTECTED] wrote: Hey voltron, I'll take a look at the library, it looks pretty cool. David Turner, makes some really good points and is really the main thing that I''ve worried about. My current site (the one that needs lots of work read I don't like the way I did it) uses a database to keep the locks, which I unlock when the user leaves the page (I'm using javascript thats pretty buggy and doesn't alway work) so I'm left doing occational cleanup on the Lock table. Luckily for this project I have a pretty limited set of users so when I delete locks I'm pretty sure I'm not getting rid of an active lock, but I'm not really fond the the code. Like I said its pretty buggy. What I really need is someway to know when a user leaves the website - but I don't think thats really possible or reliable. Jose Jose voltron wrote: This is the plugin I intend to use, it can effectively block user input if needed with notification: http://www.malsup.com/jquery/block/#page On Sep 6, 10:39 pm, voltron [EMAIL PROTECTED] wrote: Hi Jose! I am going to face the same problem with the application I am coding, it is a sort of CMS. I have thought about adding a boolean field called lock just as you have used in the past. When a user requests a page to edit and the lock field is not set to true, she can edit the page otherwise the user gets a javascript modal window using Jquery and a plugin stating that the page can be viewed but not edited, the textarea containing the editor is then set to editable = no. When the user sets the page as published and not just saved the page, the lock field is reset and her editor is set also to editable=no This is theoretical, as I am still having problems with the Javascript library I am using and Xinha( editor) and cant test at the moment. On Sep 6, 10:07 pm, Jose Galvez [EMAIL PROTECTED] wrote: Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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: Locking a page?
Hey voltron, I'll take a look at the library, it looks pretty cool. David Turner, makes some really good points and is really the main thing that I''ve worried about. My current site (the one that needs lots of work read I don't like the way I did it) uses a database to keep the locks, which I unlock when the user leaves the page (I'm using javascript thats pretty buggy and doesn't alway work) so I'm left doing occational cleanup on the Lock table. Luckily for this project I have a pretty limited set of users so when I delete locks I'm pretty sure I'm not getting rid of an active lock, but I'm not really fond the the code. Like I said its pretty buggy. What I really need is someway to know when a user leaves the website - but I don't think thats really possible or reliable. Jose Jose voltron wrote: This is the plugin I intend to use, it can effectively block user input if needed with notification: http://www.malsup.com/jquery/block/#page On Sep 6, 10:39 pm, voltron [EMAIL PROTECTED] wrote: Hi Jose! I am going to face the same problem with the application I am coding, it is a sort of CMS. I have thought about adding a boolean field called lock just as you have used in the past. When a user requests a page to edit and the lock field is not set to true, she can edit the page otherwise the user gets a javascript modal window using Jquery and a plugin stating that the page can be viewed but not edited, the textarea containing the editor is then set to editable = no. When the user sets the page as published and not just saved the page, the lock field is reset and her editor is set also to editable=no This is theoretical, as I am still having problems with the Javascript library I am using and Xinha( editor) and cant test at the moment. On Sep 6, 10:07 pm, Jose Galvez [EMAIL PROTECTED] wrote: Hi all, I'm hunting for advice. I am looking for a way to lock a webpage so that only only one person at a time can edit database data. Here is the scenario, I have a database with a limited number of users who have write access to the database, what I'd like to do is lock the editing page so that if one of my users is editing a page then the other users will not be able to edit the same page(data) at the same time. I know that this is what transactions are for in a database, but what I want to avoid is two people looking at the same unedited data and then editing it. I guess what I really want to is lock a database when I use starts editing the data. The issues are: 1) How to make sure someone exits the edit mode nicely? what happens if they enter the edit page, do nothing and just close the browser, I don't what to leave the table locked 2) if the table is locked I would still like to let users view the data in real time, jut not edit it. I've used a lock table for this in the past, but the issue that I've never figured out is how to make sure someone still needs the lock. Again number (1) from above. I hope that this makes sense, I'll be using sqlalchemy and postgres on the back end thanks for any and all advice 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: Locking a page?
On Thu, 2007-09-06 at 17:07 -0400, David Turner wrote: Don't do this. There is no way to make 100% certain that you don't end up with stale locks. Sure, you can have an ajaxy thing that pings the server every minute or so to say, I'm still editing this, but then the user goes off to lunch and everyone is stuck until they get home. If you're using JS anyway, I'd use a combination of short-refresh server-side locks (maybe 30s interval, with AJAX polling from the client to keep the lock alive) and a keystroke client-side lock with a longer (30m?) interval. If the user doesn't interact with the form for 30m, consider it unlocked and alert the user. Or a malicious user can lock up all your pages forever. Don't allow malicious users to edit your pages? =) Cliff --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---