Re: [web2py] Thanks for the awesome framework/setting up PostgreSQL
That slice is still works. The version number of postgres might be different, so instead of 8.3 use 8.4 or similar. You might also find things like auto_vacuum come set on by default in newer versions of postgres. Some of the web2py setup gets confusing at the end since I made some assumptions on how to configure the paths and used scripts the generation of apache config files. However by that point you could pick up at the book on enabling web2py through wsgi and apache. -- Thadeus On Wed, Jul 13, 2011 at 10:35 AM, Eric Scott erictransla...@gmail.comwrote: Dear Massimo and the rest of the dev team, You and your team have assembled a wonderful framework here. Coming from a PHP/CakePHP background (non-professional other than some work as a web designer in the late 1990s), I decided to switch to a python- based framework and spent the past week carefully researching options. After seriously considering Django, I ended up deciding upon web2py, first and foremost because it's clear that you and your team very publically stand behind your product. Thanks again for a wonderful tool -- it's much appreciated (and I just made a donation to the project to express my appreciation more concretely). I've started playing around with the framework on an EC2 instance, which is probably where I'll keep it for a small app I'm developing. I do have a question for the list: I'd like to set it up to work with PostgreSQL instead of SQlite. Is this the latest HOWTO on setting web2py up with PostgreSQL: http://www.web2pyslices.com/slices/take_slice/14 It looks like a very good HOWTO but I want to be sure it's current before I use it. I've got it set up on my virtual machine and I'm very familiar with SQL so it should not be too hard for me to set up the database; I just need recent documentation on setting web2py to work with it instead of sqlite. Thanks in advance for any input on guides to setting up PostgreSQL with web2py. Kind regards, Eric Eric Scott Bullington
Re: [web2py] Re: Using web2py's view/template engine in a standalone application
What you really want is template.parse_template. Still requires restricted but only for the exception raising. Very simple. from template import parse_template print parse_template('main.html', path='/path/to/custom/views/', context=dict()) -- Thadeus On Mon, Jun 6, 2011 at 12:55 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It is LGPL not GPL. very different. ;-) On Jun 6, 12:36 am, Karel Antonio Verdecia Ortiz kverde...@uci.cu wrote: Hi, I've been using the web2py template engine for a while. I don't remember if I had to make some change to the template.py module nor the version of the web2py this module comes from so I attach it in this email. This was the way I could make it work (there is probably a simpler one): from template import TemplateParser context = {} output = cStringIO.StringIO() def response_writer(data, escape=False): output.write(unicode(data)) context['response_writer'] = response_writer source = self._template() exec(str(TemplateParser(source, context=context, writer='response_writer'))) in context content = output.getvalue() I have a question about this module. It's GPL3 license. If I modify it an ditribute it in an application, do this application have to be GPL3 licensed? I apologize if my english if very bad. My language is spanish. El 06/06/11 00:59, Ryan Seto escribi�: Thanks! That does solve the import restricted dependency. The import globals for the Response() object is still an issue. I tried fiddling with my copy to build a mock Response() object if we can't import globals. This is what I have so far: gluon/template.py | line 867 ~ # Here to avoid circular Imports try: from globals import Response except: import cStringIO from xml.sax.saxutils import escape, quoteattr class Response(): def __init__(self): self.body = cStringIO.StringIO() def write(self, data, escape=True): if not escape: self.body.write(str(data)) elif hasattr(data,'xml') and callable(data.xml): self.body.write(data.xml()) else: # otherwise, make it a string if not isinstance(data, (str, unicode)): data = str(data) elif isinstance(data, unicode): data = data.encode('utf8', 'xmlcharrefreplace') self.body.write(data) ~ I was planning to escape the data with the escape and quoteattr provided from xml.sax.saxutils, but I wasn't successful with that, so I left it out for now. Here's my code snippet: nixie/util/text.py | line 19 ~ import os, subprocess, paths, template def render(inFile): content = pandoc(str(inFile)) templateFile = os.path.join(paths.get_prog_root(), 'templates', 'view.html') styles = [] styles.append(os.path.join(paths.get_prog_root(), 'css', 'style.css')) return template.render( filename=templateFile, context=dict(content=content, styles=styles) ) ~ templates/view.html ~ html head {{for css in styles:}} link rel=stylesheet href={{=css}} type=text/css / {{pass}} /head body {{=content}} /body /html ~ When I run this, I get an error message that doesn't really help me much. Here's the output: ~ C:\projects\nixiec:\Python26\python.exe Nixie.py README.txt Traceback (most recent call last): File C:\projects\nixie\nixie\qt\NixieAccessManager.py, line 41, in createRequest reply = NixieReply(request.url(), self.GetOperation, parent=self) File C:\projects\nixie\nixie\qt\NixieReply.py, line 30, in __init__ self.content = text.render(url.toLocalFile()) File C:\projects\nixie\nixie\util\text.py, line 22, in render content = pandoc(str(inFile)) File C:\projects\nixie\nixie\util\text.py, line 63, in pandoc cwd = cwd File c:\Python26\lib\subprocess.py, line 623, in __init__ errread, errwrite) File c:\Python26\lib\subprocess.py, line 833, in _execute_child startupinfo) WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect ~ Although it looks like pandoc(str(inFile)) might be the culprit from the stack trace, if I just use the output from pandoc(str(inFile)), everything works fine, so I doubt that this is the cause. I really appreciate your help. I've started trying Pandoc (http://johnmacfarlane.net/pandoc/) instead of the python-markdown
Re: [web2py] Re: Using web2py's view/template engine in a standalone application
Yes.. You need some sort of response class that has a .write method... this can be a hacked up cStringIO or other. Alternatively you can perform the same thing manually by passing in writer, which instead of the template engine writing ``response.write(%s)`` it could write whatever you want as a callable function. So for example, say you defined your ``CustomResponse`` class as earlier in the list... context['response'] = CustomReponse() exec(parse_template(...)) in context print context['response'].body.getvalue() SO yeah... in the end if we implemented your suggestion of overriding the response class on import, then the render function would work as expected. -- Thadeus On Mon, Jun 6, 2011 at 12:26 PM, Ryan Seto mr.werew...@gmail.com wrote: Hm, that doesn't seem to be it either. I don't get a requirement for the globals module, but what I get back is this: ~ print parse_template('view.html', path='templates', context=dict(content='test')) response.write(content) response.write('\r\n', escape=False) ~ Am I supposed to execute what parse_template returns? Thank you for your help. On Mon, Jun 6, 2011 at 11:53 AM, Thadeus Burgess thade...@thadeusb.com wrote: What you really want is template.parse_template. Still requires restricted but only for the exception raising. Very simple. from template import parse_template print parse_template('main.html', path='/path/to/custom/views/', context=dict()) -- Thadeus On Mon, Jun 6, 2011 at 12:55 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It is LGPL not GPL. very different. ;-) On Jun 6, 12:36 am, Karel Antonio Verdecia Ortiz kverde...@uci.cu wrote: Hi, I've been using the web2py template engine for a while. I don't remember if I had to make some change to the template.py module nor the version of the web2py this module comes from so I attach it in this email. This was the way I could make it work (there is probably a simpler one): from template import TemplateParser context = {} output = cStringIO.StringIO() def response_writer(data, escape=False): output.write(unicode(data)) context['response_writer'] = response_writer source = self._template() exec(str(TemplateParser(source, context=context, writer='response_writer'))) in context content = output.getvalue() I have a question about this module. It's GPL3 license. If I modify it an ditribute it in an application, do this application have to be GPL3 licensed? I apologize if my english if very bad. My language is spanish. El 06/06/11 00:59, Ryan Seto escribi�: Thanks! That does solve the import restricted dependency. The import globals for the Response() object is still an issue. I tried fiddling with my copy to build a mock Response() object if we can't import globals. This is what I have so far: gluon/template.py | line 867 ~ # Here to avoid circular Imports try: from globals import Response except: import cStringIO from xml.sax.saxutils import escape, quoteattr class Response(): def __init__(self): self.body = cStringIO.StringIO() def write(self, data, escape=True): if not escape: self.body.write(str(data)) elif hasattr(data,'xml') and callable(data.xml): self.body.write(data.xml()) else: # otherwise, make it a string if not isinstance(data, (str, unicode)): data = str(data) elif isinstance(data, unicode): data = data.encode('utf8', 'xmlcharrefreplace') self.body.write(data) ~ I was planning to escape the data with the escape and quoteattr provided from xml.sax.saxutils, but I wasn't successful with that, so I left it out for now. Here's my code snippet: nixie/util/text.py | line 19 ~ import os, subprocess, paths, template def render(inFile): content = pandoc(str(inFile)) templateFile = os.path.join(paths.get_prog_root(), 'templates', 'view.html') styles = [] styles.append(os.path.join(paths.get_prog_root(), 'css', 'style.css')) return template.render( filename=templateFile, context=dict(content=content, styles=styles) ) ~ templates/view.html ~ html head {{for css in styles:}} link rel=stylesheet href={{=css}} type=text/css / {{pass}} /head body {{=content
Re: [web2py] Re: Using web2py's view/template engine in a standalone application
What you have looked good. The exception looks like its pandocs fault not the template system. -- Thadeus On Mon, Jun 6, 2011 at 1:03 PM, Ryan Seto mr.werew...@gmail.com wrote: I see. Would you like me to try and come up with a patch for this? On Mon, Jun 6, 2011 at 1:53 PM, Thadeus Burgess thade...@thadeusb.com wrote: Yes.. You need some sort of response class that has a .write method... this can be a hacked up cStringIO or other. Alternatively you can perform the same thing manually by passing in writer, which instead of the template engine writing ``response.write(%s)`` it could write whatever you want as a callable function. So for example, say you defined your ``CustomResponse`` class as earlier in the list... context['response'] = CustomReponse() exec(parse_template(...)) in context print context['response'].body.getvalue() SO yeah... in the end if we implemented your suggestion of overriding the response class on import, then the render function would work as expected. -- Thadeus On Mon, Jun 6, 2011 at 12:26 PM, Ryan Seto mr.werew...@gmail.com wrote: Hm, that doesn't seem to be it either. I don't get a requirement for the globals module, but what I get back is this: ~ print parse_template('view.html', path='templates', context=dict(content='test')) response.write(content) response.write('\r\n', escape=False) ~ Am I supposed to execute what parse_template returns? Thank you for your help. On Mon, Jun 6, 2011 at 11:53 AM, Thadeus Burgess thade...@thadeusb.com wrote: What you really want is template.parse_template. Still requires restricted but only for the exception raising. Very simple. from template import parse_template print parse_template('main.html', path='/path/to/custom/views/', context=dict()) -- Thadeus On Mon, Jun 6, 2011 at 12:55 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It is LGPL not GPL. very different. ;-) On Jun 6, 12:36 am, Karel Antonio Verdecia Ortiz kverde...@uci.cu wrote: Hi, I've been using the web2py template engine for a while. I don't remember if I had to make some change to the template.py module nor the version of the web2py this module comes from so I attach it in this email. This was the way I could make it work (there is probably a simpler one): from template import TemplateParser context = {} output = cStringIO.StringIO() def response_writer(data, escape=False): output.write(unicode(data)) context['response_writer'] = response_writer source = self._template() exec(str(TemplateParser(source, context=context, writer='response_writer'))) in context content = output.getvalue() I have a question about this module. It's GPL3 license. If I modify it an ditribute it in an application, do this application have to be GPL3 licensed? I apologize if my english if very bad. My language is spanish. El 06/06/11 00:59, Ryan Seto escribi�: Thanks! That does solve the import restricted dependency. The import globals for the Response() object is still an issue. I tried fiddling with my copy to build a mock Response() object if we can't import globals. This is what I have so far: gluon/template.py | line 867 ~ # Here to avoid circular Imports try: from globals import Response except: import cStringIO from xml.sax.saxutils import escape, quoteattr class Response(): def __init__(self): self.body = cStringIO.StringIO() def write(self, data, escape=True): if not escape: self.body.write(str(data)) elif hasattr(data,'xml') and callable(data.xml): self.body.write(data.xml()) else: # otherwise, make it a string if not isinstance(data, (str, unicode)): data = str(data) elif isinstance(data, unicode): data = data.encode('utf8', 'xmlcharrefreplace') self.body.write(data) ~ I was planning to escape the data with the escape and quoteattr provided from xml.sax.saxutils, but I wasn't successful with that, so I left it out for now. Here's my code snippet: nixie/util/text.py | line 19 ~ import os, subprocess, paths, template def render(inFile): content = pandoc(str(inFile
Re: [web2py] Re: New Storage() Object Breaks Backwards Compatibility
Keep None on the Storage object, then create a new class and call it MultiStorage which implements the new functionality. -- Thadeus On Thu, Jun 2, 2011 at 12:37 PM, Carlos carlosgali...@gmail.com wrote: Hi Massimo, I use Storage in many places, and I always compare with is None, which I believe would now break my code. I also vote for explicit initialization, and make sure that is None works ok. Thanks, Carlos
Re: [web2py] Re: super in templates
Ah right, you can't have includes inside of blocks ! This is not a bug, just a side-effect of how includes are implemented vs blocks. I know understand the reasoning behind the str(t.content) patch, which was a workaround to getting includes to work inside of blocks, but not the proper solution. It only worked because of the str(t.content) workaround, otherwise you were not able to have includes inside blocks from the beginning. -- Thadeus On Tue, May 31, 2011 at 1:59 PM, teemu teemu.kuulas...@gmail.com wrote: Hi I tried to figure out this problem more carefully and I found the reason why my app didn't work anymore: If the parent block contains {{include 'some_file'}} and view tries to extend it by calling {{super}}, whole parent block will be ignored!!! I don't see any error messages etc. This behavior has been changed after version 1.94.6. The same code works in 1.94.6 but not in 1.95.1. Unfortunately I do not know web2py internals enough to figure out what has been changed since! Simplified test case: controller function (default.py): -- def test(): return dict(); -- view (test.html): - {{extend 'layout.html'}} {{block content}} this text will be shown in web page correctly {{super}} {{end content}} -- view (layout.html): (stripped down, only relevant block is shown) - . {{block content}} this text wont be seen in web page if this block is extended by calling super! {{include 'test.txt'}} {{end content}} . - dummy text file (test.txt) - some irrelevant text to be included into view - If I remove {{include 'text.txt'}} from layout.html everything works perfectly (text/code from the parent block will be included in extended block). Web2py doesn't allow include directives in parent blocks anymore!! Teemu
Re: [web2py] Re: update is not saved in the database??
Use ``update_record`` instead of ``update``. the ``update`` function comes from the dict parent class, and does not issue SQL. ``update_record`` is a web2py thing that will take any changes made to the record instance (by use of assignment or update function) and issue the appropriate SQL -- Thadeus On Mon, May 9, 2011 at 9:37 PM, niknok nikolai...@gmail.com wrote: Yes, guys thanks. I realized that that was the culprit this morning. Hard to decode with beer fogging your thoughts... :P Reverted to the original and all is working again. I forgot I was testing that line from a code in the book. On May 9, 11:01 pm, Anthony abasta...@gmail.com wrote: On Monday, May 9, 2011 10:45:36 AM UTC-4, niknok wrote: I have these lines that is supposed to update a record but it doesn't: db.card.validated.writable=True db.card.modified_by.writable=True db.card(db.card.alnum==c_hash).update(validated=True,modified_by=auth.user. id) Is there anything I missed? I tried to include a manual db.commit(), but that didn't work either. You can use the db.card(db.card.alnum==c_hash) notation to fetch a row (though I think you have to include the record ID as the first argument), but I'm not sure you can use it to update a record. For that, you may have to use the usual query notation: db(db.card.alum==c_hash).update(...). You might also be able to use your original notation along with update_record, but I don't see any reason to prefer that over the usual method. Anthony
Re: [web2py] Re: problem with {{block}}s inside included files (v.1.95.1)
It should be possible to do this. The way templates handle include files has been broken. This is what it should be doing PARENT LOAD include_filename CREATE PARSE TREE EXTEND PARSE TREE TO PARENT CONTINUE In effect, the entire tree of the included file gets grafted back onto the parent tree as if the included file never existed. tl;dr; Should work just fine, somethings broke, plz help fix! -- Thadeus On Thu, May 5, 2011 at 1:37 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: uded in one of the blocks seems to extend a block included in another block. I am unsure this is suppo
Re: [web2py] Re: problem with {{block}}s inside included files (v.1.95.1)
Take a look at the ``template.Content.__str__`` method, this is what is responsible for flattening the tree. Calling ``str()`` on any instance of Content effectively flattens it to text, since there is only text in the parent tree, it has no knowledge of any blocks that might have existed in the included tree. The only point at which the tree should be flattened is at the very end of the parsing when the entire tree is assembled. -- Thadeus On Thu, May 5, 2011 at 3:24 PM, Thadeus Burgess thade...@thadeusb.comwrote: Your code should work just fine kasapo, the template system was designed to do that. Someone at some point made a patch to the template that broke the way this is supposed to work. http://code.google.com/p/web2py/source/diff?spec=svnc6ff592d73ef81257a8d238a74b688c9b3a09360r=e6868622d71ec96947b4bb08a44c527c9722b062format=sidepath=/gluon/template.pyold_path=/gluon/template.pyold=8d5d7f6bd391d2e30888c2c9fc168c081d02877f Basically, instead of just copying the included templates tree into the parent templates tree, they changed it so it would flatten the tree to text, and just include the text into the parent tree. All contexts are lost when the tree gets flattened. -- Thadeus On Thu, May 5, 2011 at 2:53 PM, kasapo kas...@gmail.com wrote: First off -- let me say that my usage of the templating in this case is somewhat peculiar, and if they are not supposed to work like this, that is fine. After reviewing my app, I only have one instance of code like this, and it is vestigial and should be removed anyhow. But I thought it strange that it broke, and I'm wondering if I might have another include/block problem. Solution: diff -r fe58378e989b gluon/template.py --- a/gluon/template.py Wed May 04 18:58:40 2011 -0500 +++ b/gluon/template.py Thu May 05 14:46:21 2011 -0500 @@ -454,7 +454,8 @@ writer = self.writer, delimiters = self.delimiters) -content.append(str(t.content)) +content.append(t.content) +#content.append(str(t.content)) def extend(self, filename): Read on for how I got there and a strange LDAP_auth issue... On May 5, 1:37 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Hello kasapo, I do not completely follow you code. If I do, you have two blocks. The code included in one of the blocks seems to extend a block included in another block. I am unsure this is supposed to work. Anyway, let's try figure out what has changed that broke and then we may be able to revert the previous behavior. So I have this structure: bare (defines html, head, style, script (jquery includes), body sections, and some containing blocks) -- ancestor to almost all templates right-col (included by bare, defines blocks which base will extend -- base extends bare, bare includes right-col so therefore base should be able to see blocks defined by bare) base (defines styles, background, etc -- the base template for most things -- defines actual markup for blocks which are DEFINED in right- col) page (extends base, does not use blocks -- the menu rendered on the page view is defined in base inside of a block that is defined in bare via right-col include) page-no-side-nav ( extends base, uses {{ block right-col }}{{end}} to delete the right column ) Can you try: hg revert -r 1488 gluon/template.py ~/Downloads/template.diff Sadly, I am on RHEL and mercurial isn't present... so I will use my local machine (Macintosh). First off, I use LDAP authentication for a login method, and (this happened on 1.95.1 on RHEL server as well) I get this error: Traceback (most recent call last): File /Users/csburreson/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /Users/csburreson/web2py/applications/icecube/models/ 0_init.py, line 42, in module from gluon.contrib.login_methods.ldap_auth import ldap_auth File /Users/csburreson/web2py/gluon/custom_import.py, line 80, in _web2py__import__ return _old__import__(name, globals, locals, fromlist, level) File /Users/csburreson/web2py/gluon/contrib/login_methods/ ldap_auth.py, line 5, in module except e: NameError: name 'e' is not defined So I just copied the working ldap_auth.py from the 1.89 version of web2py... problem solved (could this somehow create an issue with templates?) Then I realized I did not have python-ldap installed, so I did easy_install python-ldap and all was good. [I did exactly these same things earlier today when installing the TEST server] SO, now the application is again working, and I check out my code into the applications folder using SVN. The menu is not present :( Then I run : hg revert -r 1488 gluon/template.py And check my app and the side menu IS present So, I go back to 1.95.1 (with the exception of the old ldap_auth.py from 1.89) and try hg diff -r 1488 gluon/template.py
Re: [web2py] Re: help testing
Nononononononono This breaks the way it currently works. I have multile web2py apps that take advantage of subfolders for models to group them in the way they should execute. This feature means i could NEVER upgrade my apps again. On May 1, 2011 7:44 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: not that I recommend this but you can do def index(): execfile(os.path.join(request.folder,'models','mymodel.py')) ... return locals() The execfile can be outside. I do not think it is a good idea because it would not take advantage of pyc caching, bytecode compilation would break and because it is better to define code to be executed on demand in modules (not models), import them and call functions that do what you need conditionally. On May 1, 7:04 pm, Bruno Rocha rochacbr...@gmail.com wrote: great improvement, I am testing right now. A question that will raise soon is: How do I execute a model on demand? if I am in /default/foo and want an object defined in /default/bar, how do I force this model file to run? -- Bruno Rocha [ About me:http://zerp.ly/rochacbruno] On Sun, May 1, 2011 at 7:30 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: In trunk we have - experimentally - conditional web2py models 1) models/anything.py (for all controllers) 2) models/c/anything.py (only forfunction in controller c) 3) models/c/f/anything.py (only for function f in controller c) when you canhttp:///c/f all models 1 are executed alphabetically, the 2 alphabetically then 3 alphabetically. Please help us test that: 1) it works 2) it works if you bytecode compile the app 3) it does not apps that were bytecode compiled with a previous web2py version This should provide a major speedup for those apps with lots of tables like ShanaEden. Massimo
Re: [web2py] Re: reddit again
I do not bother using reddit for anything other than laughing at some trollface comics every once in a blue moon. -- Thadeus On Tue, Mar 22, 2011 at 9:49 AM, ron_m ron.mco...@gmail.com wrote: Maybe they are just jealous they never thought of what you have done before you made it a reality with web2py.
Re: [web2py] Re: DAL new syntax RFC
You can already do URL('default', 'home') It has been in web2py for some months now. -- Thadeus On Mon, Mar 7, 2011 at 9:20 PM, pbreit pbreitenb...@gmail.com wrote: If we are evaluating enhancements that save a few keystrokes AND increase clarity, I'd consider this. :-) URL('default/home') for URL(c='default', f='home') or URL('default', 'home')
Re: [web2py] Re: DAL new syntax RFC
Explicit is better than implicit. Typing is cheap. Design is the hardest part of development. -- Thadeus On Sat, Mar 5, 2011 at 2:52 PM, Vidul Petrov vidul.r...@gmail.com wrote: I agree with Stefaan. However the ':' before a variable name notation looks like the Ruby symbols whose only purpose was improved performance (lightweight strings) but lead inevitably to confusion (IMHO). On Mar 4, 5:55 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: There are some new features in trunk: 1) I got tired of writing default='value',readable=False,writable=False etc. So: Field(':name') is the same as Field('name',readable=False,writable=False) Field('.name') is the same as Field('name',readable=True,writable=False) Field('name=value') is the same as Field('name',default='value') and combinations: Field(':name=value') is the same as Field('name',default='value',readable=True,writable=False) notice Field('name=') is the same as Field('name',default='') 2) db(db.table).select((db.table.field.length()+5).sum()) note operators length(), +5, sum() can be combined in more ways than before.
Re: [web2py] Re: Error in templating system
Ok, when put into this context I agree, it should be fixed. It should all behave the same. -- Thadeus On Fri, Mar 4, 2011 at 8:22 PM, Jonathan Lundell jlund...@pobox.com wrote: s a strange set of rules, if you ask me. And confusing, as we've already seen, especially since the error message is not hel
Re: [web2py] Re: Error in templating system
I don't think you should have code included in a {{= block. {{= should ONLY be used to wrap anything in its code block with a response.write(). Exactly how it does it now. Doing otherwise is simply bad template design. I consider it a bug if it ever worked before. Allowing this syntax encourages template writers to do things in non-standard ways that won't make obvious sense to anybody else attempting to read their templates. (I currently have to maintain and re-write some very ugly web2py code in my day job... the previous guys working severely abused the power of the template system and it has caused us many issues/headaches because of it). tl;dr - it is the desired behaviour, update your app code to standards. lets not complicate web2py further. -- Thadeus On Fri, Mar 4, 2011 at 3:21 PM, Jonathan Lundell jlund...@pobox.com wrote: On Mar 4, 2011, at 12:54 PM, Massimo Di Pierro wrote: All I meant is that {{=msg pass}} should become: response.write(msg) pass and not response.write(msg pass) since there is no ambiguity. Right. The question the code has to answer, implicitly, is: exactly what is the termination of whatever will be passed to response.write. If the = doesn't appear at the beginning of a code block, the answer is: the next newline, or the end of the code block, whichever comes first. I think that's the right answer. It does mean that: {{=msg abc pass}} will become: response.write (msg abc) pass ...but I think that's OK; it's just a normal syntax error. It's really too complicated to try to parse the argument, since you want things like {{=abc def pass}} to work. I *think* that this will still work: {{=string on multiple lines pass}} ...because the '=' detection comes after the multiline-string escape. On Mar 4, 2:25 pm, Jonathan Lundell jlund...@pobox.com wrote: On Mar 4, 2011, at 12:19 PM, Massimo Di Pierro wrote: I agree that that is what it should do. Please open a ticket about this. Are you saying (I think) that both cases should terminate on a newline (if present)? On Mar 4, 11:20 am, Jonathan Lundell jlund...@pobox.com wrote: On Mar 4, 2011, at 1:52 AM, szimszon wrote: web2py™ Version 1.92.1 (2011-02-16 15:04:40) Python Python 2.5.2: /usr/bin/python Traceback (most recent call last): File /home/szimszon_nfs/web2py/gluon/restricted.py, line 186, in restricted ccode = compile2(code,layer) File /home/szimszon_nfs/web2py/gluon/restricted.py, line 173, in compile2 return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec') File /home/szimszon_nfs/web2py/applications/serveradmin/views/ integrity/ftp.html, line 123 pass ^ SyntaxError: invalid syntax if msg: response.write('\nh2', escape=False) response.write(T(Commands executed)) response.write('/h2\n', escape=False) response.write(XML(msg) pass My template was working until now (I don't know exactly from what web2py version is it bad). My template was: {{if msg:}} h2{{=T(Commands executed)}}/h2 {{ =XML(msg) pass try: dname=request.args[1] except: dname=0 pass editname=T('New')}} Thadeus might want to chime in here if I have the details wrong (there really ought to be a formal reference for template syntax; the tutorial in the book is nice, but not complete). There's a subtle difference in template parsing when =something appears at the beginning of an escaped block (where beginning ignores white space, so =XML above is regarded as being at the beginning of the code block). You probably know already that =something is translated to response.write(something). But the question arises, what exactly is something? That is, where does it end? And when the '=something' is found at the beginning of a code block, 'something' is defined to be *everything until the end of the code block*. When '=something' is found *embedded* in a code block (not at the beginning, ignoring white space), then the end of 'something' is either the next newline or the end of the code block, whichever comes first. So (to shorten up the problem here), you've effectively got this: {{=msg pass}} ...which becomes: response.write(msg pass) ...and Python is going to object. On the other hand, if you had written: {{if xyz: =msg pass}} The output will be: if xyz: response.write(msg) pass ...and everybody's happy. Because =msg wasn't the first thing in the code block, only msg gets included in the response.write argument. Is there a good reason for =something to be interpreted two different ways? I'm not sure it's intentional. Thadeus? Massimo? Now I had to modify: {{if msg:}} h2{{=T(Commands executed)}}/h2 {{ =XML(msg)}} - {{pass --- try: dname=request.args[1] except:
Re: [web2py] Re: Unit testing in web2py : Some thoughts
test_runner in web2py_utils was designed around slice 67. test_runner lets you do a little more, and handles more of the state management for you. -- Thadeus On Tue, Mar 1, 2011 at 5:57 AM, eddie eddie.sh...@gmail.com wrote: I should add I'm on web2py version 1.92.1. And I should also add I'm extremely supportive of the efforts to build some better unit testing infrastructure like this, these examples are fantastic.
[web2py] Pass args to function with cron
Using the following syntax... */5 * * * *root *default/do/arg1/arg2/arg3 It fails with Invalid application name Is there a way to pass args to the functions when using the web2py cron? -- Thadeus
Re: [web2py] Re: GSoC
statistics engine = statlib -- Thadeus On Wed, Feb 16, 2011 at 9:22 PM, Jason Brower encomp...@gmail.com wrote: Local editor integration and permenent admin settings for that and other features. - Original message - We need proposals. What do we want to be done? On Feb 16, 2:57 pm, Tim Michelsen timmichel...@gmx-topmail.de wrote: Hello, is web2py considering to mentor for this year? http://code.google.com/intl/de-DE/soc/ Regards, Timmie
[web2py] Create databases folder
Isn't web2py supposed to create the databases, sessions, uploads, etc folders if they don't exist? -- Thadeus
Re: [web2py] Create databases folder
Nope not working for me. A raw checkout of a branch, there is no NEWINSTALL file, nor a welcome.w2p file since we don't need it. The app only contains controllers, cron, languages, models, modules, static, tests, views, __init__.py. From this state, when starting web2py just by python web2py.py. Navigate to the app in firefox or other web browser, and it crashes because it cannot connect to the sqlite database 5 times, this is because the databases folder does not exist from a raw checkout of our app, and web2py does not seem to be creating any of the folders. If I navigate into my app directory, and run ``mkdir databases`` then navigate to the app, everything is fine, and web2py ends up making the uploads, private, cache, sessions, and errors folders. -- Thadeus On Fri, Feb 4, 2011 at 12:06 PM, Bruno Rocha rochacbr...@gmail.com wrote: I now removed ['cache','cron','uploads','databases','sessions'] ran web2py and it created all folders for me.
Re: [web2py] Re: Create databases folder
I know. I thought that this had been patched in web2py, and I was just wondering the feature got lost in the translation to the new DAL. -- Thadeus On Fri, Feb 4, 2011 at 4:16 PM, Kurt Grutzmacher gr...@jingojango.netwrote: If migrate is True on your Fields then web2py will want to have the databases directory existing first as it tries to open databases/ sql.log first. If this directory doesn't exist then an exception is thrown. web2py$ ls -FC applications/newapp/ ABOUT __init__.py controllers/ languages/ modules/views/ LICENSE cache/ cron/ models/ static/ wizard.metadata web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Traceback (most recent call last): File /Users/grutz/src/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File applications/newapp/models/db.py, line 80, in module auth.define_tables(migrate=settings.migrate) # creates all needed tables File /Users/grutz/src/web2py/gluon/tools.py, line 1198, in define_tables format = '%(role)s (%(id)s)') File /Users/grutz/src/web2py/gluon/dal.py, line 3490, in define_table polymodel=polymodel) File /Users/grutz/src/web2py/gluon/dal.py, line 522, in create_table logfile = self.file_open(table._loggername, 'a') File /Users/grutz/src/web2py/gluon/dal.py, line 359, in file_open fileobj = open(filename,mode) IOError: [Errno 2] No such file or directory: 'applications/newapp/ databases/sql.log' web2py$ mkdir applications/newapp/databases web2py$ python web2py.py -S newapp -M web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.91.6 (2011-02-01 17:13:19) Database drivers available: SQLite3, pymysql, PostgreSQL Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) Type copyright, credits or license for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. In [1]:
Re: [web2py] Re: Create databases folder
I will add debugging to find out next time I am working on it. -- Thadeus On Fri, Feb 4, 2011 at 7:11 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: As Jonathan says, it is main that creates the missing folders, the first time the app is accessed. dal just assumes it is there. On Feb 4, 4:56 pm, Jonathan Lundell jlund...@pobox.com wrote: On Feb 4, 2011, at 1:19 PM, Thadeus Burgess wrote: Nope not working for me. A raw checkout of a branch, there is no NEWINSTALL file, nor a welcome.w2p file since we don't need it. The app only contains controllers, cron, languages, models, modules, static, tests, views, __init__.py. From this state, when starting web2py just by python web2py.py. Navigate to the app in firefox or other web browser, and it crashes because it cannot connect to the sqlite database 5 times, this is because the databases folder does not exist from a raw checkout of our app, and web2py does not seem to be creating any of the folders. If I navigate into my app directory, and run ``mkdir databases`` then navigate to the app, everything is fine, and web2py ends up making the uploads, private, cache, sessions, and errors folders. Odd. The admin.create_missing_app_folders() call in main.wsgibase should be creating the folder. Could you throw a couple of strategic debug prints into that function and see what's going on?
[web2py] SQLCustomType
Has this been deprecated? If not, a refresher on how to make a simplejson type and perhaps a section of the book devoted to custom types? -- Thadeus
Re: [web2py] Re: LIKE case sensitivity: Postgres differs to MySQL = DAL not portable
I disagree! Your playing with things that shouldn't be played with. Not to mention that now you have just broken some of my apps that perform case-sensitive queries in postgres this is just plain wrong in so many ways. Add a new identifier to DAL... give me db(db.table.name.like('%printer%')) and then for case insensitive db(db.table.name.ilike('%printer%')). like would perform the actual operation that would happen from the RDBMS, and ilike can be a web2py playing god version that makes sure all rdbmses act the same. Case sensitive search is one of the benefits of using postgres instead of mysql! -- Thadeus On Fri, Jan 28, 2011 at 8:40 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I agree the behavior should be uniform. The easiest way is to make the LIKE always case insensitive. I am patching trunk to use ILIKE with postgresql. On Jan 28, 3:01 am, KMax mkostri...@gmail.com wrote: On 7 дек 2010, 00:31, Fran francisb...@gmail.com wrote: - minimally it should be in a FAQ (ideally in the next Book) ideally we could have a case_sensitive=True option for the DAL like() operator...to ensure that both pgsql mysql/sqlite existing apps didn't break, it could default differently depending on the db type? +1 vote sqlite has some issue with not ascii chars compare, but work in progress pgsql has ilike which works like mysql like (fix me) I' just patch dal to use ilike in .like() query for postgres, but it more cheat then solution.
Re: [web2py] Re: How to do a count distinct with DAL?
Can we not add per-dialect identifiers to DAL... I can see adding this just for postgres ms sql. -- Thadeus On Fri, Jan 28, 2011 at 8:43 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is not supported because I am not sure all supported RDBS support count(distinct ...). As a way around it you can do len(db().select(db.item.of_variant,distinct=True)) Massimo On Jan 28, 6:32 am, vortex billyara...@gmail.com wrote: How to do a count distinct with DAL? like: db().count(db.item.of_variant, distinct=True)
Re: [web2py] Re: LIKE case sensitivity: Postgres differs to MySQL = DAL not portable
IMHO This breaks backwards compatibility... -- Thadeus On Sat, Jan 29, 2011 at 6:31 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I treat this as a bug fix. On Jan 28, 12:52 pm, Anthony abasta...@gmail.com wrote: On Friday, January 28, 2011 12:58:30 PM UTC-5, Massimo Di Pierro wrote: We need two steps: 1) make it behave the same (which means case insensitive, ilike on postgresql, now in trunk) Doesn't this change break backward compatibility, or are you treating this as a bug fix? 2) yes we can add a case_sensitive arg that defaults to True (not done yet but I would take a patch). If we do want to maintain backward compatibility, wouldn't the new case arg have to default to something like let the RDBMS decide -- it couldn't just default to True (or False) because different databases have different defaults, no? On the other hand, if that's not a concern, do we want case_sensitive to default to True -- it sounds like not all databases even offer that option? On Jan 28, 11:37 am, Anthony abas...@gmail.com wrote: What if like() had something like a 'case' argument, with three possible values: sensitive, insensitive, and rdbms_default (defaulting to rdbms_default)? We obviously need to maintain backward compatibility, but like() is a web2py operator, not a specific RDBMS operator, so it would be nice if there's any easy way to make sure like() calls are as portable as possible without requiring code changes. Anthony
Re: [web2py] Why web2py? and not django?
web2py = programmers framework django = designers framework Do you have more designers or programmers? -- Thadeus On Wed, Jan 26, 2011 at 10:59 AM, Lars Hansson romaby...@gmail.com wrote: Yeah, but if everyone sits around waiting for the champion to appear there won't be one. Someone has to take the plunge. Cheers, Lars Hansson
Re: [web2py] Re: Can I share web2py authorization db across multiple apps
Also, make sure the sessions folder is either A) Symlinked to each other application or B) Store sessions in database or in a cookie. -- Thadeus On Wed, Jan 26, 2011 at 9:38 AM, ron_m ron.mco...@gmail.com wrote: Also check this setting originally in db.py of the scaffolding app auth.settings.hmac_key = 'sha512:.' If you want to share the table across apps or migrate copies of the auth_xxx tables, the code that generates the encrypted passwords use this as the method and key.
Re: [web2py] Re: Why web2py? and not django?
You could definitely use Jinja2 if you so desired, but honestly I do not see any reason why you would, you lose the ability to byte compile your views. (well technically, you would end up having to write your own middleware that would compile the jinja2 templates into bytecode) but then you get away from the whole reason of using web2py in the first place... which is to have all of the tools in one box designed to work together seamlessly. As far as the ORM vs DAL argument is concerned, it really depends on your situation. Firstly, I think the Django ORM sucks... if I were to use a python ORM it will be SQLAlchemy hands down. I think the django admin interface is just some fluff that is used for marketing. I know some people use it in production, but you can create a custom admin interface in web2py faster than you can hack the django admin do what you need it to do. I don't think it is a matter of syntatic sugar... there is a real difference in maintaining 70+ models in web2py vs SQLAlchemy... especially when these models need to be shared between external scripts. And for the situations... If you have alot of complex models that require many to many relationships and lots of joins... use an ORM, it is designed to handle complex relationships between records. If you have a few models, but lots of data that can be used directly... use the DAL, it is memory/cpu efficient. -- Thadeus On Wed, Jan 26, 2011 at 2:05 PM, Albert Abril albert.ab...@gmail.comwrote: Just for embroil more... ...is possible in some way to use django template system, or jinja2 in web2py? On Wed, Jan 26, 2011 at 8:54 PM, cjrh caleb.hatti...@gmail.com wrote: On Jan 26, 8:19 pm, VP vtp2...@gmail.com wrote: To be fair, the most popular option right now is SQLAlchemy, an ORM. DAL appears to be a minority approach. So, ORM must be good at something right? No. The number of people that support a thing has no bearing on that thing's correctness. None whatsoever. Very large numbers of people have supported really bad ideas throughout history, and even still today. Only the merits of the specific case before us matter, not how much support can be found for various options. To get web2py out of the PR's ditch, I think it's best to refrain from commenting on perceived weaknesses of Django and other technologies. Agreed. All we need to do is build great sites. And anyway, I don't see why we need to care about Django *at all*. Or any other framework for that matter. Why care? Focus on the platform available to us, i.e. HTTP (5?), CSS (3?), XML, Python (3?), and build the best web development framework for that. It doesn't hurt to consult the open literature (Django, Flask, Pyramid, Pylons, web.py, etc.), but the existing software is only a landmark on the route, not a stumbling block in the road.
Re: [web2py] Re: Why web2py? and not django?
That is just one of the very small reasons out of the entire haystack the advantages of an ORM are much too numerous to even begin to account I do not think circular references are a bad thing... it is a pointer after all... one thing I miss from C programming is the ability to control pointer vs. copy! SQLAlchemy does an amazing job at state management, and I have yet run into a situation where circular references could even remotely cause issues. It really depends on your application though. Use the right tool for the right job. The DAL has its advantages, the biggest of which is memory consumption and function calls when querying large datasets. An ORM will grow exponentially in memory usage as you add more objects. The DAL keeps a linear memory growth as expected, so when you need lots of data its very efficient and the effects can be noticed even with as few as 5000 records. It also depends on the programmer. I had OOP concepts ingrained from the beginning (Java was my first programming language I learned)... so obviously SQLAlchemy would feel much more natural to me. That said, I actually do use the standalone DAL in some scripts that process data for my app that has 73 models (it used to have 50, but I have been busy the last couple of months). The reason is because for batch processing analytics for some of my tables, the DAL is the right tool for the job, and using an ORM makes the process take about 2-3 hours as opposed to 30-45 minutes. -- Thadeus On Wed, Jan 26, 2011 at 3:40 PM, VP vtp2...@gmail.com wrote: . there is a real difference in maintaining 70+ models in web2py vs SQLAlchemy... especially when these models need to be shared between external scripts. Is this because DAL has not support for circular dependencies and SQLAlchemy does? But seriously, I think an application with 70+ models is entirely in a different class of applications.
Re: [web2py] mysql integration with web2py
Can you share one of the tickets? Another thing, you can add check_reserved to you DAL instantiation to make sure your not using any reserved mysql keywords. -- Thadeus On Thu, Jan 20, 2011 at 7:13 AM, rochacbruno rochacbr...@gmail.com wrote: Can you show the traceback or any other message you are getting? Em 20/01/2011, às 07:31, jgp jgp...@gmail.com escreveu: I have developed a portal in web2py that uses sqlite and now i want to shift the database to mysql. I am trying to integrate mysql with web2py, but i am getting tickets related to inconsistency issues. Please help me in this regard. Thanks in advance JGP
Re: [web2py] Basic Python ignorance? simplejson throwing TypeError(key + repr(key) + is not a string)
Because its using a tuple as a dictionary key. Why not use the file I sent you the other day? -- Thadeus On Mon, Jan 17, 2011 at 1:41 PM, Lorin Rivers lriv...@mosasaur.com wrote: No doubt this is my base Python ignorance being the problem. I've made some progress on my pivot problem, using this recipe http://code.activestate.com/recipes/334695-pivotcrosstabdenormalization-of-a-normalized-list/ (actually, the improved one from the comments). I'm getting what I want now (or close to it): [ { 'FreezeTime': datetime.datetime(2010, 12, 12, 21, 0), ('S',): 643.882600715039, ('S0001',): '', ('S0002',): 621.511925599709}, { 'FreezeTime': datetime.datetime(2010, 12, 12, 22, 0), ('S',): 159.230736027886, ('S0001',): '', ('S0002',): 166.628191452988}, ... ] But when I try to convert it to json using this in my view: var optimizerdata = {{response.write(json(optimizers), escape=False)}}; Where optimizers is a list that looks like this: It throws the error, saying this: TypeError: key ('S0001',) is not a string -- Lorin Rivers Mosasaur: Killer Technical Marketing http://www.mosasaur.com mailto:lriv...@mosasaur.com 512/203.3198 (m)
Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?
I believe this is why web2py receives much criticism. I speak from experience in using (and contributing to) web2py. web2py cannot share objects in an importable namespace with other python applications ecause of its design architecture. This is an absolute requirement for most enterprise or real world applications. Two examples. (however there are many more than I have time to iterate over) Exhibit A: Multiple websites that share some or all database models and utility functions. A public site may use only some of the models needed for say user signup, and a dashboard that may be IP restricted for internal use only. Exhibit B: Must share database models with stand alone python programs. A long running process that sits in the background, but needs access to the database. web2py cannot do either of these, and unless web2py uses import it will never be able to. Currently, to accomplish exhibit A or B, code spaghetti-fication must occur, and maintainance of model definitions in multiple places now becomes a royal pain in the ass. That or you must use some of the other many (unprofessional, hard to maintain) hacks just to work around this limitation. With other frameworks, such as flask/sqlalchemy it is a python program like anything else. You can do from dashboard.models import person. You only maintain one model, but you can use it in all applications that may need it, since you can easy_install your site into a virtualenv. Another issue that I have ran into more often than not is the limitations in the web2py core. Certain things (like SQLForm, auth, sessions, etc) are great for rapid prototyping, but when you actually need to do something real with them, they just get in the way. For example, a form that has a subform or a built in subtable (like a form you might build in Access), or cookie stored sessions for scalability. Again, these are just simple examples when the real world implementation is much more complex. Another problem that the current design of web2py inherently brings is it enforces a functional programming style. You can use classes, but then you end up having to throw pointers around of your basic objects (db, session, etc). Using classes the way they are designed to be used with a normal object lifecycle (imported, instantiated, etc...) is extemely difficult to do in web2py. There is nothing wrong with functional programming, but the code can easily become a mess even if you are a good programmer. Just to give an example of how amazing a class based system is, I re-wrote appadmin for Flask+SQLAlchemy+WTForms in 80 lines of python code, with pagination, searching, creating, updating, and deleting. Think of how maintainable that is. I don't even know what is going on inside of web2pys appadmin... I try to stay away from it *wink*. One of the biggest arguments vs other frameworks is the speed of development time of a web2py app vs other framework. I disagree with this, I am usually able to add new features to my flask apps much faster than I can in web2py. This is probably due to the simplicity of other frameworks and not having to fight with anything being pre-determined for me (such as database tables forced to lowercase). As long as all your doing is building a simple website that will be completely 100% self contained into web2py and it isn't expected to grow over 10K lines of python code, web2py is great. If you are doing something that requires code to be shared, and has lots of complex models and a large codebase that will need to be maintained by other people than yourself in the future... I would pick Flask. I speak most of this from real world experience. I work in both web2py and flask every single day and know the strengths and weaknesses of both. I just wanted to take the time to chime in as to why some feel they way they do with web2py... maybe they just don't know how to explain it, or don't want to take the time to explain it. -- Thadeus On Sat, Jan 8, 2011 at 8:34 AM, Anthony abasta...@gmail.com wrote: On Saturday, January 8, 2011 9:12:55 AM UTC-5, Anthony wrote: +1 On Saturday, January 8, 2011 7:31:38 AM UTC-5, cjrh wrote: On Jan 7, 11:45 pm, Michele Comitini miche...@gmail.com wrote: I think the most misunderstood fact with web2py is that web2py implementation is improving every day, Do you really think the designers of other web frameworks do not understand how web2py works? They definitely understand, and they probably understand better than you or I. The problem is that web2py design is different from their own design. Because we operate in the same space, they try to show why their decisions are better. To be fair, Massimo has been doing exactly the same thing by comparing w2py versus the others for years. Quid pro quo. If we get to say why ours is better, then they get to do likewise. Good point, though it's not exactly the same. Massimo may claim that the web2py way is better (actually, he doesn't really make that
Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?
I think Massimo hit it on the spot. Its about coding style. Most of the people I see giving web2py criticism are young. Considering that beginning in about 2001 colleges starting only teaching java and handing out degrees, it might be safe to assume that most of these guys knew Java as their first language. Not to mention that someone who went to school for 4 years for software engineering will have been uniquely tuned to a specific coding style (object oriented). I like web2py, and I do have uses for it on a daily basis to accomplish real world work. I use web2py alot to provide a web based access to automating statistical analysis. Usually these type of apps need to change often and can even change drastically, which is why I like web2py for them. -- Thadeus On Sun, Jan 9, 2011 at 1:46 PM, VP vtp2...@gmail.com wrote: I think web2py is very good for 'Corporate' and 'Enterprise', but perhaps we need to be less pretentious and change the slogan for something like: web2py - the getting things done web framework I know much less about web2py than most people here, but I feel compelled to add an opinion. There are many different things that are touched upon in this thread. First is the slogan of web2py. I think the word enterprise is a mistake. But at the same time, the attacks that center around this word is very unjustified. For the sake of comparison, let's take a look at the Django's slogan: Webframework for perfectionists with deadlines. Now, you can easily attack this slogan in much the same ways people have attacked Web2py. But most people don't do that. Massimo is not great at PR, so his PR approach is easily prone to attack. But at the same time, a slogan is just a slogan. And yet people unfairly focused on a little slogan repeatedly. That's utterly unfair. Second, let's talk about what it means to be enterprise. I think a many people tend to make this type of reasoning: (1) I am doing real work, (2) this tool isn't quite the best thing for this work, (3) therefore, it is not real (enterprise). I do not agree with this line of reasoning. A tool, any tool, has its limitations and within its boundary of effectiveness it can be as real as any other tool. Drupal, for example, has been used extensively in many big companies to do real things. And yet, Drupal, at its heart, is a CMS, and therefore is not as flexible as something like a webframework. As such the domain of effectiveness of a CMS is smaller than that of a webframework. But when people need to build CMS, Drupal is very effective and *real*. The right word, I think, is generality. A full stack webframework like web2py is more general than a CMS like Drupal. Thus, it can do more things. Something like Flask is not a full-stack framework, as such, it makes fewer assumptions, and it is more general than a full- stack framework. At the same time, it doesn't have as much batteries. And many will find a full-stack framework more useful in that regards. So to say that because you can not import pieces of a model into an app, therefore web2py is inappropriate for enterprise, is not right. I think many enterprise apps do not have to have highly connected models. There are many other dimensions that are important with respect to what it means to be enterprise, such as scalability, maintainability, etc. And I think that web2py still needs to be proven in this regards. And third, there's a criticism that the internals of web2py is a mess. That might or might not be true. There are a few things I'd like to say in this regards. First, from a user's point of view, this criticism is not very interesting. But this criticism implies indirectly a few things, such as there are many bugs; or it's not easy to add features to web2py. From an outsider's point of view, this is what I see. In terms of man power, web2py has fewer than Django. I think Flask also has a decent number of developers working on it. Web2py has mainly Massimo, who wears many hats; plus maybe 2, 3 other people putting a lot of time into it. And yet, you look at features, there's not much Django has that Web2py doesn't have. Another thing that adding features to Web2py is quite quick. This is what I often see around here. When someone has an idea, Massimo often does it right away. Recently, it took a relatively quick effort for Massimo (and probably a handful of other people) to rewrite DAL completely. Now, going back to the criticism that Web2py's internal is real bad. I am very reluctant to believe that is the case, given all of these I have seen and experienced around here. Having said this, I don't think I am a web2py zealous fan. Trust me, if there are better frameworks, I'd jump in a second. I have perused the Flask/Bottle/Django documentations countless of times, and each time, I just decided they do not yet have what I want. Further, there are a few
Re: [web2py] Re: Can any help me with new dal in trunk?
All I know is that tables are issued as lowercase, but you can still access your table as an uppercase attribute. There is an inconsistency in the DAL somewhere because of this... Somewhere it is forgetting to convert to lower case. I don't know why converting table names to lower case is forced in web2py and I disagree with it. for example: db = DAL() db.define_table('TableA', Field('Superman')) # CREATE TABLE tablea WITH FIELDS superman db(db.TableA.Superman == clark).select().first().Superman # SELECT * FROM tablea WHERE superman=clark -- Thadeus On Sat, Jan 8, 2011 at 1:17 AM, mart msenecal...@gmail.com wrote: really? I didn't know, thanks for pointing that out... just out of curiosity in in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'tecnogradua' don't the attribute lookups get done by python ultimately? Just trying to understand... how could this have worked if doing x.__getitem__ ? Even if dal does a string.lower() or something, once the table is named and created, would something (outside of migrate) not catch that error and set off the alarm even before any change need to happen? Thanks, Mart :) On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote: I can also confirm this is a bug with the new DAL. It is only caused when using upper case characters in the table or field names. It seems that web2py converts all of the tablenames to lower case when issuing the SQL (so your actual tables are lower regardless of what you specify in the python). There is something in the migrations that cause this to come up, because it will work just fine one run and crash on another run after changing some unrelated tables. I don't think the DAL should force the tables to lowercase. -- Thadeus On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote: no, this is python... not sure how it could have worked before, but the key (technogradua) in .keys() is not being picked up... dal is simply pointing that out with the exception being thrown. I did notice when I made the switch that a few more of my mistakes got picked up (or it could be that I forgot that I changed something), but regardless... since switching to the latest DAL release and fixing my mistakes that it quickly picked up, I have had no problems (except those that I cause). I would simply take those exceptions for cash, change the case and enjoy one less exception ;) Mart :) On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote: Ok, I understand your point. But this is a issue of DAL or what? because I only update web2py to trunk version On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote: Probably just being unhappy with the case :) tecnoGradua != tecnogradua Mart :) Field(tecnoGradua, 'string', On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote: Hi, this code works with web2py 1.89.5 with mysql but with web2py in trunk and mysql it dosent works. db.define_table(lentes, audit, Field(tecnoGradua, 'string', requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num. de Graduaciones), Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA 1.50','HIGH INDEX','THIN LITE 1.67 ASFÉRICA','POLICARBONATO','CRISTAL'])), Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))), Field(tecnoVisual, 'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label= Tecnologia de Visualización), Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))), Field('limitup','double', writable=False, readable=False), Field('limitdown','double', writable=False, readable=False), Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero positivo entre 0 y 1')], label='Precio de Promoción'), Field(precio, double, writable=False, readable=False), Field(costo, double, writable=False, readable=False), Field(observaciones,text, writable=False, readable=False)) This is the traceback Traceback (most recent call last): File /home/drayco/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/drayco/web2py/applications/movil/models/db.py, line 272, in module Field(observaciones,text, writable=False, readable=False)) File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table polymodel=polymodel) File /home/drayco
Re: [web2py] Re: Can any help me with new dal in trunk?
I can also confirm this is a bug with the new DAL. It is only caused when using upper case characters in the table or field names. It seems that web2py converts all of the tablenames to lower case when issuing the SQL (so your actual tables are lower regardless of what you specify in the python). There is something in the migrations that cause this to come up, because it will work just fine one run and crash on another run after changing some unrelated tables. I don't think the DAL should force the tables to lowercase. -- Thadeus On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote: no, this is python... not sure how it could have worked before, but the key (technogradua) in .keys() is not being picked up... dal is simply pointing that out with the exception being thrown. I did notice when I made the switch that a few more of my mistakes got picked up (or it could be that I forgot that I changed something), but regardless... since switching to the latest DAL release and fixing my mistakes that it quickly picked up, I have had no problems (except those that I cause). I would simply take those exceptions for cash, change the case and enjoy one less exception ;) Mart :) On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote: Ok, I understand your point. But this is a issue of DAL or what? because I only update web2py to trunk version On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote: Probably just being unhappy with the case :) tecnoGradua != tecnogradua Mart :) Field(tecnoGradua, 'string', On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote: Hi, this code works with web2py 1.89.5 with mysql but with web2py in trunk and mysql it dosent works. db.define_table(lentes, audit, Field(tecnoGradua, 'string', requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num. de Graduaciones), Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA 1.50','HIGH INDEX','THIN LITE 1.67 ASFÉRICA','POLICARBONATO','CRISTAL'])), Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))), Field(tecnoVisual, 'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label= Tecnologia de Visualización), Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))), Field('limitup','double', writable=False, readable=False), Field('limitdown','double', writable=False, readable=False), Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero positivo entre 0 y 1')], label='Precio de Promoción'), Field(precio, double, writable=False, readable=False), Field(costo, double, writable=False, readable=False), Field(observaciones,text, writable=False, readable=False)) This is the traceback Traceback (most recent call last): File /home/drayco/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/drayco/web2py/applications/movil/models/db.py, line 272, in module Field(observaciones,text, writable=False, readable=False)) File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table polymodel=polymodel) File /home/drayco/web2py/gluon/dal.py, line 551, in create_table fake_migrate=fake_migrate) File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table and not isinstance(table[key].type, SQLCustomType) \ File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'tecnogradua' Can I need to change something?
Re: [web2py] eclipse: getting it to ignore db
Add to your list... if 0: from gluon.dal import DAL db = DAL() -- Thadeus On Thu, Dec 30, 2010 at 4:46 AM, weheh richard_gor...@verizon.net wrote: I'm trying to get eclipse to ignore undefined var: db using the if 0: import gluon from ... import ... trick, but I'm not sure where db is coming from?
Re: [web2py] Re: The stability of web2py releases
Also an issue when only one person has access to said clones. -- Thadeus On Mon, Dec 27, 2010 at 11:04 AM, mdipierro mdipie...@cs.depaul.edu wrote: Yarko created it and used to maintain it. That is is the problem with having too many clones in different places. Venetually they get out of sync. Massimo On Dec 27, 9:50 am, Bruno Rocha rochacbr...@gmail.com wrote: Is there a web2py clone in bitbucket (updated 16 months ago) https://bitbucket.org/mdipierro/web2py/overview https://bitbucket.org/mdipierro/web2py/overviewJust needs to update this repository 2010/12/27 R. Strusberg strusb...@gmail.com +1 2010/12/24 ron_m ron.mco...@gmail.com: I for one am happy with the current release cycle. It is a good balance between new features and the ultimate stability of release 1.XX.N where N is the last version before XX+1 for example. The nightly build is a bit of a misnomer, many projects (C or C++ mostly) have some automated process that takes trunk and compiles it to produce a .tar.gz labelled nightly which might work. For web2py we should just hg pull; hg update to achieve that result. The nightly for web2py is more like a beta because Massimo hand picks code from trunk that will or will not be in the nightly which could really be a weekly. I am currently developing the application I am working on and testing is easy enough that I test trunk at least daily. The web2py server is quite easy to use but the code in some places is complicated and has many possible use cases. It is only through exposure out to the user base that a large number of use cases of the code get tested. I have even seen problems reported where something was fixed but used by maybe one person in a way that should not have worked resulting in the dreaded bug that worked and became a useful feature for someone. Once I go to production I will probably move the releases a lot slower through the installed base. In fact I have 2 beta production systems up now and only push a new web2py when I push a new version of the application to the stakeholders to look at. Massimo provides a fantastic service with the web2py project and I would not like to see him stifled by a load of process. Anyone that has time to test will definitely help the quality, if you don't have time, that is okay too. I personally don't mind doing some release management between where Massimo is burning the midnight oil and what I let out into the production systems I have/will manage. The product is alive with new features and bug fixes sometimes occur in minutes once reported. That is worth a lot. Ron -- Bruno Rochahttp://about.me/rochacbruno/bio
Re: [web2py] Re: Help with function call
Make a controller named system or global? -- Thadeus On Sun, Dec 26, 2010 at 2:29 PM, weheh richard_gor...@verizon.net wrote: Of course, the other problem with using modules is that, especially with components, I really need to get to the global variable space. Yes, I can always pass global() and db to the module, but within the module, it makes the code bloat up a bit with constantly having to do global['session'].xyz and global['request'].args and such, which is an added pain.
Re: [web2py] memory leak - model remains in memory after requests
This is due to the built in rocket server (it is not ment for production). If you use Apache with mod_wsgi this will not happen. -- Thadeus 2010/12/24 David Zejda d...@atlas.cz -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My web2py instance gradually eats memory, during day the consumption grows up to several gigs, so I have to restart often. According to guppy most of memory is occupied by gluon.dal.Field and other classes of dal: Partition of a set of 3231760 objects. Total size = 443724152 bytes. Index Count % Size % Cumulative % Kind 0 113419 4 189636568 43 189636568 43 dict of gluon.dal.Field 1 1324208 41 80561096 18 270197664 61 str 2 328642 10 15982732 4 286180396 64 tuple 3 26637 1 13851240 3 300031636 68 dict of gluon.validators.IS_IN_DB 4 98796 3 13436256 3 313467892 71 dict of gluon.dal.Set 5 20042 1 13344464 3 326812356 74 dict (no owner) 6 8199 0 11860464 3 338672820 76 gluon.dal.Row 7 16615 1 11482224 3 350155044 79 gluon.dal.Table 8 63682 2 8660752 2 358815796 81 dict of gluon.dal.Query 9 137779 4 7363776 2 366179572 83 list 2282 more rows. Type e.g. '_.more' to view. The proportion is relatively stable. It seems that model definition remains in memory after each request. It is probably caused by a weird reference, but I'm not sure how to track it. Please do you have any ideas? Thanks :) David -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA =9cqX -END PGP SIGNATURE-
Re: [web2py] Re: please explain this
Escape will convert the text to html entities. For example, x = A 'quote' is bbold/b print response.write(x, escape=True) A 'quote' is lt;bgt;boldlt;/bgt; This protects your page from html injection hacks. If you need to display html from a variable and you know absolutely sure that it is safe, use {{=XML(x)}} Which also provides some helper methods to allow you to select safe tags without allowing everything. -- Thadeus On Fri, Dec 24, 2010 at 11:39 PM, Sahil Arora sahilarora...@gmail.comwrote: I am asking what does escape=true does On Sat, Dec 25, 2010 at 11:02 AM, mdipierro mdipie...@cs.depaul.eduwrote: {{=x}} is equivalent to {{response.write(x,escape=True)}} Did I answer the question? On Dec 24, 10:04 pm, Sahil Arora sahilarora...@gmail.com wrote: what do you mean by word 'escape' when we say escape = False or in {{=x}} Variables injected into the HTML in this way are escaped by default. The escaping is ignored if x is an XML object, even if escape is set to True. -- Sahil Arora B.Tech 2nd year Computer Science and Engineering IIT Delhi Contact No: +91 9871491046 -- Sahil Arora B.Tech 2nd year Computer Science and Engineering IIT Delhi Contact No: +91 9871491046
Re: [web2py] export_to_csv_file and colnames
that would be a bug for sure :p -- Thadeus On Thu, Dec 23, 2010 at 6:59 AM, howesc how...@umich.edu wrote: Massimo and crew, I am trying to use export_to_csv_file() on a rows object with the colnames parameter on google app engine. it turns out that the method (in both sql.py and the new dal.py) outputs the proper column names, but then outputs data for every column in the table. the culprit is on line 4741 of dal.py (from trunk): for col in self.colnames: should be for col in colnames: and then, so long as the user's colnames are in the format 'table_name.field_name' it works as desired (at least from my perspective). does this sounds correct? if so, do you mind adding it to trunk? thanks! christian
Re: [web2py] Re: The stability of web2py releases
Seriously: no. I have way to many new features to add to the site and too little time to worry about testing each time I upgrade. -- Thadeus On Thu, Dec 23, 2010 at 3:16 PM, Jonathan Lundell jlund...@pobox.comwrote: On Dec 23, 2010, at 1:11 PM, Branko Vukelić wrote: On Thu, Dec 23, 2010 at 6:19 PM, Jonathan Lundell jlund...@pobox.com wrote: Seriously: no. Seriously: yes. Why? Because it's YOUR work that is going to suffer if you don't. Why WOULDN'T you test something you are going to deploy? I've just tested dozen frameworks and even PHP before starting a project, and I'm a hobbyist. Are you telling me professional developers aren't expected to make an informed choice about their platform? If that's the case, professional developers are people I would NEVER trust to do their job right. Because I'm not deploying it (the current version, that is). For the same reason we don't tell users that they *must* use Python 2.7.1, and re-test their 2.4-based code for compatibility: it works. Not me personally; I use the latest versions of stuff, pretty much. But I understand the reason for not wanting to, or at least not wanting to have to. That is, if I'm using a release from six months ago, and all I need is a point fix, Then you can dig around the commits and make yourself a patch. At least that's what I'd do. It's what I'd do too. But it makes web2py less friendly than it could be.
Re: [web2py] Re: The stability of web2py releases
Kinda of joking, but also kinda serious. It cost time and money to have to test something just because a decision was made to upgrade the library (in this case, web2py). -- Thadeus 2010/12/23 Branko Vukelić stu...@brankovukelic.com On Thu, Dec 23, 2010 at 10:29 PM, Thadeus Burgess thade...@thadeusb.com wrote: Seriously: no. I have way to many new features to add to the site and too little time to worry about testing each time I upgrade. I really hope you're just joking, and I'm just too stupid to get the funny part. :P -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
Re: [web2py] Re: The stability of web2py releases
Good. Now this thread can go into the list of many archived threads about this topic. Nothing will happen and things will continue as they have been, which isn't so bad because nobody is forcing you to upgrade your web2py version each time a new release comes out. However, Branko, part of the problem that nobody else can even perform basic release management. Nobody but Massimo has access to trunk, and therefore nobody but Massimo can make releases, create branches, maintain stable etc. This leaves the project in a odd state that the only thing that can be done is to complain. Its free software, if you don't like it, fork it and manage it yourself. -- Thadeus 2010/12/23 Branko Vukelić stu...@brankovukelic.com On Thu, Dec 23, 2010 at 11:21 PM, Jonathan Lundell jlund...@pobox.com wrote: I suspect that we're talking at cross purposes. I have nothing more to say in this ridiculous thread. -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
Re: [web2py] Re: The stability of web2py releases
Funny, Every three to four weeks this topic of discussion comes up. Lots of the same ideas are said over and over again. Nobody has time to work on certain things like this since most of us have full time jobs that may or may not be related to web2py. What I do is if my app works with a certain version, I don't ever upgrade the web2py unless I need a brand new feature or bugfix that effects me. This has been my adaptation to the fast development cycle. Think of web2py as the gentoo of python web frameworks... its *very* fast and efficient and you get lots of new stuff often, but expect updates to break. -- Thadeus 2010/12/22 Branko Vukelić stu...@brankovukelic.com 2010/12/22 Luis Díaz diazluis2...@gmail.com: in particular whenever new versions come out ... I always say ... have to wait 1 week or 2 to becomestable ... Not become stable, but be proven stable. You release, wait for everyone to give it a go. If everyone is happy, then it's considered stable, and move to stable box on the downloads page. If someone complains, it stays in unstable indefinitely, and a new release is made fixing the bugs. -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
Re: [web2py] Re: The stability of web2py releases
The latter. No time to test aside from upgrading in production. No time to develop a test application which can handle all of web2py features (including all DAL databases) No time to set up and maintain a server just for said tests. -- Thadeus 2010/12/22 Branko Vukelić stu...@brankovukelic.com On Wed, Dec 22, 2010 at 5:05 PM, Thadeus Burgess thade...@thadeusb.com wrote: Nobody has time to work on certain things like this since most of us have full time jobs that may or may not be related to web2py. What do you mean? No time to develop a system of labeling releases or no time to upgrade, test, etc? -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
Re: [web2py] Re: web2py.com is down
http://wasitup.com/ -- Thadeus On Tue, Dec 21, 2010 at 10:22 AM, Bruno Rocha rochacbr...@gmail.com wrote: Yep, same here. Nor .com or .org something happen on the server. may be we need an HA mirror.the examples app running on GAE could be a second choice when main server goes down. (http://web2pysite.appspot.com/examples/default/index) if there is a way to keep it updated and a default route when server time outs. 2010/12/21 DenesL denes1...@yahoo.ca Same here. On Dec 21, 11:14 am, weheh richard_gor...@verizon.net wrote: tried accessing it right now but no response -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] request for error log to default to list by ticket
I think it depends on what mode. In production, I want to view by exception In development, by ticket would be more appropriate. -- Thadeus On Sat, Dec 18, 2010 at 5:11 PM, Kuba Kucharski kuba.kuchar...@gmail.comwrote: +1
[web2py] Quick cron question
Do the models get executed before or after hard-cron process is started? And are those models available to the scope of the cron application. In my example cron would be executing a long-running controller function. -- Thadeus
Re: [web2py] Re: it case you missed it...
An excerpt: I think this sums it up. --- GPL is a tool that uses copyright to enforce software freedom, but… in order to be able to enforce that there must be a copyright holder that can take action. The FSF is aware of this and is carefully requiring contributors and their employers (!) to sign legal papers of copyright transfer: http://www.fsf.org/licensing/licenses/why-assign.html The problem is that most GPL projects can not afford to force potential contributors to get their employers to sign legal papers as it will reduce the number of contributions to 0 and therefore the copyright to their projects is either dispersed among the different contributors or even worse, is questionably held by a single person or entity (with emphasis on questionably). - Thadeus On Wed, Dec 15, 2010 at 1:21 PM, VP vtp2...@gmail.com wrote: I do not think that GPL is the determining factor of why Django or Rails are popular. It is not clear that GPL scares off potential users. I will go out on the limp to say that most potential users of web2py will be in the capacity of app developers, not framework developers. They might be scared if they don't understand it as intended, which is why some said it needs to be clarified. Once the licensing is clear, they have nothing to be scared about. As for framework developers, sure GPL is not permissive for commercial intentions. So, if you want to branch of web2py, customizing the framework, possibly improving it, and want to close source, then no you can't do that with GPL. But those cases are few, and arguably not what most potential users care about. On Dec 15, 1:07 pm, pbreit pbreitenb...@gmail.com wrote: It's not worthwhile fiddling around with the exception since the GPL stigma will remain. It's clear that GPL scares off potential users. I come from a background of relentlessly lowering barriers to adoption. I would very much like to see Web2py usage go way up.
Re: [web2py] Re: Simple debugger
The problem with web2py is the built in internal server. Since it executes itself on a completely separate thread, there is no way (that I know currently) to connect a debugger to it. I have ran into this problem with all of the python frameworks I have tried (Django, Flask, Pylons, web2py) all suffer from not being able to step through your code in a debugger. -- Thadeus On Tue, Dec 14, 2010 at 1:21 PM, Lorin Rivers lriv...@mosasaur.com wrote: I couldn't get NetBeans to debug my web2py code. On a Mac. Eclipse was a challenge to get set up and in one case, where I had some oddly broken code, the breakpoints didn't work how I expected them to. I had to step into EVERYTHING, down into the bowels of web2py, which was a real pain. I expect that if I have a BP at the beginning of a function and another inside that function that I should be able to resume and have it break again at the second BP, but that was not reliable for me. Very frustrating. I'm going to try ipdb. On Dec 13, 2010, at 23:32 , weheh wrote: I want to go to Eclipse but didn't succeed in getting it to install run the first time through. On Dec 14, 12:13 am, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Dec 14, 2010 at 5:45 AM, Bruno Rocha rochacbr...@gmail.com wrote: Someone else has any debug tip or advice for sharing? I used this:http://pypi.python.org/pypi/ipdb All the IPython goodness + pdb-style debugging. You get auto-complete and command history, too. ;) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group -- Lorin Rivers Mosasaur: Killer Technical Marketing http://www.mosasaur.com mailto:lriv...@mosasaur.com 512/203.3198 (m)
Re: [web2py] Posgresql-query - DAL
db(db.gr02.service_provider.belongs([7,10])).select() -- Thadeus On Tue, Dec 14, 2010 at 2:38 PM, Johann Spies johann.sp...@gmail.comwrote: The postgresql equivalent is: select * from gr02 where service_provider in (7, 10) I have tried: isps = (7,10) tb = 'gr02' data = db('%s.service_provider in (%s)' % (tb,isps)).select() Traceback (most recent call last): File console, line 1, in module File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3295, in select rows = response(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 3290, in response db._execute(query) File /Users/js/Programmeer/zenex/web2py/gluon/sql.py, line 1035, in lambda self._execute = lambda *a, **b: self._cursor.execute(*a, **b) ProgrammingError: arguments of row IN must all be row expressions LINE 1: updated_by FROM gr02 WHERE gr02.service_provider in ((7, 10... ^ So how do I do it in DAL? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: reserved words in databases
Are you using the reserved_keywords check built into the DAL? -- Thadeus On Sun, Dec 12, 2010 at 2:50 PM, Carlos carlosgali...@gmail.com wrote: Hi Massimo, Thanks for clarifying this. Carlos On Dec 11, 7:41 pm, mdipierro mdipie...@cs.depaul.edu wrote: No. Right now there may problems if you used a reserved keyword. On Dec 11, 6:57 pm, Carlos carlosgali...@gmail.com wrote: Hi, With respect to the following old thread: http://groups.google.com/group/web2py/browse_thread/thread/6a0948e7bf. .. Is web2py now ready to use reserved words as table and field names (e.g. user, group) without any conflicts with any of the supported databases?. Or what should be done in order to be portable across multiple databases?. Thanks, Carlos
Re: [web2py] grid
I really enjoy working with DataTables. It is easy to use and extremely configurable! Not only that, but it can load results from any JSON request, so you can handle filtering, ordering, and pagination in your queries on the server. -- Thadeus On Fri, Dec 10, 2010 at 9:43 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Here other links fruit of my search for a fixed header and left column jQuery plugin : http://cross-browser.com/x/lib/view.php?s=xlibrary http://cross-browser.com/x/lib/view.php?s=xlibraryOther library like jQuery (as far as I understand) seems very rich GPL http://johnsobrepena.blogspot.com/search/label/CoolGridView An other grid Thread on stackoverflow http://stackoverflow.com/questions/673153/html-table-with-fixed-headers http://plugins.jquery.com/project/sfht Chromatable easy to integrate in web2py, nice css, good for table that fit in page width, fixed header http://code.google.com/p/js-scroll-table-header/ http://jeromebulanadi.wordpress.com/2010/03/22/scrollable-fixed-header-table-a-jquery-plugin/ Seems really interresting demo : http://jeromebulanadi.oni.cc/scrollablefixedheader.html http://tablesorter.com/docs/ Richard On Fri, Dec 10, 2010 at 12:37 AM, Bruno Rocha rochacbr...@gmail.comwrote: Forget about what I said, DataTables is the best one so far! http://www.datatables.net/examples/server_side/server_side.html I am having a good time with this one, all features in one table plugin. This is already in /plugins http://web2py.com/plugins/default/datatable, but need more documentation, recipes, helpers and more attention. -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: More than one model/controller file for plugins.
It will work within a subfolder (I have done it) unless things have changed it will work just fine (and still execute in alphabhetical order) 1 a_settings.py b(folder) - 2 - a.py 3 - c.py 4 - d.py 5 c.py It should execute correctly in the above order -- Thadeus On Fri, Dec 10, 2010 at 6:06 PM, mdipierro mdipie...@cs.depaul.edu wrote: No. Sorry. The problem is that the more complex we make this the slower it gets. On Dec 10, 6:03 pm, Bruno Rocha rochacbr...@gmail.com wrote: Hi, regarding the creation of plugins, can I have more than one file in /models or /controllers for each plugin? I tried: /models/ plugin_datatable.py plugin_datatable.secondmodel.py plugin_datatable.thirdmodel.py Also in /controllers But web2py does not execute the files named in this way plugin_name.anothername.py, and when packing a plugin these files are not included in plugin. can I have a folder inside /models or /controllers ? /models/db.py /models/plugin_datatable/plugindb.py or another way to have more files by plugin? Thank you. -- Bruno Rochahttp://about.me/rochacbruno/bio
Re: [web2py] Re: how to generate database dumps with DAL
db.export_to_csv_file will only contain the raw data, it will not include any of the database specific things (such as indexies, mysql/postgres users, stored procedures, sequence stores, etc...) -- Thadeus On Fri, Dec 10, 2010 at 5:24 PM, mdipierro mdipie...@cs.depaul.edu wrote: if you do db.export_to_csv_file(open('myfile.csv','wb')) you get a csv dump of the db and you do db.import_from_csv_file(open('myfile.csv','rb')) you get a restore. The myfile.csv is a csv file and it is not specific of one db engine. Massimo On Dec 10, 4:38 pm, Richard richar...@gmail.com wrote: I have a CSV file and want to generate dumps of the data for sqlite, mysql, postgres, etc. My current workflow is to insert the data in each database and then use mysqldump, etc to generate the dump files. I read that the DAL is now a standalone module - great! Is it possible to use the DAL to purely generate the required SQL for a database without actually inserting or even installing the database?
Re: [web2py] Re: More than one model/controller file for plugins.
Just make sure to include an '__init__.py' in your plugin_datatable folder Then you can have file named whatever you want and import as /modules/plugin_datatable/ __init__.py util.py grid.py namespace = local_import('plugin_datatable.grid') newgrid = namespace.Grid() -- Thadeus On Fri, Dec 10, 2010 at 7:12 PM, Bruno Rocha rochacbr...@gmail.com wrote: Sorry, the correct is: /modules/plugin_datatable/ plugin_datatablex.py plugin_datatabley.py ... then I will import this modules at /models/plugin_datatable.py local_import http://web2py.com/book/default/docstring/local_import('plugin_datatable/plugin_datatablex') *will this work?* 2010/12/10 Bruno Rocha rochacbr...@gmail.com No Problem. I'll put aditional functions in /modules/plugin_datatablex.py plugin_datatabley.py etc.. and them import this at my model in models/plugin_datatable.py ok? 2010/12/10 mdipierro mdipie...@cs.depaul.edu I am not sure this is intended. This may create problems for compilation. Moreover I was planning to reserve this syntax (subfolder in models) for models that should be executed conditionally. If it works good but do not rely on it. Massimo On Dec 10, 6:21 pm, Thadeus Burgess thade...@thadeusb.com wrote: It will work within a subfolder (I have done it) unless things have changed it will work just fine (and still execute in alphabhetical order) 1 a_settings.py b(folder) - 2 - a.py 3 - c.py 4 - d.py 5 c.py It should execute correctly in the above order -- Thadeus On Fri, Dec 10, 2010 at 6:06 PM, mdipierro mdipie...@cs.depaul.edu wrote: No. Sorry. The problem is that the more complex we make this the slower it gets. On Dec 10, 6:03 pm, Bruno Rocha rochacbr...@gmail.com wrote: Hi, regarding the creation of plugins, can I have more than one file in /models or /controllers for each plugin? I tried: /models/ plugin_datatable.py plugin_datatable.secondmodel.py plugin_datatable.thirdmodel.py Also in /controllers But web2py does not execute the files named in this way plugin_name.anothername.py, and when packing a plugin these files are not included in plugin. can I have a folder inside /models or /controllers ? /models/db.py /models/plugin_datatable/plugindb.py or another way to have more files by plugin? Thank you. -- Bruno Rochahttp://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: Scalability of web2py?
All of the problems I had with web2py were because of the sessions. Even storing the sessions in db caused web2py to crash. Never really found a solution, there is something to the fact of having to pickle/unpickle the session that can't handle major loads. -- Thadeus On Wed, Dec 1, 2010 at 10:57 AM, mdipierro mdipie...@cs.depaul.edu wrote: We should have a mechanism for storing sessions clientside but this is a speed issue not a scalability issues. Storing sessions in encrypted cookies makes a each request 1-2ms faster by trading bandhwidth (required to communicate the session in cookie) with file IO (required to locate and access the session in a file). Scalability-wise sessions in files do not present a problem as long as one uses a load balancer with support with sticky sessions. On common problem arises when there are too many session files in the same folder (the os becomes slow accessing the folder). This problem has been solved in trunk last week by creating a sub-folder tree structure for the session folder. Session in files some advantages of sessions in cookies: they can contain more data. They can be controller server-side (checked, deleted, modified). They can be locked to force per-user serialization of form processing(default in web2py). Bottom line: current sessions are not a scalability issue but it would be nice to have the option of sessions in signed cookies. It is not difficult to do and we have it by the end of the year. This will be a major speed up for system that do not have a filesystem and currently require storing sessions on datastore, like on GAE. Massimo On Dec 1, 10:31 am, VP vtp2...@gmail.com wrote: This is an example -- I think -- where web2py still needs to be proven in terms of scalability. Yes, sessions can be stored in database, turned off in specific functions, and regularly deleted. But I still think that there should be a better systematic way of handling sessions in heavy applications. I think the current set up is not effective when you have large volume of users, which suddenly builds up many sessions. Small things like this don't matter much until things get large scaled. === To take web2py to the next level, I think Massimo might need to lay out milestones or visions to be achieved in future releases of web2py. On Nov 30, 6:07 pm, Stef Mientki stef.mien...@gmail.com wrote: On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not competitors. They are different ball games. When things scale large, everything is important. A small design issue might be magnified. I don't think web2py is proven yet, in terms of scalability. What web2py needs is at least one real example to show that it is scalable and what are the limits at the extreme. I'm not sure were session files are used for, but isn't file access much slower than database access ? Can session files be turned of ? cheers, Stef
Re: [web2py] Re: Scalability of web2py?
Would that be the decision of the webserver? gevent uses a event-per-request and it is written completely in python. -- Thadeus On Wed, Dec 1, 2010 at 11:45 AM, John Heenan johnmhee...@gmail.com wrote: The elephant in the room has not gone away Massimo. Web2py is great for small projects. DotNet is great for small and large projects. The elephant in the room is not only the untested scalibility of web2py but also the amount of resources that neeeds to be thrown at web2py compared to DotNet and other frameworks as scale increases. One of the glaring defciences in web frameworks that use Python is the glaring engineering weakness of using thread per request web serving instead of using event per request web serving. I think I have pointed this out a number of times on this fourm, but it just does not sink in. I even pointed out how Linux loast a PR war over this issue. There is no need for Python based web frameworks to use thread per request web serving. John Heenan On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote: You achieve scalability by replicating the web server behind a load balancer. This is documented in the book, chapter 11, using HAProxy. All frameworks work the same way in this respect. web2py has no intrinsic limitations. The bottle neck is the database connection. All frameworks have the same problem. You can replicate the database too and web2py supports multiple database clients with Round-Robin. On a small VPS, web2py in average, should execute one page in 20ms. Depending on how many requests/second you need you can determine how many servers you need. web2py apps run on Google App Engine and that means arbitrary scalability as long as you can live with the constraints imposed by the Google datastore (these limitations will go away as soon as Google releases MySQL in the cloud, which they announced some time ago). Please ask the consultant: which .NET feature makes it scale any better than web2py or Rails? If he explains we can address it more specifically. Massimo On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote: The project I'm working on has hired a consultant who is now recommending .Net in place of web2py or even rails. What's the 'largest' scale web2py is known to perform well on? -- Lorin Rivers Mosasaur: Killer Technical Marketing http://www.mosasaur.com mailto:lriv...@mosasaur.com 512/203.3198 (m)
Re: [web2py] Table names: plural or singular?
I prefer singular for the Object models and plural for the tablenames. class Person: __tablename__ = 'people' Since the table contains many of the records, but an object instance will only contain one of those rows. -- Thadeus On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural. +1 for plural, just to make the discussion more interesting. :) Anyway, the reason for plurals is: it's a table, so it contains many records for something. Reason for singular is: ... it looks better in the API. singular in an API example: get.people.last() vs Get last person get.person.last() vs Get last person (more similar?) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Re: How could I send a email to every members?
the problem with mail.send is it creates a brand new connection to the SMTP server *every* single time you call it. If you are sending more than 10 emails at a time this will not be efficient and will take an unnecessary amount of time to complete. I would suggest dropping down to using base smtplib so you can send everything through a single connection. Keep in mind when doing this certain SMTP servers have limits on how many emails can be sent (500 by default) so you would need to re-establish your connection after this cutoff point. -- Thadeus On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote: Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.
Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?
A good advise, but, not always possible. I am considering to migrate an App in the range of 70-100 tables to web2py and there are tables that are like pillars, belong to several groups (customers, employees, projects,...) How we could manage this shared tables? Also sometimes its hard to determine an order for the tables to avoid referencing a still undefined table. There is another type of large applications, enterprise level with hundreds or thousands of tables. The approach of multiples apps sharing same database is useful, but how could we solve the division of tables in apps, is it better to define the model in one place and import the required tables on the apps? This is why I prefer Flask + SQLAlchemy. -- Thadeus 2010/11/14 José Ignacio Hurtado jose.i.hurt...@gmail.com A good advise, but, not always possible. I am considering to migrate an App in the range of 70-100 tables to web2py and there are tables that are like pillars, belong to several groups (customers, employees, projects,...) How we could manage this shared tables? Also sometimes its hard to determine an order for the tables to avoid referencing a still undefined table. There is another type of large applications, enterprise level with hundreds or thousands of tables. The approach of multiples apps sharing same database is useful, but how could we solve the division of tables in apps, is it better to define the model in one place and import the required tables on the apps? Jose. 2010/11/14 mdipierro mdipie...@cs.depaul.edu I agree that there are things we can improve in web2py. Yet, if a complex application have many pieces that are untangled, the import mechanism does not necessarily help you. The solution is trying to design components that are relatively independent. If you can do this, web2py does not bet in the way. For example, you have 100 tables functionally grouped in ~10 and all they need to share is authentication, you may want to separate the functions in 10 different web2py applications (all sharing one database, each defining only the tables it needs, and sharing one session cookie). This modular design solves lots of problems. I have heard of people who have developed complex applications in Django (which uses the import you suggest) and run into problems because they were using more ram than needed since all modules were always imported. In web2py controllers are executed only when called and if you make many small controllers you save lots of memory. Controllers than then import the modules they need and only those. Massimo On Nov 13, 7:28 pm, Thadeus Burgess thade...@thadeusb.com wrote: The biggest contributing factor is that web2py is executed and not import. The coder must always be sure to align objects and database in the correct order, including any auxiliary functions, class mappings, queries. He/she has to worry about the order of everything. Sometimes you can't have such order for complex systems. I think an import based system solves this in that the import statements declare the order instead of the physical location of the code doing that. -- Thadeus On Sat, Nov 13, 2010 at 2:49 PM, Jason Brower encomp...@gmail.com wrote: These are encouraging. In large deployment I mean it in the most external sense of it. Facebook is big, myspace is big, those kinds of object were what I was aiming for. And with Massimo's comment about the database size. I think your right, the framework does become less relavent. In what ways in a large codebase making web2py code messier and is there a solution to it in another framework? BR, J On Sat, 2010-11-13 at 11:48 -0600, Thadeus Burgess wrote: What is large deployment? Is it a large codebase that you must manage for an internal dashbaord, or just alot of users/database io that needs to scale out for worldwide access? If its the first case, web2py can get really complicated in dealing with lots of models and difficult to manage in an efficient manner. The larger your codebase the messier web2py apps will become. In the end, this would ultimately be up to the preferences of you and your team and what your willing to put up with. In the second case, framework hardly matters at that point. Disqus uses django, facebook uses php, reddit uses pylons, myspace uses coldfusion, microsoft uses asp, oracle uses java. Its always the database that becomes an issue regardless of programming language or web framework. -- Thadeus On Sat, Nov 13, 2010 at 10:53 AM, mdipierro mdipie...@cs.depaul.edu wrote: I agree with Villas. The larger the development the more the database becomes the bottleneck and the framework irrelevant. Massimo On Nov 13, 8:35 am, villas villa...@gmail.com wrote: Hi Jason I guess you have to define 'large deployment' first of all. Number of records and size
Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?
Doesn't work with code completion, and will be a maintenance nightmare! I spent weeks trying different code organisation patterns with web2py including what you mentioned, everything I attempted just caused more problems and made the code less maintainable. Like I keep saying, it all comes down to programmers preference. I started programming with Java, therefore I like object oriented programming that Flask+SQLAlchemy uses. -- Thadeus On Sun, Nov 14, 2010 at 11:23 AM, mdipierro mdipie...@cs.depaul.edu wrote: Nothing prevents you in web2py to create a modules/models/mymodel.py then import applications.yourapp/modules/models.mymodel.py and then call a function in there that defines the tables you need. And you can have more than one mymodel. This anyway will be easy if we add support for lazy tables and thread local globals. On Nov 14, 10:36 am, Thadeus Burgess thade...@thadeusb.com wrote: A good advise, but, not always possible. I am considering to migrate an App in the range of 70-100 tables to web2py and there are tables that are like pillars, belong to several groups (customers, employees, projects,...) How we could manage this shared tables? Also sometimes its hard to determine an order for the tables to avoid referencing a still undefined table. There is another type of large applications, enterprise level with hundreds or thousands of tables. The approach of multiples apps sharing same database is useful, but how could we solve the division of tables in apps, is it better to define the model in one place and import the required tables on the apps? This is why I prefer Flask + SQLAlchemy. -- Thadeus 2010/11/14 José Ignacio Hurtado jose.i.hurt...@gmail.com A good advise, but, not always possible. I am considering to migrate an App in the range of 70-100 tables to web2py and there are tables that are like pillars, belong to several groups (customers, employees, projects,...) How we could manage this shared tables? Also sometimes its hard to determine an order for the tables to avoid referencing a still undefined table. There is another type of large applications, enterprise level with hundreds or thousands of tables. The approach of multiples apps sharing same database is useful, but how could we solve the division of tables in apps, is it better to define the model in one place and import the required tables on the apps? Jose. 2010/11/14 mdipierro mdipie...@cs.depaul.edu I agree that there are things we can improve in web2py. Yet, if a complex application have many pieces that are untangled, the import mechanism does not necessarily help you. The solution is trying to design components that are relatively independent. If you can do this, web2py does not bet in the way. For example, you have 100 tables functionally grouped in ~10 and all they need to share is authentication, you may want to separate the functions in 10 different web2py applications (all sharing one database, each defining only the tables it needs, and sharing one session cookie). This modular design solves lots of problems. I have heard of people who have developed complex applications in Django (which uses the import you suggest) and run into problems because they were using more ram than needed since all modules were always imported. In web2py controllers are executed only when called and if you make many small controllers you save lots of memory. Controllers than then import the modules they need and only those. Massimo On Nov 13, 7:28 pm, Thadeus Burgess thade...@thadeusb.com wrote: The biggest contributing factor is that web2py is executed and not import. The coder must always be sure to align objects and database in the correct order, including any auxiliary functions, class mappings, queries. He/she has to worry about the order of everything. Sometimes you can't have such order for complex systems. I think an import based system solves this in that the import statements declare the order instead of the physical location of the code doing that. -- Thadeus On Sat, Nov 13, 2010 at 2:49 PM, Jason Brower encomp...@gmail.com wrote: These are encouraging. In large deployment I mean it in the most external sense of it. Facebook is big, myspace is big, those kinds of object were what I was aiming for. And with Massimo's comment about the database size. I think your right, the framework does become less relavent. In what ways in a large codebase making web2py code messier and is there a solution to it in another framework? BR, J On Sat, 2010-11-13 at 11:48 -0600, Thadeus Burgess wrote: What is large deployment? Is it a large codebase that you must manage for an internal dashbaord, or just alot
Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?
What is large deployment? Is it a large codebase that you must manage for an internal dashbaord, or just alot of users/database io that needs to scale out for worldwide access? If its the first case, web2py can get really complicated in dealing with lots of models and difficult to manage in an efficient manner. The larger your codebase the messier web2py apps will become. In the end, this would ultimately be up to the preferences of you and your team and what your willing to put up with. In the second case, framework hardly matters at that point. Disqus uses django, facebook uses php, reddit uses pylons, myspace uses coldfusion, microsoft uses asp, oracle uses java. Its always the database that becomes an issue regardless of programming language or web framework. -- Thadeus On Sat, Nov 13, 2010 at 10:53 AM, mdipierro mdipie...@cs.depaul.edu wrote: I agree with Villas. The larger the development the more the database becomes the bottleneck and the framework irrelevant. Massimo On Nov 13, 8:35 am, villas villa...@gmail.com wrote: Hi Jason I guess you have to define 'large deployment' first of all. Number of records and size of DB? Number of concurrent users? Large data model or number of forms etc? Number of servers -- or replication? Global coverage? In principle I don't think there's any reason why Web2py would be worse than other frameworks. Usually it is much better! As an example, I think deploying to the Google App Engine should be able to scale sufficiently for everything but extreme cases :) If you specify more about what you wish to achieve this group may be able to give more specific advice how best to organise your project. -D On Nov 13, 7:12 am, Jason Brower encomp...@gmail.com wrote: I love web2py and it's the only framework i feel i am fully capable to do or learn to do quickly. However, I remember see that this framework is intended for small to medium sized deployments. Is this true? What is it that stops us from larger deployment? Should i pickup django because i may need it? Regards, jb
Re: [web2py] Re: Discussion: Why is web2py bad for large deployments?
The biggest contributing factor is that web2py is executed and not import. The coder must always be sure to align objects and database in the correct order, including any auxiliary functions, class mappings, queries. He/she has to worry about the order of everything. Sometimes you can't have such order for complex systems. I think an import based system solves this in that the import statements declare the order instead of the physical location of the code doing that. -- Thadeus On Sat, Nov 13, 2010 at 2:49 PM, Jason Brower encomp...@gmail.com wrote: These are encouraging. In large deployment I mean it in the most external sense of it. Facebook is big, myspace is big, those kinds of object were what I was aiming for. And with Massimo's comment about the database size. I think your right, the framework does become less relavent. In what ways in a large codebase making web2py code messier and is there a solution to it in another framework? BR, J On Sat, 2010-11-13 at 11:48 -0600, Thadeus Burgess wrote: What is large deployment? Is it a large codebase that you must manage for an internal dashbaord, or just alot of users/database io that needs to scale out for worldwide access? If its the first case, web2py can get really complicated in dealing with lots of models and difficult to manage in an efficient manner. The larger your codebase the messier web2py apps will become. In the end, this would ultimately be up to the preferences of you and your team and what your willing to put up with. In the second case, framework hardly matters at that point. Disqus uses django, facebook uses php, reddit uses pylons, myspace uses coldfusion, microsoft uses asp, oracle uses java. Its always the database that becomes an issue regardless of programming language or web framework. -- Thadeus On Sat, Nov 13, 2010 at 10:53 AM, mdipierro mdipie...@cs.depaul.edu wrote: I agree with Villas. The larger the development the more the database becomes the bottleneck and the framework irrelevant. Massimo On Nov 13, 8:35 am, villas villa...@gmail.com wrote: Hi Jason I guess you have to define 'large deployment' first of all. Number of records and size of DB? Number of concurrent users? Large data model or number of forms etc? Number of servers -- or replication? Global coverage? In principle I don't think there's any reason why Web2py would be worse than other frameworks. Usually it is much better! As an example, I think deploying to the Google App Engine should be able to scale sufficiently for everything but extreme cases :) If you specify more about what you wish to achieve this group may be able to give more specific advice how best to organise your project. -D On Nov 13, 7:12 am, Jason Brower encomp...@gmail.com wrote: I love web2py and it's the only framework i feel i am fully capable to do or learn to do quickly. However, I remember see that this framework is intended for small to medium sized deployments. Is this true? What is it that stops us from larger deployment? Should i pickup django because i may need it? Regards, jb
Re: [web2py] Re: Pagination [Web2py Utils] returns None
Thanks. I uploaded a new version to pypi. -- Thadeus On Fri, Nov 12, 2010 at 10:27 AM, Andrew Evans randra...@gmail.com wrote: Hey Thadeus! where would you like me to submit it? I can upload it here to this news group. The only thing I changed was what you suggested ;) adding self.r.args to the generate links function ;) def generate_links(self): self.backward = A(' previous()', _href=URL(r=self.r, args=self.r.args, vars={'p': self.current - self.display_count})) if self.current else ' previous(False)' self.forward = A('next() ', _href=URL(r=self.r, args=self.r.args, vars={'p': self.current + self.display_count})) if self.total_results self.current + self.display_count else 'next(False) ' self.location = 'Showing %d to %d out of %d records' % (self.current + 1, self.current + self.num_results, self.total_results) return (self.backward, self.forward, self.location) Anyway I attached the paginate.py *cheers On Thu, Nov 11, 2010 at 9:45 PM, Thadeus Burgess thade...@thadeusb.comwrote: Mind sending me a patch? -- Thadeus On Thu, Nov 11, 2010 at 6:02 PM, Andrew Evans randra...@gmail.comwrote: hey thanks for the tips I have it working now *cheers Andrew
Re: [web2py] Re: DAL() unusable ?
Right. I get it now. Is there a reason for not sticking the record creation inside of its own table? -- Thadeus 2010/11/12 Mirek Zvolský zvol...@seznam.cz hich person is an employee of which company, 2) which person has created the company record, 3) which person has created the person records, all 3 relations are 1:m relations. To realize 1:m relation there is no need to add a connecting table and if you do so, that would be a realy very bad design ! And it's easy to say why in other words: Because in case of real m:m relation there can be more as one records in the added connecting table to describe relationship between two entities. But if you will add connecting table from your weak reasons, then you will have always one(!) record in the connecting tab
Re: [web2py] Re: DAL() unusable ?
Your error seems to be coming from the fact you do not have defined a person model. Since web2py is a functional designed you must define person table before you can reference it. I use the following self-referential table and have never had a problem. db.define_table('participant', #... lots of other fields Field(referred_by, reference participant), #... lots of other fields. ) -- Thadeus 2010/11/11 Mirek Zvolský zvol...@seznam.cz Here's a link to the section in the book: http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases Yes, I know this, and from that reason I always use 'reference..' style syntax. However this is about very special foreign keys, which targets to same table (to the primary key in same table). And if there is some cycle in joins in the model (and of course it always is, except of very, very simple models), this will not help. And there is realy no solution for this in web2py ??
Re: [web2py] Re: Pagination [Web2py Utils] returns None
There are two alternatives. Have the generate_links function assume args when creating the url. This could be based on the existing args in request. URL(r=self.r, args=self.r.args) Or patch get_set to allow passing args as part of the function declaration, it would in turn pass these args to the generate_links() function and then URL would use those args. In the first case you would not need to change anything on your side. The second option would look something like qry = paginate.get_set(set_links=True, args=['myarg1', 'myarg2']) Which would YOU prefer? -- Thadeus On Thu, Nov 11, 2010 at 3:09 AM, Andrew Evans randra...@gmail.com wrote: ur the developer of Web2py Utils is that corr
Re: [web2py] Re: DAL() unusable ?
WRong. cr2 is a really really bad design. Database 101, any many to many relationship must be defined through a link table. Redesign CR2 like so... db.define_table('person', created_by('person')) db.define_table('company',...created_by('company')) db.define_table('person_company', id_person('person'), id_company('company')) If you want to knwo what company ap person belongs to, look it up in the link table person = db.person.first() link = db.person_company.id_person == person.id company = db.company.id == link.id_company This is the proper way to design this type of relationship. I would opt more for a feature in web2py that did this in the background than handled circular dependency magick. -- Thadeus On Thu, Nov 11, 2010 at 11:32 AM, mdipierro mdipie...@cs.depaul.edu wrote: Ok. Your crm2jpg makes a good case. You proved me wrong. I will try add this by the week-end. Massimo On Nov 11, 11:24 am, Mirek Zvolský zvol...@seznam.cz wrote: - mdipierro I have prepared 2 pictures, and in this time there is new post from you about company/author. Interesting that my pictures are about the same :-) Model of your CRM application application is here: http://zvolsky.alwaysdata.net/crm1.jpg Such model can be implemented in web2py, but order of definitions is important: auth_user, company, person But let's think, you want all people from person's table can register/ login into your application. In such case you will follow web2py book, chapter 8,http://web2py.com/book/default/chapter/08, Customizing Auth Renaming Auth Tables, and you will receive following model: http://zvolsky.alwaysdata.net/crm2.jpg And using reference... field types, in both definition orders (company,person or person,company) web2py will fail. As you say, I can use 'integer' type to avoid this problem, where it is. But mixing 'reference..' and 'integer' for same goal would be strange. So I can use 'integer' for all foreign keys in database. But that means in other words, that the 'reference..' field type is for nothing. What about a more difficult model ashttp:// zvolsky.alwaysdata.net/crm3.jpg I'm sorry, this is not in english. However it is something about organization of courses, lessons, we have some teachers and partitipant here, some payments for whole course of for one lesson only, and so on. Generated web2py code from OndrejZara's web designer is here: http://zvolsky.alwaysdata.net/jekus.py And of course this code will fail in web2py, because of there is no possibility to find a proper order of table definitions. Please, think about this. The change in web2py in this direction would be great. Best regards, Mirek
Re: [web2py] Re: Renaming a column in the database web2py?
To rename a column: #Let web2py use migration to create a new column db.define_table('table', Field('oldcolumn'), Field('newcolumn')) #Update the data, copy the old column into the new column db(db.table.id 0).update(db.table.newcolumn = db.table.oldcolumn) #Save the changes db.commit() #Remove the old column, letting web2py migrate drop the old column db.define_table('table', Field('newcolumn')) -- Thadeus On Thu, Nov 11, 2010 at 10:10 AM, mdipierro mdipie...@cs.depaul.edu wrote: In web2py you cannot rename a column. Why do you want to do it? On Nov 11, 9:04 am, mmartinez alexra...@gmail.com wrote: Good afternoon, everyone. Well I need to do is to rename the name of a column web2py the sql, sql language-I would do as follows when: select animals as Annex from WHERE accountcode accountcode.id_clientes = session.cliente_id; and web2py do so: rows = db (db.accountcode.id_clientes == session.cliente_id). select (db.accountcode.ani as Annex) and the error is. SyntaxError: invalid syntax If I can help as it they are grateful.
Re: [web2py] Re: DAL() unusable ?
I still do not agree. If you run into this issue you can always offset the created_by fields... db.define_table('audit_table', Field('tablename'), Field('record_id', 'integer'), Field('created_by', db.auth_user), ) If you ever did need to audit, just look it up in this table. Then you don't have the problem at all. -- Thadeus On Thu, Nov 11, 2010 at 12:17 PM, mdipierro mdipie...@cs.depaul.edu wrote: I agree with you that using a link table is better. This was my original argument. Yet often the need to sign tables (created_by) will suddenly cause a duplication of tables because lots of link tables have to be added and queries changed. This is what I meant by good case. Massimo On Nov 11, 12:05 pm, Thadeus Burgess thade...@thadeusb.com wrote: WRong. cr2 is a really really bad design. Database 101, any many to many relationship must be defined through a link table. Redesign CR2 like so... db.define_table('person', created_by('person')) db.define_table('company',...created_by('company')) db.define_table('person_company', id_person('person'), id_company('company')) If you want to knwo what company ap person belongs to, look it up in the link table person = db.person.first() link = db.person_company.id_person == person.id company = db.company.id == link.id_company This is the proper way to design this type of relationship. I would opt more for a feature in web2py that did this in the background than handled circular dependency magick. -- Thadeus On Thu, Nov 11, 2010 at 11:32 AM, mdipierro mdipie...@cs.depaul.edu wrote: Ok. Your crm2jpg makes a good case. You proved me wrong. I will try add this by the week-end. Massimo On Nov 11, 11:24 am, Mirek Zvolský zvol...@seznam.cz wrote: - mdipierro I have prepared 2 pictures, and in this time there is new post from you about company/author. Interesting that my pictures are about the same :-) Model of your CRM application application is here: http://zvolsky.alwaysdata.net/crm1.jpg Such model can be implemented in web2py, but order of definitions is important: auth_user, company, person But let's think, you want all people from person's table can register/ login into your application. In such case you will follow web2py book, chapter 8,http://web2py.com/book/default/chapter/08, Customizing Auth Renaming Auth Tables, and you will receive following model: http://zvolsky.alwaysdata.net/crm2.jpg And using reference... field types, in both definition orders (company,person or person,company) web2py will fail. As you say, I can use 'integer' type to avoid this problem, where it is. But mixing 'reference..' and 'integer' for same goal would be strange. So I can use 'integer' for all foreign keys in database. But that means in other words, that the 'reference..' field type is for nothing. What about a more difficult model ashttp:// zvolsky.alwaysdata.net/crm3.jpg I'm sorry, this is not in english. However it is something about organization of courses, lessons, we have some teachers and partitipant here, some payments for whole course of for one lesson only, and so on. Generated web2py code from OndrejZara's web designer is here: http://zvolsky.alwaysdata.net/jekus.py And of course this code will fail in web2py, because of there is no possibility to find a proper order of table definitions. Please, think about this. The change in web2py in this direction would be great. Best regards, Mirek
Re: [web2py] Re: Pagination [Web2py Utils] returns None
Mind sending me a patch? -- Thadeus On Thu, Nov 11, 2010 at 6:02 PM, Andrew Evans randra...@gmail.com wrote: hey thanks for the tips I have it working now *cheers Andrew
Re: [web2py] Re: Pagination [Web2py Utils] returns None
Its losing the args when it creates a new URL. It will require a patch on set_links so you can pass custom args and vars to URL. -- Thadeus On Wed, Nov 10, 2010 at 4:36 PM, Andrew Evans randra...@gmail.com wrote: I just noticed the difference in URLs https://127.0.0.1:8000/Working/display/product_wall/4056 above is the comments on the product notice the id. below is the next link of the pagination https://www.127.0.0.1:8000/Working/display/product_wall?p=5 it loses the 4056 which is the id of the product I think it may have to do with response value. Any ideas? On Wed, Nov 10, 2010 at 9:04 AM, Andrew Evans randra...@gmail.com wrote: Hello I am trying to create some pagination on my comments page everything seems to be working, however when I click the next link it goes to a page that all it says is None Anyone know why this is happening and how to fix it There are entries in the db. Thanks in Advance below is my code *cheers def product_wall(): this_page = request.args(0) product=db(db.product.id == this_page).select(db.product.ALL) for products in product: #comments=db(db.comment.product == this_page).select(db.comment.ALL) comments=db.comment.product == this_page orderby = ~db.comment.id pcache = (cache.ram, 15) stars = StarRatingWidget(single_vote=True) db.comment.rating.widget = stars.widget db.comment.product.default = products.id form = SQLFORM(db.comment) db.comment.product.id = products.id if form.accepts(request.vars,session): response.flash = 'Your Comment has been submitted' paginate = Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response) rows=paginate.get_set(set_links=True) return dict(comments=rows,form=form,products=products) elif form.errors: response.flash = 'Please correct your error' paginate = Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response) rows=paginate.get_set(set_links=True) return dict(comments=rows,form=form,products=products) else: paginate = Pagination(db,comments,orderby,display_count=2,cache=pcache,r=request,res=response) rows=paginate.get_set(set_links=True) return dict(comments=rows,form=form,products=products)
Re: [web2py] Re: new admin layout
My vote is for a light-ish theme. -- Thadeus On Fri, Nov 5, 2010 at 11:38 AM, Branko Vukelic bg.bra...@gmail.com wrote: On Fri, Nov 5, 2010 at 11:40 AM, selecta gr...@delarue-berlin.de wrote: also it should be css = cursor: pointer; when i did not see my mouse trurn to a hand i thought i could not click it These issues will hopefully be resolved in a consistent manner (not by patch one thing at a time, but everything at once) once the HTML is reworked, and a cleaner CSS is written for it. In any case, expect a new update next week, since this baby has to ship before the supercomputing conference presentation. ;) As part of the HTML refactoring effort, I'll remove most inline images, and convert them to background images, so if you want an alternative theme, it'll be easier to implement using just CSS without hacking HTML. This could be a step towards user themes or whatever you want. Also, I've decided to redo the theme once more. I've had something like this on mind: http://www.workroomdesign.com/images/projects/mrecon3.png Clean with just orange. Another option would be a dark theme: http://media02.hongkiat.com/design_starter_kits/Web-Form-Elements-02.jpg Or a combination of dark with orange. Does anyone here prefer dark themes? I myself have switched to a light theme on my desktop, so I don't mind the light theme, but I've been in love with the dark themes for a long time. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Re: new admin layout
The corners are way too rounded. Looks good! -- Thadeus On Thu, Nov 4, 2010 at 4:57 PM, Christopher Steel chris.st...@gmail.comwrote: Nice work, looks great! I really like the flow that is starting to happen when resizing the browser window. Makes me want to try it from my iphone... Chris On Nov 1, 10:12 pm, mdipierro mdipie...@cs.depaul.edu wrote: I can make this stable tomorrow if no objections. Massimo On Nov 1, 9:10 pm, mr.freeze nat...@freezable.com wrote: Looks more Ubuntu than Halloween to me. I like it. On Nov 1, 8:46 pm, mdipierro mdipie...@cs.depaul.edu wrote: For now I am putting this in. I like the logic of it. I made some minor changes. I am not so sure about the Halloween colors. What do other people think? Massimo On Nov 1, 5:25 pm, Branko Vukelic bg.bra...@gmail.com wrote: Massimo, So I've cloned the HG repo and I've done my magic on the files. Would the contents of ``hg diff`` be useful to you? Anyway, it's attached, so please tell me if that's what you need. Also, some binary assets (icons). It's not complete. I'm sure some sections could use more work. I'll do that some other time, though. Too tired now. On Mon, Nov 1, 2010 at 10:11 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Mon, Nov 1, 2010 at 10:10 PM, Branko Vukelic bg.bra...@gmail.com wrote: how to style the browser button. Does anyone have an idea? Failing I meant the 'Browse' button. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group folder.gif 1KViewDownload folder_current.gif 1KViewDownload folder_sm.gif 1KViewDownload heading_bg.png 1KViewDownload new_admin.diff 21KViewDownload
Re: [web2py] Re: DateInput Calendar and other widgets
The problem is that there are great date pickers but never a good time picker or datetime picker -- Thadeus On Tue, Nov 2, 2010 at 11:07 AM, annet annet.verm...@gmail.com wrote: It's smaller when you build your own download, that's what I did when I just needed the tabs. Annet.
Re: [web2py] Re: new admin layout
This is much better. Not sure about the gradient on the apps listing however. Try some more subtle rounded corners? -- Thadeus On Tue, Nov 2, 2010 at 2:29 PM, Branko Vukelic bg.bra...@gmail.com wrote: What do you people think about this color scheme? Trying out colors that match the main site + orange as an accent color to emphasize bits and pieces. On Tue, Nov 2, 2010 at 7:31 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 2, 2010 at 6:49 PM, mdipierro mdipie...@cs.depaul.edu wrote: I'd rather have one layout for admin than a choice. I think we need this as simple as spossible. I agree. This is not a question of preference, but utility. If bold text fails to emphasize an important bit of information, but takes a lot of space, that's a bug. That's the approach. Anyway, it's not the end of the world if it took a little more space, as long as you find what you're looking for with ease. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Re: new admin layout
I like the old one better. This is too busy. Everything looks exactly the same. Leads to much confusion on where things I need are. -- Thadeus On Mon, Nov 1, 2010 at 9:12 PM, mdipierro mdipie...@cs.depaul.edu wrote: I can make this stable tomorrow if no objections. Massimo On Nov 1, 9:10 pm, mr.freeze nat...@freezable.com wrote: Looks more Ubuntu than Halloween to me. I like it. On Nov 1, 8:46 pm, mdipierro mdipie...@cs.depaul.edu wrote: For now I am putting this in. I like the logic of it. I made some minor changes. I am not so sure about the Halloween colors. What do other people think? Massimo On Nov 1, 5:25 pm, Branko Vukelic bg.bra...@gmail.com wrote: Massimo, So I've cloned the HG repo and I've done my magic on the files. Would the contents of ``hg diff`` be useful to you? Anyway, it's attached, so please tell me if that's what you need. Also, some binary assets (icons). It's not complete. I'm sure some sections could use more work. I'll do that some other time, though. Too tired now. On Mon, Nov 1, 2010 at 10:11 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Mon, Nov 1, 2010 at 10:10 PM, Branko Vukelic bg.bra...@gmail.com wrote: how to style the browser button. Does anyone have an idea? Failing I meant the 'Browse' button. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group folder.gif 1KViewDownload folder_current.gif 1KViewDownload folder_sm.gif 1KViewDownload heading_bg.png 1KViewDownload new_admin.diff 21KViewDownload
Re: [web2py] Standalone DAL, where is the database folder ? and problems caused by
My_DB = DAL('sqlite://databaseName', folder='D:\Data_Python_25\Beheer...') -- Thadeus On Mon, Nov 1, 2010 at 4:12 PM, Stef Mientki stef.mien...@gmail.com wrote: hello, the more I get used to the syntax of DAL, the more I like it, great ! especially, after splitting up the queries and making some helper functions, like this Module = 'D2_D1' Query = ( DB.Module.id == DB.PRID_MID.MID ) \ ( DB.Project.id== DB.PRID_MID.PRID ) \ ( DB.Afdeling.id == DB.Project.AID ) \ ( DB.Module.Module == Module ) Select = DB.Project.Name, DB.Afdeling.Name, DB.Project.id print Get_Table_Data ( DB, Query, Select )[1:] print Get_Single_List ( DB, Query, Select ) print Get_Data_Dict ( self.DB.Level ) too bad we can't use the normal and notation :-( My question is where is the database folder (it seems to be everywhere ;-) ? Can it be set explicitly ? It seems that the sql-log-file and the .table files are written in the CWD. As a workaround I now keep track of the cwd, and if I use define_table I first set the cwd to the database directory. But I assume there are more actions where the cwd need to be set to the database folder, so I expect more problems/ I use the following to create the database: Database_Name = r'D:\Data_Python_25\Beheer\ID_TO_Beheer_DAL.db' My_DB = DAL ( 'sqlite://' + Database_Name ) thanks, Stef Mientki
Re: [web2py] Re: new admin layout
The version web2py has had for over a year. The new one is busy/confusing. I didn't know where to look at first glance. It feels Halloween-ish... I halfway expect a pumpkin somewhere on the page. There are too many buttons which are actually hyperlinks. Sooo many buttons -- Thadeus On Mon, Nov 1, 2010 at 9:26 PM, mdipierro mdipie...@cs.depaul.edu wrote: Thadeus, Why more busy? There are no more links/text that before but while before links were separated by a |, now they are separated by colored boxes (which prevents problems in alignment). The links to edit apps/files have a different color to be easily recognizable (before all links were they same). Branko added the folder icons. As I see it if there is an issue, it is with colors and/or folder icons. By before you mean the version posted this morning or the version available until yesterday? Massimo On Nov 1, 9:15 pm, Thadeus Burgess thade...@thadeusb.com wrote: I like the old one better. This is too busy. Everything looks exactly the same. Leads to much confusion on where things I need are. -- Thadeus On Mon, Nov 1, 2010 at 9:12 PM, mdipierro mdipie...@cs.depaul.edu wrote: I can make this stable tomorrow if no objections. Massimo On Nov 1, 9:10 pm, mr.freeze nat...@freezable.com wrote: Looks more Ubuntu than Halloween to me. I like it. On Nov 1, 8:46 pm, mdipierro mdipie...@cs.depaul.edu wrote: For now I am putting this in. I like the logic of it. I made some minor changes. I am not so sure about the Halloween colors. What do other people think? Massimo On Nov 1, 5:25 pm, Branko Vukelic bg.bra...@gmail.com wrote: Massimo, So I've cloned the HG repo and I've done my magic on the files. Would the contents of ``hg diff`` be useful to you? Anyway, it's attached, so please tell me if that's what you need. Also, some binary assets (icons). It's not complete. I'm sure some sections could use more work. I'll do that some other time, though. Too tired now. On Mon, Nov 1, 2010 at 10:11 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Mon, Nov 1, 2010 at 10:10 PM, Branko Vukelic bg.bra...@gmail.com wrote: how to style the browser button. Does anyone have an idea? Failing I meant the 'Browse' button. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group folder.gif 1KViewDownload folder_current.gif 1KViewDownload folder_sm.gif 1KViewDownload heading_bg.png 1KViewDownload new_admin.diff 21KViewDownload
Re: [web2py] standalone DAL: why is migration table name preceeded by some prefix ?
That is a hash of the connection string you pass in during DAL instantiation. This way you can uniquely identify db = DAL('sqlite://my.db') vs db = DAL('postgres://.') without overwriting your .table files. -- Thadeus On Sun, Oct 31, 2010 at 3:03 PM, Stef Mientki stef.mien...@gmail.comwrote: hello, I use the following statement to create a standalone DAT table DB.define_table ( Name, *Fields, migrate = 'Afdeling.table' ) Why is the name of the migration table prefixed ? 9ca3bd6f71b92b953cff7d3c148b42fc_Afdeling.table thanks, Stef Mientki
Re: [web2py] Standalone DAL, what's the correct uri for the database location ?
Have you tried without the file:/// ? On linux you don't need to specify file:/// you can just give the full path. -- Thadeus On Sun, Oct 31, 2010 at 3:19 PM, Stef Mientki stef.mien...@gmail.comwrote: hello, Standalone DAL, what's the correct uri for the database location ? This works: Database_Name = 'ID_TO_Beheer_DAL.db' DB = DAL_DB ( 'sqlite://' + Database_Name ) This gives an error, saying couldn;'t find a database after 5 tries Database_Name = r'D:/Data_Python_25/Beheer/ID_TO_Beheer_DAL.db' DB = DAL_DB ( 'sqlite://file:///' + Database_Name ) A workaround is to use os.chdir() thanks, Stef Mientki
Re: [web2py] Re: PostgreSQL super slowdowns
I guess its a problem with a postgresql setting, or old drivers maybe? -- Thadeus On Sat, Oct 30, 2010 at 12:45 AM, Chris partyonais...@gmail.com wrote: I was just trying the home page...some selects are run on every page but as far as I know that's it. The machine's got plenty of memory and this is a very basic application with probably less than 1MB data total. On Oct 29, 7:59 am, Johann Spies johann.sp...@gmail.com wrote: On 29 October 2010 08:53, Chris partyonais...@gmail.com wrote: Hey, I've noticed some serious slowdowns ever since I switched from SQLite to Postgres. Pages will take MINUTES to load - it's kind of fascinating. I have been using both SQLITE and Postgresql (sometimes with the same content) and did not notice a slowdown. Some of my datasets are quite large (a dump of a present project's database is about 3G) and I don't experience any problem on Postgresql. What exactly were you doing when you noticed this? Inserts? Queries? CSV-downloads? How much data? How much ram available? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Stand Alone DAL and migrations (again)
Just my 2 cents. Using the DAL on anything but web2py is going to be a pain in the ass and a nightmare waiting to happen. This is due to its inherent forced procedural coding style. You can wrap DAL calls as methods, but it just gets really messy. I'm a clean code zealot, so I bet I care more than most. For any kind of software your developing that uses object oriented programming, use a database system that is structured around classes and declarative bases. You will find this is much much much easier to integrate into, for example a wxWidgets program, than the DAL is. -- Thadeus On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki stef.mien...@gmail.comwrote: On 30-10-2010 12:06, rochacbruno wrote: Look this simple example: http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py I have a PyGTK app running very well, I will put the code online soon. hi Bruno, one other question, in the gtk application, do you access the database through a local server, or direct through a local disk location ? And in the latter case, how do you specify a hard disk location ? thanks, Stef Em 30/10/2010, às 06:33, Stef Mientki stef.mien...@gmail.com escreveu: Interesting ... as I want to migrate to web2py and want to have some kind of DAL for my desktop applications, this sounds very good. Can you give me some guide lines, how to use the web2py DAL for desktop applications ? thanks, Stef Mientki On 19-10-2010 05:44, Bruno Rocha wrote: I know DAL was not made for that, but I'm using the DAL in a desktop application with PyGTK, and it is working very well :-) It is a simple application that monitors the presence of employees in a company and reads small CSV files from a time clock, people has cards that open the gates/doors of the company factory, I use a stream to read the track from serial port of time clock, then, I take the information serialized as CSV, I parse and write it into SQLite db, after that , the Janitor uses a PyGTK app to access that information. already been running for about 6 months, So far everything is working fine, but I can not run the automatic migrations. Does anyone know a way to make migration work automatically with DAL Stand Alone? I'm importing sql.py I'm connecting with SQLite, setting tables, accessing and doing out any crud operation. The only thing missing is to make migration works. I already set migrate='Mytable.table' and I tried with migrate=True An example of what I have working in my connect.py from gluon.sql import * db = DAL('sqlite://timeclock1.db') Track = db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table') Form_workflow.py Track.insert(regnumber=123,action=2,timestamp='2010-10-19') 1 Track.insert(regnumber=124,action=2,timestamp='2010-10-19') 2 db.commit Until here, its ok. But now I am wanting to change the model, and including Field('department') connect.py Track = db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'), *Field('department')*,migrate='track.table') Traceback (most recent call last): File stdin, line 1, in module File /bin/DAL/gluon/sql.py, line 1346, in define_table raise SyntaxError, 'invalid table name: %s' % tablename SyntaxError: invalid table name: track If this is not possible, I'll have to create new fields in SQLite and then update my model.
Re: [web2py] Re: web2py 1.88.1 is OUT
Where should the list of apps come from? I think this is the biggest question. -- Thadeus On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess thade...@thadeusb.comwrote: Someone writes a script to automate the process. Have a list of apps that we want to be sure are tested and working. The script will download web2py testing, copy the apps to the downloaded version, fire a process fork to start that web2py, use urllib or httplib to navigate to each of the apps pages to verify that things are working. If a response code of 500 is ever received then go get the error ticket and store it somewhere central including which app it came from. -- Thadeus On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng elf...@yahoo.comwrote: On Oct 30, 7:05 am, mdipierro mdipie...@cs.depaul.edu wrote: Normally it goes to the nightly build, perhaps not exactly the latest but something very close. The bug in question has been there for about one week. The problem is that nobody tests the nightly build. Massimo I would love to have a way to test non stable builds easily with my existing apps. How does one do so besides downloading the trunk/ nightly build, and then exporting the apps from stable web2py and then import to the trunk/nightly web2py?
Re: [web2py] Re: web2py 1.88.1 is OUT
Someone writes a script to automate the process. Have a list of apps that we want to be sure are tested and working. The script will download web2py testing, copy the apps to the downloaded version, fire a process fork to start that web2py, use urllib or httplib to navigate to each of the apps pages to verify that things are working. If a response code of 500 is ever received then go get the error ticket and store it somewhere central including which app it came from. -- Thadeus On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng elf...@yahoo.comwrote: On Oct 30, 7:05 am, mdipierro mdipie...@cs.depaul.edu wrote: Normally it goes to the nightly build, perhaps not exactly the latest but something very close. The bug in question has been there for about one week. The problem is that nobody tests the nightly build. Massimo I would love to have a way to test non stable builds easily with my existing apps. How does one do so besides downloading the trunk/ nightly build, and then exporting the apps from stable web2py and then import to the trunk/nightly web2py?
Re: [web2py] Re: Stand Alone DAL and migrations (again)
Its not about can it be used stand alone. Its about how you have to structure your code when you do. The only reason the DAL works well with web2py is because web2py is executed and designed to be functionally coded. I would suggest SQLAlchemy. Its designed with OOP in mind, and offers more features than the DAL. However, Like I said, if your not concerned with using an OOP design, then the DAL Is probably fine. I have been here, done this. I already have wrote wxWidgets applications that attempted to use the DAL standalone. It worked... but I soon learned SQLAlchemy was much better suited for the job. I speak from experience. If all you are doing is one or two models, then DAL is probably is fine. My application of using the DAL standalone contained over 50 models, all interconnected and weaved into each other. I also needed to organize my code and have all of the models split up into their own files. -- Thadeus On Sat, Oct 30, 2010 at 2:07 PM, mdipierro mdipie...@cs.depaul.edu wrote: well. I disagree. ;-) http://web2py.com/AlterEgo/default/show/215 On 30 oct, 12:42, Thadeus Burgess thade...@thadeusb.com wrote: Just my 2 cents. Using the DAL on anything but web2py is going to be a pain in the ass and a nightmare waiting to happen. This is due to its inherent forced procedural coding style. You can wrap DAL calls as methods, but it just gets really messy. I'm a clean code zealot, so I bet I care more than most. For any kind of software your developing that uses object oriented programming, use a database system that is structured around classes and declarative bases. You will find this is much much much easier to integrate into, for example a wxWidgets program, than the DAL is. -- Thadeus On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki stef.mien...@gmail.com wrote: On 30-10-2010 12:06, rochacbruno wrote: Look this simple example: http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py I have a PyGTK app running very well, I will put the code online soon. hi Bruno, one other question, in the gtk application, do you access the database through a local server, or direct through a local disk location ? And in the latter case, how do you specify a hard disk location ? thanks, Stef Em 30/10/2010, às 06:33, Stef Mientki stef.mien...@gmail.com escreveu: Interesting ... as I want to migrate to web2py and want to have some kind of DAL for my desktop applications, this sounds very good. Can you give me some guide lines, how to use the web2py DAL for desktop applications ? thanks, Stef Mientki On 19-10-2010 05:44, Bruno Rocha wrote: I know DAL was not made for that, but I'm using the DAL in a desktop application with PyGTK, and it is working very well :-) It is a simple application that monitors the presence of employees in a company and reads small CSV files from a time clock, people has cards that open the gates/doors of the company factory, I use a stream to read the track from serial port of time clock, then, I take the information serialized as CSV, I parse and write it into SQLite db, after that , the Janitor uses a PyGTK app to access that information. already been running for about 6 months, So far everything is working fine, but I can not run the automatic migrations. Does anyone know a way to make migration work automatically with DAL Stand Alone? I'm importing sql.py I'm connecting with SQLite, setting tables, accessing and doing out any crud operation. The only thing missing is to make migration works. I already set migrate='Mytable.table' and I tried with migrate=True An example of what I have working in my connect.py from gluon.sql import * db = DAL('sqlite://timeclock1.db') Track = db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table') Form_workflow.py Track.insert(regnumber=123,action=2,timestamp='2010-10-19') 1 Track.insert(regnumber=124,action=2,timestamp='2010-10-19') 2 db.commit Until here, its ok. But now I am wanting to change the model, and including Field('department') connect.py Track = db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'), *Field('department')*,migrate='track.table') Traceback (most recent call last): File stdin, line 1, in module File /bin/DAL/gluon/sql.py, line 1346, in define_table raise SyntaxError, 'invalid table name: %s' % tablename SyntaxError: invalid table name: track If this is not possible, I'll have to create new fields in SQLite and then update my model.
Re: [web2py] Re: web2py 1.88.1 is OUT
Can we make some sort of massive web2py app that makes use of every single feature in web2py (as much as possible). If the index page of the app returns OK then everything is working. ??? Kind of like a unit test without a unit test. -- Thadeus On Fri, Oct 29, 2010 at 6:05 PM, mdipierro mdipie...@cs.depaul.edu wrote: Normally it goes to the nightly build, perhaps not exactly the latest but something very close. The bug in question has been there for about one week. The problem is that nobody tests the nightly build. Massimo On Oct 29, 5:32 pm, Bruno Rocha rochacbr...@gmail.com wrote: I have a question: From Trunk it is going directly to Stable, or is passing throught Nighly Built for testing before going Stable? What is the roadmap/timeline for release cycle? 2010/10/29 Branko Vukelic bg.bra...@gmail.com On Sat, Oct 30, 2010 at 12:05 AM, mdipierro mdipie...@cs.depaul.edu wrote: Fixed. 1.88.2 but please check it Woah! Two releases in a few hours! :D -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- http://rochacbruno.com.br
Re: [web2py] Re: Static folder and cookies
It is referring to the root domain having a cookie, in this case, navigating to www.mydomain.com gives a cookie. so this benchmark website is not 100% smart about the fact if cookies are sent with static files. If you really want to, set up an apache domain to serve static files as like static.mydomain.com, and then use web2py routes to redirect to the correct static subdomain. -- Thadeus On Thu, Oct 28, 2010 at 8:51 AM, annet annet.verm...@gmail.com wrote: You mean in a production environment I should not serve static files from the apps static folder? What happens to the dynamic URLs in that case? At the moment I edit the static files within web2py, and I quite like the 'pack all' and 'upload and install packed application' features to deploy an application. If I'd move all the static files to Apache, deploying an application would become more complicated, wouldn't it. BTW I tested the performance of my application here: http://groups.google.com/group/web2py/browse_thread/thread/da47638dbc515735 Does anyone of you get the same remarks about cookieless domains? Kind regards, Annet.
Re: [web2py] Re: new ticket reporting system
I can work on some of this tonight. On the details thing jumping. The click event bound to the TR element, since details is inside the TR it is not obvious how to disable the collapse functionality. Ideas? -- Thadeus On Tue, Oct 26, 2010 at 7:43 AM, blackthorne francisco@gmail.comwrote: idea for next step: Publishing errors It would be nice to receive some reports or error events by other protocols by other channels chosen by the administrator such as RSS, twitter, mail, sms, XML-RPC... Thank you, good one! On Oct 26, 12:12 pm, selecta gr...@delarue-berlin.de wrote: :) like it but why not also display the latest datetime in the view and allow to change the sorting, I never got to that but i think this would be a good idea sometimes you want to see the latest bug, sometimes the most frequent one the details thing is almost perfect, i just do not like that it jumps on opening, fixed width for the table columns would be nice anyways I think it is s cool that you guy act so fast on new ideas On Oct 26, 4:03 am, mdipierro mdipie...@cs.depaul.edu wrote: Thanks to Thadeus and Selecta we have a new ticket reporting system in trunk. Tickets are listed grouped by error traceback. So if there are multiple tickets caused by the same problem, you see only one of them with a number indicated how many occurrences. This allows you to easily identify recurrent problems. Please check it out. Massimo
Re: [web2py] Re: new ticket reporting system
I think that emailing tickets and what Richard would be an example of the applications job. Perhaps a plugin could be worked to easily add support for this to any web2py app, however. -- Thadeus On Tue, Oct 26, 2010 at 12:56 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Other idea : The cherry on top I think... When the user get a ticket, in the same page it could be really nice to have a text box field and a email field. That allows user to send email to administrator and details of what he was doing before he get the ticket. If the system can send email about the ticket without the input of the user, that could be a major improvement (may be it is already working not sure). Richard On Tue, Oct 26, 2010 at 12:58 PM, Thadeus Burgess thade...@thadeusb.comwrote: I can work on some of this tonight. On the details thing jumping. The click event bound to the TR element, since details is inside the TR it is not obvious how to disable the collapse functionality. Ideas? -- Thadeus On Tue, Oct 26, 2010 at 7:43 AM, blackthorne francisco@gmail.comwrote: idea for next step: Publishing errors It would be nice to receive some reports or error events by other protocols by other channels chosen by the administrator such as RSS, twitter, mail, sms, XML-RPC... Thank you, good one! On Oct 26, 12:12 pm, selecta gr...@delarue-berlin.de wrote: :) like it but why not also display the latest datetime in the view and allow to change the sorting, I never got to that but i think this would be a good idea sometimes you want to see the latest bug, sometimes the most frequent one the details thing is almost perfect, i just do not like that it jumps on opening, fixed width for the table columns would be nice anyways I think it is s cool that you guy act so fast on new ideas On Oct 26, 4:03 am, mdipierro mdipie...@cs.depaul.edu wrote: Thanks to Thadeus and Selecta we have a new ticket reporting system in trunk. Tickets are listed grouped by error traceback. So if there are multiple tickets caused by the same problem, you see only one of them with a number indicated how many occurrences. This allows you to easily identify recurrent problems. Please check it out. Massimo
Re: [web2py] opposite of belongs ?
db(~db.table.field.belongs(list)).select() -- Thadeus On Wed, Oct 27, 2010 at 12:44 AM, Andrew Thompson andre...@aktzero.comwrote: Is there a way to get 'NOT IN' via DAL? I believe it should be a negative/opposite of the belongs operator. -- Andrew Thompson http://aktzero.com/
Re: [web2py] Re: Request for a logo - PluginCentral
No, I do not have a server that can run web2py currently. (due to a conflict with simplejson. I require the version from pypi, which coincidentally is incompatible with web2py (and I do not feel like reconfiguring my server to use virtualenv)). The code is at http://code.google.com/p/plugincentral/ You are welcome to make a checkout and run it locally. Most of it is working actually... There are a few tweaks to be made security wise for the demo, but I think its almost done. Register account. Upload a plugin, provide name, descriptions, categories, license, the packed plugin file, a version, a screenshot, a packed demo application to showcase the plugin. There will also be featured plugins that the site admin can choose to display at the top of the index page. The admin can also download all demo applications and review them. If approved, it uses app_install to install the application into web2py and generates a link to it. So if you have a plugin named Comments it will make an app named plugin_central_Comments and for the demo you just get redirected there. I do need to go over the rules of a demo app 1) Must use sqlite 2) Cannot contain appadmin 3) Cannot be harmful to the filesystem 4) Cannot have functions that require minutes to complete. 5) Cannot have tons of data in the database. 6) Cannot contain external links 7) Must work. -- Thadeus On Sun, Oct 24, 2010 at 8:14 PM, mdipierro mdipie...@cs.depaul.edu wrote: Do you have a site up and running? On Oct 24, 6:09 pm, Thadeus Burgess thade...@thadeusb.com wrote: I am working on plugin central, finally have some free time to devote to the project. However I am a horrible artist, and wonder if anyone would like to help me with designing a logo? This is my color scheme White - body content #5E99E7 - Links main color (a light blue) #F5F4EF - Grey, page background I would like to use the new Ubuntu font since it is open source. -- Thadeus
Re: [web2py] Re: Request for a logo - PluginCentral
Massimo, do you have what you are working on posted anywhere? -- Thadeus On Mon, Oct 25, 2010 at 9:17 AM, weheh richard_gor...@verizon.net wrote: https://docs.google.com/leaf?id=0BzPqKovYWlw-Mjg1NDBhNWQtOWM1MC00ZmE2LWJiZjktZWZjZTkyZTJhMmYyhl=enauthkey=COWQ8YEF On Oct 25, 10:12 am, mdipierro mdipie...@cs.depaul.edu wrote: Nice work! On Oct 25, 8:49 am, Branko Vukelic bg.bra...@gmail.com wrote: I've missed this part of the convo when I was replying to Thadeus off-list. Anyway, since I've already done something, and the current plugins site doesn't seem to have it's own logo either, I'll attach the thing I've done, so you can take a look. On Mon, Oct 25, 2010 at 1:58 PM, mdipierro mdipie...@cs.depaul.edu wrote: This has some overlap with what I am doing... anyway... we can merge later. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group PluginCentral_logo.png 52KViewDownload
Re: [web2py] Re: Request for a logo - PluginCentral
It should be easy enough to add a service for a listing of plugins. Would come up with a design specification for the API you want? Your even welcome to make a checkout and just add an API to the plugincentral codebase if you get to it before I do. I don't see any reason why this would need to be two separate apps. I'm willing to give commit access to anyone who wants to help. At least for right now, I don't know of any plugins that have dependencies, and that part of the plugin spec still is not fleshed out. This is why I removed storing separate versions for each plugin and just have it store the latest version. I would love to have this work on GAE, but to be able to provide proper demonstration of plugins it requires being able to install an app into web2py. -- Thadeus On Mon, Oct 25, 2010 at 10:33 AM, mdipierro mdipie...@cs.depaul.edu wrote: yway, our projects may be compleme
Re: [web2py] Re: Error tickets by number of occurrence
I think this should be default for the ticket view. -- Thadeus On Mon, Oct 25, 2010 at 8:54 AM, mdipierro mdipie...@cs.depaul.edu wrote: If I have time, I would like to. On Oct 25, 7:03 am, selecta gr...@delarue-berlin.de wrote: so will you integrate it into the current issue tracker? like a tab or button with sort by number of occurrence On Oct 25, 1:59 pm, mdipierro mdipie...@cs.depaul.edu wrote: Good idea! On Oct 25, 6:37 am, selecta gr...@delarue-berlin.de wrote: Quite a while ago I wrote some code for my issue tracker to show error tickets by their number of occurrence. The Idea behind this is that you will see the error that appears most frequently and that needs fixing immediately. Since I am too busy to finish the issue tracker I will just share the relevant code screenshothttp:// jaguar.biologie.hu-berlin.de/~fkrause/screenshot_error_frequec.http://jaguar.biologie.hu-berlin.de/%7Efkrause/screenshot_error_frequec. .. the controller error_files_base = os.path.join(request.env.web2py_path,'applications',request.application,'errors') def errors(): import operator import os.path import hashlib import os import pickle #-- if request.vars.has_key('del'): for fn in os.listdir(error_files_base): try: error = pickle.load(open(os.path.join(error_files_base,fn),'r')) except IOError: continue hash = hashlib.md5(error['traceback']).hexdigest() if request.vars['del'] == hash: os.remove( os.path.join(error_files_base,fn) ) #-- hash2error = dict() for fn in os.listdir(error_files_base): try: error = pickle.load(open(os.path.join(error_files_base,fn),'r')) except IOError: continue hash = hashlib.md5(error['traceback']).hexdigest() try: hash2error[hash]['count'] += 1 except KeyError: error_lines = error['traceback'].split(\n) last_line = error_lines[-2] error_causer = os.path.split(error['layer'])[1] hash2error[hash] = dict(count = 1, pickel = error, causer = error_causer, last_line = last_line, hash = hash) decorated = [(x['count'],x) for x in hash2error.values()] decorated.sort(key=operator.itemgetter(0), reverse=True) return dict(errors = [x[1] for x in decorated]) the view table id='trck_errors' {{=THEAD(TR(TH('Delete'), TH('Count'), TH('File'), TH('Error')))}} tbody {{for e in errors:}} {{=TR(TD(BUTTON_DELETE(e['hash'])), TH(e['count']),TD(e['causer']),TD(e['last_line']), _onclick=collapse('%s');%e['hash'])}}{{=TR(TD(DIV(CODE(e['pickel'] ['traceback']), _id=e['hash']),_colspan=4 ))}} {{pass}} /tbody /table script $(document).ready(function(){ $('{{for e in errors:}}#{{=e['hash']}}, {{pass}}').hide(); }); /script feel free to use and improve
[web2py] traceback on wizard
running trunk, attempting to use wizard, dies on step6 Traceback (most recent call last): File /home/thadeusb/Applications/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py, line 527, in module File /home/thadeusb/Applications/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py, line 191, in step6 create(form.vars) File /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py, line 510, in create file.write(make_page(page,session.app.get('page_'+page,''))) File /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py, line 382, in make_page s+=query=f and db.t_%s[f]==v or None\n % (t,t) TypeError: not all arguments converted during string formatting -- Thadeus
[web2py] Request for a logo - PluginCentral
I am working on plugin central, finally have some free time to devote to the project. However I am a horrible artist, and wonder if anyone would like to help me with designing a logo? This is my color scheme White - body content #5E99E7 - Links main color (a light blue) #F5F4EF - Grey, page background I would like to use the new Ubuntu font since it is open source. -- Thadeus