Re: [web2py] Re: How to start web2py server permanently
Thank you Rahul... Its worked fine. Thanks once again for your help. On Tue, Jun 7, 2011 at 7:12 AM, Rahul rahul.dhak...@gmail.com wrote: Alternately, you can use the nohup command if you have shell access. Like nohup python web2py.py - a'recycle' -i ip of your site -p port This will last till your server machine is re-booted. If it has, it will terminate. Cheers, Rahul On Jun 6, 11:58 pm, danto web2py.n...@gmail.com wrote: 2011/6/6 Pradeesh pradeeshnara...@gmail.com I have installed web2py on a remote opensuse server 10.3 and I am using a Putty to start the web2py server. But when i am closing the Putty session in my machine, the web2py server is also closing. How do I start web2py server permanantly. you should set up a server as cherokee, apache or nginx. but for what you say, run 'screen' and then web2py on it. exit with ctrl+a+d
Re: [web2py] Re: How to start web2py server permanently
On 07/06/2011 08:00, pradeesh narayan wrote: Thank you Rahul... Its worked fine. Thanks once again for your help. you got another chance here http://www.web2py.com/book/default/chapter/11#Start-as-Linux-Daemon Manuele
[web2py] Re: SyntaxError: Object exists and cannot be redefined: lunid
On Monday, June 6, 2011 9:15:27 PM UTC-4, Gwayne aka Mike Veltman wrote: And that was it... Thank you very much. Mmmm, this should go in the book.. There's also this method of pre-populating a form field: http://web2py.com/book/default/chapter/07#Pre-populating-the-form Yes I know, but I did read in the mailing list that that was not a smart idea. Also those vars do not exist before I create the form. So you would get a error if you do so. I still have one problem that if I do keepvalues=True it will not override. So there I probably have to use the form.vars.name = fieldvalue trick Lets test that. With regards, Mike Veltman
[web2py] Counter based on fields being true or false.
In db.py I have the following table: db.define_table('function', Field('company_id',db.company,default='',notnull=True,writable=False,readable=False), Field('home',type='boolean',default=True,writable=False), Field('logo',type='boolean',default=False), Field('tagline',type='boolean',default=False), Field('image',type='boolean',default=False), Field('text',type='boolean',default=False), Field('css',type='boolean',default=False), Field('customcss',type='boolean',default=False), Field('keywords',type='boolean',default=False), Field('counter',type='integer',default=1), migrate=False) In a cms the administrator makes functions available to users by (un)checking them. Now the counter should keep track of the number of checked functions. The cms function: def functions(): db.function.company_id.default=id form=crud.update(table=db.function,record=row,next=URL\ (r=request,f='home',args='updated'),message=message) return dict(form=form) Is there a validator available to update the counter or is this best solved in JavaScript. If so, I hope one of you can provide me with an example, because I don't know much about JavaScript. Kind regards, Annet.
[web2py] Re: request.is_local
Does it work if ajxa=True? What are the [0][0] for?
[web2py] Re: request.is_local
ajax=True ofcourse doesn't work, because it's loads after response page. [0][0] is to unwrap loaded content On 7 июн, 13:43, pbreit pbreitenb...@gmail.com wrote: Does it work if ajxa=True? What are the [0][0] for?
[web2py] Earn $1000-$2500 per month
Earn $1000-$2500 per month If you Register your name You Get Sign-up bonus $5 AND Get $.20 cent for each referral. Further details http://www.earnbyforex.com/index.php?id=35678365
[web2py] Re: How to start web2py server permanently
if you want to make sure that web2py starts again shortly after a crash you can use this script http://www.web2pyslices.com/main/slices/take_slice/97 On Jun 6, 6:47 pm, Pradeesh pradeeshnara...@gmail.com wrote: I have installed web2py on a remote opensuse server 10.3 and I am using a Putty to start the web2py server. But when i am closing the Putty session in my machine, the web2py server is also closing. How do I start web2py server permanantly.
[web2py] Re: request.is_local
I don't think calls to LOAD are local requests (even with ajax=False) -- the call to LOAD simply passes the original request environment to the component controller action. What you need is a way to determine if a request has come in via a call to LOAD. In that case, request.env should include http_web2py_component_location (as well as http_web2py_component_element), so you could test for that: def some_block(): if request.env.http_web2py_component_location: do_smth() return dict(smth=smth) else: return None Anthony On Tuesday, June 7, 2011 1:32:43 AM UTC-4, LightOfMooN wrote: What is logic of request.is_local? I tried use it to prevent direct access to some included blocks: def index(): return dict() def some_block(): if request.is_local: do_smth() return dict(smth=smth) else: return None index.html: {{=LOAD('mycontroller', 'some_block', ajax=False)[0][0]}} so, I thought, web2py load function with ajax=False is called locally, and content of some_block will be available in index.html, but not by url /mycontroller/some_block.html But request.is_local returns False. Is there any other way to do it? (check some secret vars or args is not good)
Re: [web2py] Re: SyntaxError: Object exists and cannot be redefined: lunid
On Tuesday, June 7, 2011 2:26:45 AM UTC-4, Gwayne aka Mike Veltman wrote: On Monday, June 6, 2011 9:15:27 PM UTC-4, Gwayne aka Mike Veltman wrote: And that was it... Thank you very much. Mmmm, this should go in the book.. There's also this method of pre-populating a form field: http://web2py.com/book/default/chapter/07#Pre-populating-the-form Yes I know, but I did read in the mailing list that that was not a smart idea. I wasn't aware of that. Why is it not a smart idea? Also those vars do not exist before I create the form. So you would get a error if you do so. But is there any reason you couldn't make the assignment right after the form is created (i.e., instead of assigning a new default right before the form creation, assign a value to the form var right after creation)? Anthony
[web2py] small bug in 1.96.3
Hello, it seems in latest web2py version, gluon/utils.py, line 93, logging is used with no import .. Regards, G.
Re: [web2py] small bug in 1.96.3
2011/6/7 Gabriele Alberti gabriele.albe...@gmail.com Hello, it seems in latest web2py version, gluon/utils.py, line 93, logging is used with no import .. Regards, G. I think they already know about it. At this moment, solution is just do an 'import logging' in that 'except'
[web2py] Re: request.is_local
Note, you can probably even use an auth decorator, similar to checking for ajax-loaded components via request.cid (see http://www.web2py.com/book/default/chapter/13#Trapped-Ajax-Links). @auth.requires(request.env.http_web2py_component_location) def some_block(): Also, note that testing for request.env.http_web2py_component_location is not a foolproof security measure -- I think it can be spoofed by simply adding 'web2py-component-location' to the HTTP request headers (same goes for testing for request.cid). Anthony On Tuesday, June 7, 2011 8:26:56 AM UTC-4, Anthony wrote: I don't think calls to LOAD are local requests (even with ajax=False) -- the call to LOAD simply passes the original request environment to the component controller action. What you need is a way to determine if a request has come in via a call to LOAD. In that case, request.env should include http_web2py_component_location (as well as http_web2py_component_element), so you could test for that: def some_block(): if request.env.http_web2py_component_location: do_smth() return dict(smth=smth) else: return None Anthony On Tuesday, June 7, 2011 1:32:43 AM UTC-4, LightOfMooN wrote: What is logic of request.is_local? I tried use it to prevent direct access to some included blocks: def index(): return dict() def some_block(): if request.is_local: do_smth() return dict(smth=smth) else: return None index.html: {{=LOAD('mycontroller', 'some_block', ajax=False)[0][0]}} so, I thought, web2py load function with ajax=False is called locally, and content of some_block will be available in index.html, but not by url /mycontroller/some_block.html But request.is_local returns False. Is there any other way to do it? (check some secret vars or args is not good)
[web2py] Draw Tabs with one form
Hello, I have table has 30 field, so for readability i want to using tabs and each tab include 10 fields and allow the user to switch between them and at the end there is one save button for all tabs that will insert a new record. How can i do that?? Thanks in Advance
[web2py] Re: How to not show the delete file checkbox
As Anthony said, to avoid showing the delete checkbox just do something like this: Field('pic', 'upload', requires=IS_IMAGE()), On Jun 6, 6:31 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: I understand your need!! I just don't know neither how to do it... It was the only piece of the book I come up with after few reading and searching... I thought the option could make the file/delete box to desapered... Work around could to use jQuery to make the whole block to desapeare... Just look to the source html render view to know what the ID of the div or other element it could be and add this jQuery into your view : $(.class or .id).remove(); Richard On Mon, Jun 6, 2011 at 12:38 PM, Luis Goncalves lgoncal...@gmail.comwrote: Hi Richard! I'm displaying the form to the user for them to update it. There are several fields in the form, and one of them is an image ('upload' field). I just don't want to display the delete file checkbox for the image, so that the user can't delete the image. They can upload a new one, but they can't delete it to not have an image. The record itself is not to be deleted either, but that's not even an option for the user right now. Thanks!! Luis
Re: [web2py] Re: web2py 1.96.1 is OUT
I have fixed the problem adding the following code in one of my models: import os os.environ['PYTHONCASEOK'] = '1' It makes ignore path case on operating systems with case-insensitive file-systems (namely Win32 and OS/X with the default fs). Do you think it should be added, with a proper os test, to the importer code? On 6/6/11 21:35 , Pierre Thibault wrote: 2011/6/6 Alessandro Iob alessandro@gmail.com mailto:alessandro@gmail.com No, it does not work. And the problem is not related to the *_DateTrackerImporter as I'm not using the track_changes options.* **I've made some tests and I've found that in _Web2pyImporter.__call__ the code reaches the import like 'from x import a, b, ...' section with the vars set to: name = selfgroup.castalia caller_file_name = C:\w2p\web2py\applications\castalia\controllers/default.py self.web2py_path = C:\w2p\web2py match_app_dir = _sre.SRE_Match object at 0x018B7420 modules_prefix = applications.castalia.modules module_prefix + '.' + name = applications.castalia.modules.selfgroup.castalia fromlist = ('config',) level = -1 then the call to super(_Web2pyImporter, self).__call__( modules_prefix+.+name, globals, locals, fromlist, level ) raises the ImportError exception (No module named castalia.modules.selfgroup.castalia). The sys.path seems correct: ['', 'C:\\w2p\\web2py\\site-packages', 'C:\\w2p\\web2py', 'C:\\w2p\\web2py\\gluon', 'C:\\w2p\\web2py\\library.zip'] No clue. When you are using Castalia as the name of your application, is all code values above appears with castalia in lower case? -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com) http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib) http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: How to start web2py server permanently
If you are running Ubuntu (or using the Upstart init daemon) you can create an Upstart conf file in /etc/init/ like so: # tldisplayclient - start web2py web server description start web2py web server start on startup exec sudo -u system user /usr/bin/python /opt/display/web2py.py -i ip address -a password Matt On Jun 7, 12:18 am, Manuele Pesenti manuele.pese...@gmail.com wrote: On 07/06/2011 08:00, pradeesh narayan wrote: Thank you Rahul... Its worked fine. Thanks once again for your help. you got another chance herehttp://www.web2py.com/book/default/chapter/11#Start-as-Linux-Daemon Manuele
Re: [web2py] Re: web2py 1.96.1 is OUT
2011/6/7 Alessandro Iob alessandro@gmail.com I have fixed the problem adding the following code in one of my models: import os os.environ['PYTHONCASEOK'] = '1' It makes ignore path case on operating systems with case-insensitive file-systems (namely Win32 and OS/X with the default fs). Do you think it should be added, with a proper os test, to the importer code? No. Now that we know the problem, or that we have enough information to easily locate the lines of code in problem, we can fix these lines. We need someone who can do it on Windows. I don't like the idea of global change of the Python environment. A local fix is far better solution and it should not very difficult to do in this case. Thank you for your collaboration. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: BUG?: Funny Bug with LOAD;
if this is fixed properly it could also fix http://code.google.com/p/web2py/issues/detail?id=271 :D On Jun 4, 2:19 am, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: tracked inhttp://code.google.com/p/web2py/issues/detail?id=285 On Sat, Jun 4, 2011 at 12:53 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: please open an issue on google code On Jun 3, 1:53 pm, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: you are right, with ajax=True it doesn't work On Fri, Jun 3, 2011 at 7:35 PM, David J. da...@styleflare.com wrote: Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide -- Sebastian E. Ovide -- Sebastian E. Ovide
Re: [web2py] Draw Tabs with one form
had you already normalize your database table? On Tue, Jun 7, 2011 at 9:03 PM, Neveen Adel nevo.a...@gmail.com wrote: Hello, I have table has 30 field, so for readability i want to using tabs and each tab include 10 fields and allow the user to switch between them and at the end there is one save button for all tabs that will insert a new record. How can i do that?? Thanks in Advance
[web2py] Re: request.is_local
thank you On 7 июн, 19:50, Anthony abasta...@gmail.com wrote: Note, you can probably even use an auth decorator, similar to checking for ajax-loaded components via request.cid (seehttp://www.web2py.com/book/default/chapter/13#Trapped-Ajax-Links). @auth.requires(request.env.http_web2py_component_location) def some_block(): Also, note that testing for request.env.http_web2py_component_location is not a foolproof security measure -- I think it can be spoofed by simply adding 'web2py-component-location' to the HTTP request headers (same goes for testing for request.cid). Anthony On Tuesday, June 7, 2011 8:26:56 AM UTC-4, Anthony wrote: I don't think calls to LOAD are local requests (even with ajax=False) -- the call to LOAD simply passes the original request environment to the component controller action. What you need is a way to determine if a request has come in via a call to LOAD. In that case, request.env should include http_web2py_component_location (as well as http_web2py_component_element), so you could test for that: def some_block(): if request.env.http_web2py_component_location: do_smth() return dict(smth=smth) else: return None Anthony On Tuesday, June 7, 2011 1:32:43 AM UTC-4, LightOfMooN wrote: What is logic of request.is_local? I tried use it to prevent direct access to some included blocks: def index(): return dict() def some_block(): if request.is_local: do_smth() return dict(smth=smth) else: return None index.html: {{=LOAD('mycontroller', 'some_block', ajax=False)[0][0]}} so, I thought, web2py load function with ajax=False is called locally, and content of some_block will be available in index.html, but not by url /mycontroller/some_block.html But request.is_local returns False. Is there any other way to do it? (check some secret vars or args is not good)
[web2py] Re: Using web2py's view/template engine in a standalone application
For future reference, this has been resolved with revision a1619d2857e5 in the mercurial repository. As mentioned before, simply include just the gluon/template.py file from web2py, then use it similar to the following example. example.py ~ from template import render renderedText = render( filename='/path/to/view.html', context=dict( foo=bar ) ) ~ View content is usually escaped, but if you run it standalone, you can break out of escaping with the helper NOESCAPE(). Here's an example: view.html ~ html body {{= NOESCAPE( foo ) }} /body /html ~ Thanks for everyone's help on this! On Jun 6, 3:05 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: somebody email me the patch. :-) On Jun 6, 1:26 pm, Thadeus Burgess thade...@thadeusb.com wrote: 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:
[web2py] search text inside html - using html.elements find
Hi, i am trying to search inside html data, which i get from DB(sqllite). Everythink works well, but if i try to search for 'äöü', i get no match. #before ö - ouml; data = 'apersouml;nliche bitte/a' # data from db created with wysiwyg editor html = TAG(data) #after ouml; - ? el_list = html.elements(find=re.compile('persouml;nliche', re.IGNORECASE)) or html.elements(find=re.compile('persönliche', re.IGNORECASE)) Can anybody tell me what i am doing wrong? Thanks in advance, paul
[web2py] Re: search text inside html - using html.elements find
You will need to encode utff8 and I am not sure how to encode utf8 in regex. On Jun 7, 11:46 am, pubu p.dirck...@googlemail.com wrote: Hi, i am trying to search inside html data, which i get from DB(sqllite). Everythink works well, but if i try to search for 'äöü', i get no match. #before ö - ouml; data = 'apersouml;nliche bitte/a' # data from db created with wysiwyg editor html = TAG(data) #after ouml; - ? el_list = html.elements(find=re.compile('persouml;nliche', re.IGNORECASE)) or html.elements(find=re.compile('persönliche', re.IGNORECASE)) Can anybody tell me what i am doing wrong? Thanks in advance, paul
[web2py] Re: Draw Tabs with one form
You could have a look at Jquery UI tabs: http://jqueryui.com/demos/tabs/
[web2py] web2py 1.96.4 is OUT
Many big fixes compared with 1.96.3. In particular: - explicitly closing all open files (should make it work in Pypy), thanks Caleb - even better security in uuid (thanks Jonathan and David) - template decoupled from web2py, thanks Ryan - fixed a typo on Oracle nested selects - better support for id fields not called id - auto import should work on windows (now on windows ignore will ignore case by default)
[web2py] Authentication using xmlrpc
Hello, I have an application in web2py. To create the command line interface of the gui (web-interface), I want to use xmlrpc service. For example if I have following function : @auth.requires_login def example(): temp = request.args[0] //do something on temp return dict(temp=temp) How can I call this function in xmlrpc, so that I make minimal changes in my original function definition (I require to do authentication, somehow send the request variable, and have some returned data structure).
Re: [web2py] web2py 1.96.4 is OUT
2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com - auto import should work on windows (now on windows ignore will ignore case by default) I don't like this solution. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] web2py 1.96.4 is OUT
2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com Many big fixes compared with 1.96.3. In particular: - explicitly closing all open files (should make it work in Pypy), thanks Caleb - even better security in uuid (thanks Jonathan and David) - template decoupled from web2py, thanks Ryan - fixed a typo on Oracle nested selects - better support for id fields not called id - auto import should work on windows (now on windows ignore will ignore case by default) I tried to upgrade from the web interface at my local installation and seem to break something, raising me an error. I found this in the admin app error log: 1. 2. 3. 4. 5. 6. 7. Traceback (most recent call last): File /home/danto/web2py/gluon/restricted.py, line 184, in restricted passed to RestrictedError to identify where the error occurred. File /home/danto/web2py/applications/admin/models/access.py, line 2, in module from gluon.fileutils import read_file ImportError: cannot import name read_file anyway, I restarted the server through the shell and when I back session.flash show me that I'm on 1.94, but was wierd
[web2py] A simple app with Google Maps API
Hello guys, Last year I made a small application to start my studies in web2py, with the help of Massimo I did deploy in the Google App Engine [1]. Now I realize that not released the code, then, for those who want to use for their studies, or implement in any app, the code is available on github now [2]. Is a very simple example of the Google Maps Api use, still have to apply some changes suggested and create other features. Pull Requests are welcome. :) [1] http://web2pyople.appspot.com/ [2] http://github.com/relsi/web2pyople
Re: [web2py] web2py 1.96.4 is OUT
2011/6/7 danto web2py.n...@gmail.com 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com Many big fixes compared with 1.96.3. In particular: - explicitly closing all open files (should make it work in Pypy), thanks Caleb - even better security in uuid (thanks Jonathan and David) - template decoupled from web2py, thanks Ryan - fixed a typo on Oracle nested selects - better support for id fields not called id - auto import should work on windows (now on windows ignore will ignore case by default) I tried to upgrade from the web interface at my local installation and seem to break something, raising me an error. I found this in the admin app error log: 1. 2. 3. 4. 5. 6. 7. Traceback (most recent call last): File /home/danto/web2py/gluon/restricted.py, line 184, in restricted passed to RestrictedError to identify where the error occurred. File /home/danto/web2py/applications/admin/models/access.py, line 2, in module from gluon.fileutils import read_file ImportError: cannot import name read_file anyway, I restarted the server through the shell and when I back session.flash show me that I'm on 1.94, but was wierd *I mean I'm on 1.96.4
[web2py] Re: Authentication using xmlrpc
Have you seen this section in the book: http://web2py.com/book/default/chapter/09#Services-and-Authentication On Tuesday, June 7, 2011 4:25:16 PM UTC-4, Abhishek Gupta wrote: Hello, I have an application in web2py. To create the command line interface of the gui (web-interface), I want to use xmlrpc service. For example if I have following function : @auth.requires_login def example(): temp = request.args[0] //do something on temp return dict(temp=temp) How can I call this function in xmlrpc, so that I make minimal changes in my original function definition (I require to do authentication, somehow send the request variable, and have some returned data structure).
Re: [web2py] Re: SQL help
Thanks all. I was looking for the SQL IN operator in web2py. It is called belongs as marin and pbreit mentioned.
[web2py] Re: web2py 1.96.4 is OUT
What do you propose? I do not like it very much either. On Jun 7, 3:33 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com - auto import should work on windows (now on windows ignore will ignore case by default) I don't like this solution. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: Optimising web2py for GAE
i assert that there is something hidden in your code base that is causing the slow response - what is in your models? are they taking a long time to load? i have had problems where i was doing things in models (initializing global variables) that caused my app to start hanging when i was doing to much of that. cfh
Re: [web2py] Re: web2py 1.96.4 is OUT
good job, everyone, hope web2py improve day by day, thank you so much. \(^o^)/
[web2py] Query DB from a python script
Hello all. I am using web2py to generate a form and save the information in a DB. User puts the information on the form and the information gets saved in the DB sqlite. I want to be able query the DB and get the information the from the user input. = file DB.PY looks like this: ... db=DAL(sqlite://db.db) db.define_table('fw', Field('dst_ip'), ... = I am trying to connect to the DB like this: from gluon.sql import * db=DAL('sqlite://fw.db') but it does not appear to be working = How do I write a python script to be able to print the information from the user input from the form stored in the DB? it works when I query the DB direclty from inside the Web2py Controllers Shell rows = db(db.fw).select() dest_ip_string ='%s' % rows[1]['dst_ip'] Thank You
[web2py] Re: Query DB from a python script
Try this from gluon import DAL db=DAL('sqlite://fw.db',folder='applications/app/ databases',auto_import=True) rows = db(db.fw).select() dest_ip_string ='%s' % rows[1].dst_ip On Jun 7, 5:22 pm, chewbacca rru...@gmail.com wrote: Hello all. I am using web2py to generate a form and save the information in a DB. User puts the information on the form and the information gets saved in the DB sqlite. I want to be able query the DB and get the information the from the user input. = file DB.PY looks like this: ... db=DAL(sqlite://db.db) db.define_table('fw', Field('dst_ip'), ... = I am trying to connect to the DB like this: from gluon.sql import * db=DAL('sqlite://fw.db') but it does not appear to be working = How do I write a python script to be able to print the information from the user input from the form stored in the DB? it works when I query the DB direclty from inside the Web2py Controllers Shell rows = db(db.fw).select() dest_ip_string ='%s' % rows[1]['dst_ip'] Thank You
[web2py] Re: Query DB from a python script
make sure you have the most recent web2py On Jun 7, 5:22 pm, chewbacca rru...@gmail.com wrote: Hello all. I am using web2py to generate a form and save the information in a DB. User puts the information on the form and the information gets saved in the DB sqlite. I want to be able query the DB and get the information the from the user input. = file DB.PY looks like this: ... db=DAL(sqlite://db.db) db.define_table('fw', Field('dst_ip'), ... = I am trying to connect to the DB like this: from gluon.sql import * db=DAL('sqlite://fw.db') but it does not appear to be working = How do I write a python script to be able to print the information from the user input from the form stored in the DB? it works when I query the DB direclty from inside the Web2py Controllers Shell rows = db(db.fw).select() dest_ip_string ='%s' % rows[1]['dst_ip'] Thank You
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com What do you propose? I do not like it very much either. On Jun 7, 3:33 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com - auto import should work on windows (now on windows ignore will ignore case by default) I don't like this solution. -- A+ I guess it is a pragmatic solution until someone can edit and test the code under Windows. I suggest creating a ticket with low priority for doing this later as an improvement. A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] CRUD with custom links
Hi there, What is the easiest way to generate customized links on the output of a CRUD select? I want to be able to specify the column and my URL with arguments. -Sebastian
[web2py] Re: web2py 1.96.4 is OUT
I am not much of a windows user. I would like to understand what can go wrong with the solution in trunk? On Jun 7, 7:01 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com What do you propose? I do not like it very much either. On Jun 7, 3:33 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com - auto import should work on windows (now on windows ignore will ignore case by default) I don't like this solution. -- A+ I guess it is a pragmatic solution until someone can edit and test the code under Windows. I suggest creating a ticket with low priority for doing this later as an improvement. A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: CRUD with custom links
Please give us an example and we can show you a concrete solution. On Jun 7, 7:51 pm, DJ sebastianjaya...@gmail.com wrote: Hi there, What is the easiest way to generate customized links on the output of a CRUD select? I want to be able to specify the column and my URL with arguments. -Sebastian
[web2py] Re: CRUD with custom links
Hi Massimo, Here's a snippet of my code: ids = [1, 2, 3, 4, 5] # I tried something like this but it does not work # db.myTable.id.represent = lambda value: A(myID, _href=URL (r=request, c='default', f='viewDetail', args=myID)) form = crud.select(db.myTable, db.myTable.id.belongs(ids), _id='myid', _class='smarttable') Let me know if you need more specific code. Thanks! -Sebastian
[web2py] Re: CRUD with custom links
this should work: ids = [1, 2, 3, 4, 5] db.myTable.id.represent = lambda id: A(id, _href=URL('viewDetail', args=id)) form = crud.select(db.myTable, db.myTable.id.belongs(ids), _id='myid', _class='smarttable') On Jun 7, 8:14 pm, DJ sebastianjaya...@gmail.com wrote: Hi Massimo, Here's a snippet of my code: ids = [1, 2, 3, 4, 5] # I tried something like this but it does not work # db.myTable.id.represent = lambda value: A(myID, _href=URL (r=request, c='default', f='viewDetail', args=myID)) form = crud.select(db.myTable, db.myTable.id.belongs(ids), _id='myid', _class='smarttable') Let me know if you need more specific code. Thanks! -Sebastian