Re: [web2py] Re: a new html editor
fixed, try now, thank you guys for feedback
[web2py] Re: requires questions
Thanks for the suggestion. I tried it but I was unable to make use of it. Your suggestion did force me to rethink the design so I discarded the full IS_MATCH string(can't even remember why I went for that), and simply kept the expression string itself (i.e. '^\\d{3}-\\d{4}-\ \d{4}-\\d{1}?$') And now it works and looks much cleaner without eval() ... requires=[IS_MATCH(str(db.agency[int(request.vars.issuer or 1)].regex)),CRYPT(auth.settings.hmac_key),IS_NOT_IN_DB(db,'card.id_number')] Thanks On May 7, 12:04 am, pbreit pbreitenb...@gmail.com wrote: Maybe the IS_EXPR() validator? IS_EXPR IS_EXPR Its first argument is a string containing a logical expression in terms of a variable value. It validates a field value if the expression evaluates to True. For example: 1. 2. requires = IS_EXPR http://web2py.com/book/default/docstring/IS_EXPR('int(value)%3==0', error_message=T http://web2py.com/book/default/docstring/T('not divisible by 3'))
[web2py] Re: skinning a cat ...
@Niphlod Yes, that would be interesting. On May 7, 4:09 am, Niphlod niph...@gmail.com wrote: go for raw sql if you need to, but be aware that that article was written in 2007, testing only MS SQL Server behaviour we are in 2011, MS SQL Server 2008 is on the run (and that article could be referring only to the 2000 or 2005 version)... Hopefully MS ingeneers have found (or will find) how to optimize different queries that lead to the same dataset in the exact same amount of time. I don't have the time to test right now, but at work I have to deal with MS SQL every day...if you want I can do some tests. right now I wonder also if it will be faster (I'm thinking exclusively to MS SQL) to do the same query again but using a different approach: left outer join and checking NULLs. Web2py implements a way to filter the data as you want (and give you a chance to use whatever raw query you want to)... it's database's engineers work to deal with this kind of optimization (or it's on you to use raw SQL, or to pick another database at all :-P) On 6 Mag, 18:12, pbreit pbreitenb...@gmail.com wrote: I didn't see EXISTS in dal.py:http://code.google.com/p/web2py/source/browse/gluon/dal.py That seems like it might be a tricky optimization to program but perhaps it's possible. You could also use raw sql:http://web2py.com/book/default/chapter/06#Raw-SQL
[web2py] Re: A requested feature...
Not exactly a deployment solution - but TurnKey Linux (http:// www.turnkeylinux.org/) would be a good foundation for Amazon EC2. There's already a TKLPatch for web2py framework (http:// www.turnkeylinux.org/forum/general/20110107/tklpatch-web2py-framework) which Massimo created (http://www.turnkeylinux.org/forum/general/ 20100217/web2py-appliance) but unfortunately there is still no web2py virtual appliance in the library. I didn't find the time to test TKL but this seems a great way to setup and operate web2py servers in the cloud: https://hub.turnkeylinux.org/ Marcel
[web2py] custom attributes
Massimo (or anyone who'd like to pitch in) You made this suggestion when I asked a question about a help system. Field('name',...) db.table.name.help = 'custom attribute' Could you please elaborate on this, and perhaps add a use case or example? Also, I was reading the code of register_other() of conf2py, and I found these 2 lines that I don't quite understand: db.auth_user.registered_by.default=auth.user.id record=db.auth_user(request.args(0) or 0,registered_by=auth.user.id) Why isregistered_by=auth.user.id supplied when it's already preceded by a line that tells the database that it should use auth.user.id as the default value. And I don't recall reading this convention of assigning values to a record being retrieved. / Nik
[web2py] Re: new code editor?
Loved it. I can think of skipping eclipse for small projects with this editor, which I cannot do with the current one (it's cool, but not that cool). On May 7, 7:34 pm, Shishir Ramam sra...@gmail.com wrote: the autocompletion (seemed to be setup only for javascript in the demo), is really cool! -shishir On Sat, May 7, 2011 at 8:13 AM, Bruno Rocha rochacbr...@gmail.com wrote: Will replace EditArea with this? On Sat, May 7, 2011 at 12:08 PM, Anthony abasta...@gmail.com wrote: On Saturday, May 7, 2011 10:36:34 AM UTC-4, Massimo Di Pierro wrote: http://codemirror.net/ In IE, EditArea has some weird behavior. CodeMirror seems to work in IE. -- Imagine there were no hypothetical situations.
Re: [web2py] Re: new code editor?
Last updated: Edit area: 2010-01-14 Codemirror: 2011-03-28 Go for codemirror. 2011/5/8 guruyaya guruy...@gmail.com Loved it. I can think of skipping eclipse for small projects with this editor, which I cannot do with the current one (it's cool, but not that cool). On May 7, 7:34 pm, Shishir Ramam sra...@gmail.com wrote: the autocompletion (seemed to be setup only for javascript in the demo), is really cool! -shishir On Sat, May 7, 2011 at 8:13 AM, Bruno Rocha rochacbr...@gmail.com wrote: Will replace EditArea with this? On Sat, May 7, 2011 at 12:08 PM, Anthony abasta...@gmail.com wrote: On Saturday, May 7, 2011 10:36:34 AM UTC-4, Massimo Di Pierro wrote: http://codemirror.net/ In IE, EditArea has some weird behavior. CodeMirror seems to work in IE. -- Imagine there were no hypothetical situations. -- http://martin.tecnodoc.com.ar
[web2py] Re: Chunked downloads and corrupt files with Internet Explorer 8 (IE8)
Sorry, no time for updates at the moment. Updated this project 2 times and every time it broke something. Haven't seen anything related to downloads, streaming etc. in the changelog, though. On May 6, 5:51 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you try 1.95.1 On May 6, 6:03 am, Stefan Scholl stefan.sch...@gmail.com wrote: The classicdownloadfunction: defdownload(): return response.download(request, db) I'm developing on localhost (127.0.0.1, no SSL) and one strange thing happened: Downloads in IE8 (Windows XP) were all corrupt/broken if they weren't below 64KiB in size. Very easy to see with large images. Using a higher value for the argument 'chunk_size' solves this problem, up to this new maximum. web2py 1.91.6
[web2py] How should I present the content?
Hello, I have bougt a web2py book (not read all yet) and I was wondering which client scripting tools is suitable to use for content presentation. I am callcenter designer (ACD switch programming) and want to create a webbased statistic page (pages actually) for incomming calls (and much more later on). Callcenter telephony system I am using has Informix DB as back-end and all data exist in DB. I am going to use web2py as skeleton, but I have not decide what to use for content presentation. I plan to use very much graphical presentation (charts). I am seasoned python programer but I have not worked with web programming so much. Is html5 with CSS3 enough or should I use even java-script? (Do not want use php!). I am very, very grateful for any suggestions. best regards Leon
[web2py] Re: new code editor?
The only problem is that codemirror lacks the toolbar that editarea provides (for searching, replace, zooming, highlighting, etc.) we would have to write one. On May 8, 7:06 am, Martín Mulone mulone.mar...@gmail.com wrote: Last updated: Edit area: 2010-01-14 Codemirror: 2011-03-28 Go for codemirror. 2011/5/8 guruyaya guruy...@gmail.com Loved it. I can think of skipping eclipse for small projects with this editor, which I cannot do with the current one (it's cool, but not that cool). On May 7, 7:34 pm, Shishir Ramam sra...@gmail.com wrote: the autocompletion (seemed to be setup only for javascript in the demo), is really cool! -shishir On Sat, May 7, 2011 at 8:13 AM, Bruno Rocha rochacbr...@gmail.com wrote: Will replace EditArea with this? On Sat, May 7, 2011 at 12:08 PM, Anthony abasta...@gmail.com wrote: On Saturday, May 7, 2011 10:36:34 AM UTC-4, Massimo Di Pierro wrote: http://codemirror.net/ In IE, EditArea has some weird behavior. CodeMirror seems to work in IE. -- Imagine there were no hypothetical situations. -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: new code editor?
I can help if you want ..
Re: [web2py] Re: new code editor?
I never used that toolbar, For me web IDE is for small editings. The development I like to do in VIM or Sublime Text. Guess we need to write just the search/replace functionalities. Em 08/05/2011 10:11, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: The only problem is that codemirror lacks the toolbar that editarea provides (for searching, replace, zooming, highlighting, etc.) we would have to write one. On May 8, 7:06 am, Martín Mulone mulone.mar...@gmail.com wrote: Last updated: Edit area: 2010-01-14 Codemirror: 2011-03-28 Go for codemirror. 2011/5/8 guruyaya guruy...@gmail.com Loved it. I can think of skipping eclipse for small projects with this editor, which I cannot do with the current one (it's cool, but not that cool). On May 7, 7:34 pm, Shishir Ramam sra...@gmail.com wrote: the autocompletion (seemed to be setup only for javascript in the demo), is really cool! -shishir On Sat, May 7, 2011 at 8:13 AM, Bruno Rocha rochacbr...@gmail.com wrote: Will replace EditArea with this? On Sat, May 7, 2011 at 12:08 PM, Anthony abasta...@gmail.com wrote: On Saturday, May 7, 2011 10:36:34 AM UTC-4, Massimo Di Pierro wrote: http://codemirror.net/ In IE, EditArea has some weird behavior. CodeMirror seems to work in IE. -- Imagine there were no hypothetical situations. -- http://martin.tecnodoc.com.ar
[web2py] Error-message from the GoogleAppEngineLauncher
Hi, I want to try web2py together with the GAE. At first I have installed GoogleAppEngine-1.4.3.msi and I got the following log-file (GoogleAppEngineLauncher.exe.log): Traceback (most recent call last): File GoogleAppEngineLauncher.py, line 42, in module File wx\_core.pyc, line 7913, in __init__ File wx\_core.pyc, line 7487, in _BootstrapApp File launcher\app.pyc, line 53, in OnInit File launcher\app.pyc, line 97, in _CreateModels File launcher\maintable.pyc, line 35, in __init__ File launcher\maintable.pyc, line 86, in _LoadProjects File launcher\project.pyc, line 63, in ProjectWithConfigParser File launcher\project.pyc, line 260, in _LoadFromConfigParser File ConfigParser.pyc, line 520, in get ConfigParser.NoOptionError: No option 'name' in section: '1' There are several Python versions on my computer: 2.5, 2.7, 3.2, but the install-program has found version 2.5. Any ideas what went wrong? Regards, Martin
[web2py] Like inside query
Hello, How can i use Like operator in the following example: query = name Like somthing db(query).select() I can directly do the following: db(db.member.name.like('%'+form.vars.filter2_value+'%')).select() But how can i do that by using query?? Thanks in Advance
[web2py] Re: How should I present the content?
Keep it simple. Start with HTML and CSS and see how far you get. Then consider layering in JavaScript and Jquery. For charting, you either need to generate the images in Web2py and server them as GF.JPG/etc or use a Javascript-based charting library (ex: http://www.reynoldsftw.com/2009/02/6-jquery-chart-plugins-reviewed/).
[web2py] Re: Like inside query
Perhaps: query = db.member.name.like('%'+form.vars.filter2_value+'%')
[web2py] Re: A requested feature...
Could be interesting if they have made mostly good config decisions. The LAMP or LAPP stack gets you almost all the way there. Then only a few lines of script to install Web2py. I might give it a try but I'm not sure I want to use their hub or Amazon.
[web2py] Re: Can web2py support chaining response.files inside a component?
Hi Anthony, I have to say, your proposal is logically correct. Good hint! Furthermore, I find a more appropriate place to add those code. That place is generic.load. However, my complicated action index contains multi components, some are even duplicated. Then after I deploy the new generic.load, the index page's appearance or behavior is not 100% correct. I guess that is caused by duplicated and/or improper location of those component cssjs files. Experiment abort. :-( Regards, Iceberg On May 8, 2:24 am, Anthony abasta...@gmail.com wrote: I see. One option might be to include code in your component.load view that makes use of the component's response.files, just like the code in web2py_ajax.html. For example, in component.load include: {{ for _k,_file in enumerate(response.files or []): if _file in response.files[:_k]: continue _file0=_file.lower().split('?')[0] if _file0.endswith('.css'):}} link href={{=_file}} rel=stylesheet type=text/css /{{ elif _file0.endswith('.js'):}} script src={{=_file}} type=text/javascript/script{{ pass pass }} The above will link your component's css and js files in the component HTML, which will be inserted in your 'index' page (give that you have ajax=False). If you don't want to repeat that code in all your .load views, you can probably create a function in a model file or module and just call the function from your views. Anthony On Saturday, May 7, 2011 12:01:44 PM UTC-4, Iceberg wrote: Thank you Anthony for your comments and here comes my clarification. You are right that, adding response.files within a component, has no effect at all when called by component.load. But I still keep a copy of those response.files inside the component, because they are needed when visiting component.html (during developing or debugging phase). On the other hand, when we have to copy those response.files in action skeleton or action index, that does not feel elegant, because action index has to explicitly include some helper resources which not needed by itself. Imagine that, after I change implementation of component later, I have to modify index also. Grrr. Pbreit's suggestion is what I can do right now (thank you Pbreit too), it is DRY, but still not solving the unnecessary coupling mentioned above. Regards, Iceberg On May 7, 11:04 pm, Anthony abas...@gmail.com wrote: Does adding to response.files within a component controller work at all? With ajax=False, it looks like LOAD creates a new environment (and response) to run the component controller, so I'm not sure appending to response.files within a component controller will affect the response.files of the parent controller. response.files is only used by web2py_ajax.html, which is typically included in layout.html. Your index view probably extends layout.html, so response.files added within the index controller will get included by web2py_ajax.html. However, your component .load views probably do not extend layout.html, so I would guess response.files added within component controllers would be ignored. Haven't tried it, though, so I may be missing something. Anthony On Saturday, May 7, 2011 9:52:27 AM UTC-4, Iceberg wrote: Hi Massimo, Can web2py support chaining response.files inside a component? Scenario. def component(): response.files.extend([ URL(..., 'fancy_helper1.js'), URL(..., 'fancy_helper2.js'), .., URL(..., 'fancy_helper10.js'), ]) return {'': 'Some fancy stuff'} def skeleton(): response.files.extend([ URL(..., 'fancy_helper1.js'), URL(..., 'fancy_helper2.js'), .., URL(..., 'fancy_helper10.js'), ]) # SAME AS THOSE IN component(). Can I omit this? return {'': LOAD('default', 'component.load', ajax=False)} def index(): response.files.extend([ URL(..., 'fancy_helper1.js'), URL(..., 'fancy_helper2.js'), .., URL(..., 'fancy_helper10.js'), ]) # SAME AS THOSE IN component(). Can I omit this? return {'': LOAD('default', 'skeleton.load', ajax=False)} Currently, if I add one more helper_extra.js into my fancy component(), I needed to duplicate them into skeleton() and index(). It is not DRY. Can it be improved? Regards, Ray Luo (Iceberg)
Re: [web2py] Re: Like inside query
db.member.name.contains(form.vars.filter2_value)
Re: [web2py] Re: Like inside query
or if you are asking how to execute sql queries rows = db.executesql(SELECT * FROM member WHERE name like '%+form.vars.somefilter+%', as_dict=True)
[web2py] queries in Views without breaking MVC
Hi All, Let's expand little bit the example of the book. I have Persons and Dogs. A person can have several Dogs. A Dog can be connected to his owner (Person) and to the Person that it has bitten to !... In my view I'd like to show a table with one Person per row. In the first column I would have the Person name, in the second column the Person dogs and for each Dog I'd like to show also the Persons that the dog has bitten to. Of course I could retrieve the persons in the controller with db().select(db.person.ALL) and in the view I could loop it and use other queries... I don't like to do that as I do not want to break the MVC and I don't want to do DB queries from the View Another option is to build a new structure in the controller or from the view call some helper function what do you guys use in these kind of situations ? thanks -- Sebastian E. Ovide
Re: [web2py] Re: How should I present the content?
Hello, Thanks for advice pbreit! I would like to use rrdtools but do not know if it's possible only with HTML5/CSS5. But true as you said, KIS and see how far I get thanks! regards Leon On 8 maj 2011 18:41 pbreit pbreitenb...@gmail.com pbreitenb...@gmail.com wrote: Keep it simple. Start with HTML and CSS and see how far you get. Then consider layering in JavaScript and Jquery. For charting, you either need to generate the images in Web2py and server them as GF.JPG/etc or use a Javascript-based charting library (ex: http://www.reynoldsftw.com/2009/02/6-jquery-chart-plugins-reviewe d/).
[web2py] Web2py and message queue's
Hi all, In the app I am developing I want to include messaging which would allow users to send messages to single users or make a broadcast to multiple users. I have a database for the messages which for now would only be simple text, no video or pictures. I would like to know the best way I can go about implementing this. For now, this is how I think it should work, the user composes the message and sends it, the message is inserted into the messages table of the sender and also inserted into the messages table of the recipient/recipients. I have some misgivings about this, because if the number of recipients are very many, that means alot of INSERTS would be done which might bog down my server. I have been thinking about using a MESSAGE QUEUE for this. I need advice/tips. I am stuck
[web2py] Re: How should I present the content?
RRDTools generates static images so HTML and CSS would work just fine to start. Matt On May 8, 2:37 pm, Leon Chop l...@datadesign.se wrote: Hello, Thanks for advice pbreit! I would like to use rrdtools but do not know if it's possible only with HTML5/CSS5. But true as you said, KIS and see how far I get thanks! regards Leon On 8 maj 2011 18:41 pbreit pbreitenb...@gmail.compbreitenb...@gmail.com wrote: Keep it simple. Start with HTML and CSS and see how far you get. Then consider layering in JavaScript and Jquery. For charting, you either need to generate the images in Web2py and server them as GF.JPG/etc or use a Javascript-based charting library (ex: http://www.reynoldsftw.com/2009/02/6-jquery-chart-plugins-reviewe d/).
[web2py] Re: new code editor?
On Sunday, May 8, 2011 9:11:26 AM UTC-4, Massimo Di Pierro wrote: The only problem is that codemirror lacks the toolbar that editarea provides (for searching, replace, zooming, highlighting, etc.) we would have to write one. EditArea toggling to full screen mode is nice too.
[web2py] Re: custom attributes
On Sunday, May 8, 2011 7:25:26 AM UTC-4, niknok wrote: Massimo (or anyone who'd like to pitch in) You made this suggestion when I asked a question about a help system. Field('name',...) db.table.name.help = 'custom attribute' I think the idea above is that you can add arbitrary attributes to any Field object and use them for whatever purpose you need. Also, I was reading the code of register_other() of conf2py, and I found these 2 lines that I don't quite understand: db.auth_user.registered_by.default=auth.user.id record=db.auth_user(request.args(0) or 0,registered_by=auth.user.id) Why isregistered_by=auth.user.id supplied when it's already preceded by a line that tells the database that it should use auth.user.id as the default value. And I don't recall reading this convention of assigning values to a record being retrieved. The above is not assigning a value to registered_by -- it is simply a shortcut way to do a query to retrieve a record (registered_by=auth.user.id is a condition that must be met). See http://web2py.com/book/default/chapter/06#Fetching-a-Row. Anthony
[web2py] Language selection
Hello, I wonder if it is possible to force to use an specific language, while web2py perform the translation automatically based on user's browser language. This means that although, we use as a default language browser English we can choose our application in Spanish or Italian (ej: http://myapp/es/some/) you will see the translation into Spanish and if you choose (ej http://myapp/it/some/) you will see the translation into Italian without change our default language browser. I've been testing with the file routes.py, if anyone knows how to do it would be helpful. Ej: routes.py . . . routers = dict ( BASE = dict (default_application = 'myapp') myapp = dict (languages = ['en ', 'it',' es',' es-es', 'it-it'], default_language = 'en'), ) . . Thanks Miguel
[web2py] Re: Can web2py support chaining response.files inside a component?
On Sunday, May 8, 2011 1:27:00 PM UTC-4, Iceberg wrote: Hi Anthony, I have to say, your proposal is logically correct. Good hint! Furthermore, I find a more appropriate place to add those code. That place is generic.load. However, my complicated action index contains multi components, some are even duplicated. Then after I deploy the new generic.load, the index page's appearance or behavior is not 100% correct. I guess that is caused by duplicated and/or improper location of those component cssjs files. Oops, now that I think about it, I suppose this won't work for css files, as I believe they must be linked within the head of the document. Instead of linking, you might be able to import the css files using @import inside a style tag -- technically I don't think it's valid HTML to have a style tag inside the body, but supposedly it works in most browsers. Anthony
[web2py] Re: new code editor?
If you send me a patch with search/replace/full-screen/save buttons + {ctrl}+S, I will include codemirror. You need trunk since stable codemirror has no python support. On May 8, 8:35 am, Vasile Ermicioi elff...@gmail.com wrote: I can help if you want ..
[web2py] Recaptcha and registration
My application uses Recaptcha for user registration: auth.settings.register_captcha = Recaptcha(request,session.CAPTCHA_public,session.CAPTCHA_private) At some point, this has stopped working. My registration page gets the Verify: title, but no Recaptcha form with it. If I don't set auth.settings.register_captcha, I don't get the Verify: title. So, it appears web2py is picking up on the idea that I want Recaptcha on my registration page, but the Recaptcha form itself doesn't show up for some reason. I did verify my keys with www.recaptcha.net to make sure they are correct. I don't see any other errors or messages to give a clue. I'm currently running web2py from source version 1.95.1 on Windows XP. Any ideas what to do to debug/solve this?
[web2py] Re: Web2py and message queue's
I don't have a whole lot of help for you but it does seem that at some point, this type of application demands asynchronous processing. I had modest luck with the Background Process outlined here but eventually switched to per minute cron jobs: http://web2py.com/book/default/chapter/04#Background-Processes-and-Task-Queues At some point it would be great of Web2py was easily connectable to Celery (http://celeryproject.org/) or some sort of Delayed Job (https://github.com/tobi/delayed_job). You could either define a queue table or use a status field in your messages table. The benefit of a separate table is you can delete tasks as they are completed making the db(status='new').select() much faster. If you are up for a project, I was just reading about Redis today (http://redis.io/download). Although not currently supported by DAL (and I'm not sure if it could be shoe-horned in given some of its unique features), it's easy to get started: https://github.com/andymccurdy/redis-py The sample project is a twitter clone: http://redis.io/topics/twitter-clone and there is a Python port: https://github.com/pims/retwis-py
Re: [web2py] Recaptcha and registration
yes, recaptcha URLs are changed and 1.95.1 doesn't have the fix but they are in trunk http://code.google.com/p/web2py/source/browse/gluon/tools.py or you can change the URL by yourself, new ones are API_SSL_SERVER = 'https://www.google.com/recaptcha/api' API_SERVER = 'http://www.google.com/recaptcha/api' VERIFY_SERVER = 'http://www.google.com/recaptcha/api/verify'
[web2py] Updating the property of an upload field on GAE
Within my web2py app, I am using the pygooglechart module to create .png files for QRCodes to display the url to audio files like these: http://publicradioroadtrip.appspot.com/publicradioroadtrip/default/view_collection/383010 This all works great on my local computer, however, when I try to deploy this on Google App Engine, I am getting .png files with sizes of 0 bytes. I have a story table with a qrcode property (an upload field) which I update programmatically using: myset = db(db.story.id == story_id) myset.update(qrcode = db.story.qrcode.store(opener, filename)) You can see the full code here: http://code.google.com/p/publicradioroadtrip/source/browse/controllers/default.py?r=f8f86339376c671ef77501abf7d9e0ffbc04c07e#83 I realize that you cannot write to the filesystem using GAE, but I was under the impression that there were ways of getting around this restriction by storing the data into an upload field. Does anyone have any ideas on why I would be generating image files with sizes of 0 bytes on GAE and how I might resolve this issue?