[web2py] Re: gae import error
i'm on a mac and i have the google app engine launcher installed in my applications folder, and it works fine for uploading and deploying. is there something else i need to be doing? matt On May 2, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote: You need the Google development api installed. On May 2, 10:01 am, mattynoce mattyn...@gmail.com wrote: hi, i was attempting to add a listproperty to my db.py file and encountered an import error. i haven't added the listproperty yet, i just added the import line: from gluon.contrib.gql import gae and i put it after the default mail lines and before i redefined the user table (which is working). here is the error message: Traceback (most recent call last): File [home directory]/web2py/gluon/restricted.py, line 178, in restricted exec ccode in environment File [home directory]/web2py/applications/init/models/db.py, line 50, in module from gluon.contrib.gql import gae File [home directory]/web2py/gluon/contrib/gql.py, line 29, in module from google.appengine.ext import db as gae ImportError: No module named google.appengine.ext i have version 1.77.3. do i need to do something special to find the google.appengine.ext module? thanks, matt
[web2py] Re: Simple problem: 'Rows' object has no attribute...
Another quick question. I've now stored prices.ALL into a variable 'prices' and passed to the view. I want to show each share as a line with a subline for each price associated to that share. Here is the code: {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} ul {{for price in prices:}} {{=LI(price.price_close)}} {{pass}} /ul {{pass}} /ul (price_close is the value I want to show). This is how it comes out and the closest I can get it: * GDA o 3 o 67 o 45 o 31 * VZZ o 3 o 67 o 45 o 31 How do I alter the view to only make a new 'price_close' line if the price belongs to that share? They are linked here: Field('share_id',db.shares) Thanks! On May 3, 2:29 pm, ztd zac.thompsondav...@gmail.com wrote: With the above two solutions I cleaned up the code and it now works. I had changed this: [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] to this [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'shares.asx_code')] and this: {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} to this: {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} After this I'm getting a list of each share, finally! As soon as read your suggestion Nathan I twigged that 'share' is a variable created in the loop just for the loop - the naming had me thinking I was referencing a table or the earlier dict variable. So for reference, in the code above, 'share' is just a counter and '.asx_code' is the attribute, so the written flow is For every row ('share' variable) found in the dictionary 'shares' (from the controller), show the asx_code variable for the current row. On May 2, 9:27 pm, Nathan Freeze nat...@freezable.com wrote: You're not using the iteration variable. This line: {{=LI(shares.asx_code)}} should be: {{=LI(asx_code.asx_code)}} But a more logical iteration variable would be 'share': {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} /ul On Sun, May 2, 2010 at 11:02 AM, ztd zac.thompsondav...@gmail.com wrote: Hi, here is an error I receive in a simple stock tracking application I'm making to help me learn Web2Py: Traceback (most recent call last): File gluon/restricted.py, line 178, in restricted File C:\Users\Zac\Desktop\web2py\applications\shares/views\default/ index.html, line 86, in module AttributeError: 'Rows' object has no attribute 'asx_code' I think the problem is to do with passing variables between the controller and view. I've based this app on the 'image blog' example in the book. Here is my code so far: ---db.py--- db.define_table('shares', Field('asx_code'), Field('date_added','datetime',default=request.now), Field('quantity'), Field('buy_price')) db.define_table('prices', Field('share_id',db.shares), Field('date','datetime',default=request.now), Field('price_low',default='0'), Field('price_high',default='0'), Field('price_close',default='0')) db.shares.asx_code.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] db.shares.quantity.requires = IS_NOT_EMPTY() db.shares.buy_price.requires = IS_NOT_EMPTY() db.prices.share_id.requires = IS_IN_DB(db,db.shares.id,'%(asx_code)s') db.prices.share_id.writable = db.prices.share_id.readable = False ---index in default.py--- def index(): shares=db().select(db.shares.ALL, orderby=db.shares.asx_code) return dict(shares=shares) ---default/index.html--- {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} /ul What am I doing wrong? i'm a bit confused with variables in the controller, I have a table called shares, a variable declared in the controller called shares and the value in the dictionary called shares so it's very hard to know what I'm calling / using in the view!!! (the LI code could be wrong, I couldn't get it to show anything to debug that far). shares table contains two entries. Thanks!
[web2py] Re: defaulting a value of a column in table with other columns of table
Hi Mdipierro, Could you please elaborate,I tried Field('access_key', 'string', readable=False, writable=False, default=lambda r:defaultUserInfo(r['username'], r['email'])), but keep getting TypeError: lambda() takes exactly 1 argument (0 given) error Thanks On Apr 28, 7:01 pm, mdipierro mdipie...@cs.depaul.edu wrote: Much simpler. Field('access_key',calulate=lambda r: calculateValue(r['email'])) and it will be automatic On Apr 28, 2:26 am, Rohan yourbuddyro...@gmail.com wrote: Hi, I have added a new column access_key in auth_user table, I want to default it to with a value obtained by using email calculateValue(email): #some logic return calculatedValue I tried calling the above method using Field('access_key', 'string', readable=False, writable=False, default=calculateValue(email)) but not able to get the email. also I tried fetching email in method itself but since auth_user table is not yet defined, I was not able to access it. Any pointers how do I default the value ? calculateValue(): #fetch email #some logic return calculatedValue I am creating a session usinghttp://codepad.org/tadGosTdso calculateValue(form) is not called after session is created auth.settings.login_onaccept = calculateValue any help will be highly appreciated.
Re: [web2py] Re: defaulting a value of a column in table with other columns of table
Hello, Mdipierro wrote calculate=lambda... not default=lambda (But I didn't try it even if I'm interested in the trick !) -Mathieu On Mon, May 3, 2010 at 14:29, Rohan yourbuddyro...@gmail.com wrote: Hi Mdipierro, Could you please elaborate,I tried Field('access_key', 'string', readable=False, writable=False, default=lambda r:defaultUserInfo(r['username'], r['email'])), but keep getting TypeError: lambda() takes exactly 1 argument (0 given) error Thanks On Apr 28, 7:01 pm, mdipierro mdipie...@cs.depaul.edu wrote: Much simpler. Field('access_key',calulate=lambda r: calculateValue(r['email'])) and it will be automatic On Apr 28, 2:26 am, Rohan yourbuddyro...@gmail.com wrote: Hi, I have added a new column access_key in auth_user table, I want to default it to with a value obtained by using email calculateValue(email): #some logic return calculatedValue I tried calling the above method using Field('access_key', 'string', readable=False, writable=False, default=calculateValue(email)) but not able to get the email. also I tried fetching email in method itself but since auth_user table is not yet defined, I was not able to access it. Any pointers how do I default the value ? calculateValue(): #fetch email #some logic return calculatedValue I am creating a session usinghttp://codepad.org/tadGosTdso calculateValue(form) is not called after session is created auth.settings.login_onaccept = calculateValue any help will be highly appreciated.
Re: [web2py] Re: Houston, Houston, the rocket lost contact!
The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Both http://localhost:8000 and http://127.0.0.1:8000 work when I am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neither http://localhost:8000 nor http://127.0.0.1:8000 works with latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo On May 1, 4:31 pm, cjrhcaleb.hatti...@gmail.com wrote: On May 1, 1:36 pm, Icebergiceb...@21cn.com wrote: please visit: http://127.0.0.1:8000 and The console output is as usual. But we only get 400 Bad Request fromhttp://localhost:8000 http://mwolk.com/blog/localhost-not-working-but-127001-does/
Re: [web2py] Re: Houston, Houston, the rocket lost contact!
To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Both http://localhost:8000 and http://127.0.0.1:8000 work when I am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neither http://localhost:8000 nor http://127.0.0.1:8000 works with latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo On May 1, 4:31 pm, cjrhcaleb.hatti...@gmail.com wrote: On May 1, 1:36 pm, Icebergiceb...@21cn.com wrote: please visit: http://127.0.0.1:8000 and The console output is as usual. But we only get 400 Bad Request fromhttp://localhost:8000 http://mwolk.com/blog/localhost-not-working-but-127001-does/
[web2py] plugin force-directed js graph
I am proud to give you a plugin for displaying force directed graph layouts The main code was written by my colleague Marvin (who is by now a web2py adept). I wrapped it into a plugin. So far I found only two js packages that can do force directed graph layouts: http://jsviz.org/ (no proper interface) and http://thejit.org/ (only in the vc repo, no attribute to configure the edge length) This plugin has the missing features. The data object syntax is compatible to thejit, if you visit http://127.0.0.1:8000/YOURAPP/plugin_forcedirected/index you will find some documentation Enjoy screenshot: http://jaguar.biologie.hu-berlin.de/~fkrause/screenshot_forcedirected.png download: http://jaguar.biologie.hu-berlin.de/~fkrause/web2py.plugin.forcedirected.w2p Feedback, positive and negative is welcome!
[web2py] Re: something like SqlSoup
no On May 3, 1:47 am, elffikk elff...@gmail.com wrote: hi, is there something like SqlSoup in web2py ? (http://www.sqlalchemy.org/ docs/reference/ext/sqlsoup.html) and another will happened something to the rest of database if I will create a single table to work with?
[web2py] Re: gae import error
Are you using the web2py binary distribution? If so that uses its own python and will not see GAE libs installed. Make sure you run from source and use Python 2.5 On May 3, 5:08 am, mattynoce mattyn...@gmail.com wrote: i'm on a mac and i have the google app engine launcher installed in my applications folder, and it works fine for uploading and deploying. is there something else i need to be doing? matt On May 2, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote: You need the Google development api installed. On May 2, 10:01 am, mattynoce mattyn...@gmail.com wrote: hi, i was attempting to add a listproperty to my db.py file and encountered an import error. i haven't added the listproperty yet, i just added the import line: from gluon.contrib.gql import gae and i put it after the default mail lines and before i redefined the user table (which is working). here is the error message: Traceback (most recent call last): File [home directory]/web2py/gluon/restricted.py, line 178, in restricted exec ccode in environment File [home directory]/web2py/applications/init/models/db.py, line 50, in module from gluon.contrib.gql import gae File [home directory]/web2py/gluon/contrib/gql.py, line 29, in module from google.appengine.ext import db as gae ImportError: No module named google.appengine.ext i have version 1.77.3. do i need to do something special to find the google.appengine.ext module? thanks, matt
[web2py] Re: Simple problem: 'Rows' object has no attribute...
do you have only one price per share or multiple prices? If multiple prices, do you want to list them all? Only the last one? what is the criteria? Are you running on GAE? On May 3, 7:12 am, ztd zac.thompsondav...@gmail.com wrote: Another quick question. I've now stored prices.ALL into a variable 'prices' and passed to the view. I want to show each share as a line with a subline for each price associated to that share. Here is the code: {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} ul {{for price in prices:}} {{=LI(price.price_close)}} {{pass}} /ul {{pass}} /ul (price_close is the value I want to show). This is how it comes out and the closest I can get it: * GDA o 3 o 67 o 45 o 31 * VZZ o 3 o 67 o 45 o 31 How do I alter the view to only make a new 'price_close' line if the price belongs to that share? They are linked here: Field('share_id',db.shares) Thanks! On May 3, 2:29 pm, ztd zac.thompsondav...@gmail.com wrote: With the above two solutions I cleaned up the code and it now works. I had changed this: [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] to this [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'shares.asx_code')] and this: {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} to this: {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} After this I'm getting a list of each share, finally! As soon as read your suggestion Nathan I twigged that 'share' is a variable created in the loop just for the loop - the naming had me thinking I was referencing a table or the earlier dict variable. So for reference, in the code above, 'share' is just a counter and '.asx_code' is the attribute, so the written flow is For every row ('share' variable) found in the dictionary 'shares' (from the controller), show the asx_code variable for the current row. On May 2, 9:27 pm, Nathan Freeze nat...@freezable.com wrote: You're not using the iteration variable. This line: {{=LI(shares.asx_code)}} should be: {{=LI(asx_code.asx_code)}} But a more logical iteration variable would be 'share': {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} /ul On Sun, May 2, 2010 at 11:02 AM, ztd zac.thompsondav...@gmail.com wrote: Hi, here is an error I receive in a simple stock tracking application I'm making to help me learn Web2Py: Traceback (most recent call last): File gluon/restricted.py, line 178, in restricted File C:\Users\Zac\Desktop\web2py\applications\shares/views\default/ index.html, line 86, in module AttributeError: 'Rows' object has no attribute 'asx_code' I think the problem is to do with passing variables between the controller and view. I've based this app on the 'image blog' example in the book. Here is my code so far: ---db.py--- db.define_table('shares', Field('asx_code'), Field('date_added','datetime',default=request.now), Field('quantity'), Field('buy_price')) db.define_table('prices', Field('share_id',db.shares), Field('date','datetime',default=request.now), Field('price_low',default='0'), Field('price_high',default='0'), Field('price_close',default='0')) db.shares.asx_code.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] db.shares.quantity.requires = IS_NOT_EMPTY() db.shares.buy_price.requires = IS_NOT_EMPTY() db.prices.share_id.requires = IS_IN_DB(db,db.shares.id,'%(asx_code)s') db.prices.share_id.writable = db.prices.share_id.readable = False ---index in default.py--- def index(): shares=db().select(db.shares.ALL, orderby=db.shares.asx_code) return dict(shares=shares) ---default/index.html--- {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} /ul What am I doing wrong? i'm a bit confused with variables in the controller, I have a table called shares, a variable declared in the controller called shares and the value in the dictionary called shares so it's very hard to know what I'm calling / using in the view!!! (the LI code could be wrong, I couldn't get it to show anything to debug that far). shares table contains two entries. Thanks!
[web2py] Re: Houston, Houston, the rocket lost contact!
I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrell tfarr...@swgen.com wrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000work when I am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000works with latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo On May 1, 4:31 pm, cjrhcaleb.hatti...@gmail.com wrote: On May 1, 1:36 pm, Icebergiceb...@21cn.com wrote: please visit: http://127.0.0.1:8000 and The console output is as usual. But we only get 400 Bad Request fromhttp://localhost:8000 http://mwolk.com/blog/localhost-not-working-but-127001-does/
[web2py] Re: Houston, Houston, the rocket lost contact!
I got same output as Nathan (Mr. Freeze). The ssl=None seems because my python2.5 on Windows contains no ssl module at all. On May3, 11:30pm, mr.freeze nat...@freezable.com wrote: I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrell tfarr...@swgen.com wrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000workwhen I am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000workswith latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo
Re: [web2py] Re: Houston, Houston, the rocket lost contact!
So changing line 86 from ssl = None to ssl = False should take care of it. -tim On 5/3/2010 10:58 AM, Iceberg wrote: I got same output as Nathan (Mr. Freeze). The ssl=None seems because my python2.5 on Windows contains no ssl module at all. On May3, 11:30pm, mr.freezenat...@freezable.com wrote: I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrelltfarr...@swgen.com wrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000workwhen I am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000workswith latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.eduwrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo
[web2py] Re: Houston, Houston, the rocket lost contact!
No luck. Changing it has no effect. The debug still prints: ssl: None secure: False If I change at line 83 to: try: import ssl has_ssl = True except ImportError: has_ssl = False and line 97 to: self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket) it works. On May 3, 11:41 am, Timothy Farrell tfarr...@swgen.com wrote: So changing line 86 from ssl = None to ssl = False should take care of it. -tim On 5/3/2010 10:58 AM, Iceberg wrote: I got same output as Nathan (Mr. Freeze). The ssl=None seems because my python2.5 on Windows contains no ssl module at all. On May3, 11:30pm, mr.freezenat...@freezable.com wrote: I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrelltfarr...@swgen.com wrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000workwhenI am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000workswith latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo
Re: [web2py] Re: Houston, Houston, the rocket lost contact!
Good enough for me. Let's call that the fix. --tim On 5/3/2010 12:02 PM, mr.freeze wrote: No luck. Changing it has no effect. The debug still prints: ssl: None secure: False If I change at line 83 to: try: import ssl has_ssl = True except ImportError: has_ssl = False and line 97 to: self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket) it works. On May 3, 11:41 am, Timothy Farrelltfarr...@swgen.com wrote: So changing line 86 from ssl = None to ssl = False should take care of it. -tim On 5/3/2010 10:58 AM, Iceberg wrote: I got same output as Nathan (Mr. Freeze). The ssl=None seems because my python2.5 on Windows contains no ssl module at all. On May3, 11:30pm, mr.freezenat...@freezable.comwrote: I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrelltfarr...@swgen.comwrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000workwhenI am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000workswith latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo
[web2py] Re: Houston, Houston, the rocket lost contact!
I'll wait for the patch. Massimo On May 3, 12:26 pm, Timothy Farrell tfarr...@swgen.com wrote: Good enough for me. Let's call that the fix. --tim On 5/3/2010 12:02 PM, mr.freeze wrote: No luck. Changing it has no effect. The debug still prints: ssl: None secure: False If I change at line 83 to: try: import ssl has_ssl = True except ImportError: has_ssl = False and line 97 to: self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket) it works. On May 3, 11:41 am, Timothy Farrelltfarr...@swgen.com wrote: So changing line 86 from ssl = None to ssl = False should take care of it. -tim On 5/3/2010 10:58 AM, Iceberg wrote: I got same output as Nathan (Mr. Freeze). The ssl=None seems because my python2.5 on Windows contains no ssl module at all. On May3, 11:30pm, mr.freezenat...@freezable.com wrote: I get: ssl: None secure: False On May 3, 8:11 am, Timothy Farrelltfarr...@swgen.com wrote: To help me debug this, would one of you do the following: Add some code at line 99: print ssl: , self.ssl print secure: , self.secure These two values should, in all cases be the same. If they are not, you'll get a 400. If you're seeing this error, it means one or the other is not what it should be. Please tell me which one. Thanks, -tim On 5/3/2010 7:54 AM, Timothy Farrell wrote: The main change between the two versions is where it applies the SSL connection and adds a check to see if that connection isn't there when it should be. I've updated to the latest hg and I'm not seeing what you guys are seeing. Are any of you running HTTPS? Rocket does not support IPV6 yet. -tim On 5/2/2010 12:10 PM, Iceberg wrote: Sorry, Cjrh, the tip doesn't help. To summarize: 1) Bothhttp://localhost:8000andhttp://127.0.0.1:8000workwhenI am using old rocket.py, and I just double confirm my hosts file contains 127.0.0.1 localhost since long long ago. 2) Neitherhttp://localhost:8000norhttp://127.0.0.1:8000workswith latest rocket.py Actually I took a glance into the diff between latest two rockets. They look significantly different, but I could not trace down to certain line yet. It is rocket science after all. :-) Sos, Sos... On May2日, 5:57am, mdipierromdipie...@cs.depaul.edu wrote: @Iceberg, does the suggestion below fix the problem? @Tim. Does Rocket support IPV6 addresses? Massimo
[web2py] Re: Simple problem: 'Rows' object has no attribute...
Hi Massimo - I should say thanks for the simple and interesting framework you've made -thanks! One share can have between zero and (practically) unlimited prices associated to it, by i's ID. Initially I want to list all prices associated to each share just to get an idea of what I'm doing. Later I will implement a form to control the time period. Currently there aren't any other criteria, so the workflow is just 'list each share as a LI item and all recorded prices associated to that share as sub LI items'. I'm not running this on GAE. Below you can see that four prices appear under each of the two shares, each one should have only two - GDA should have the first two and VZZ the last two. On May 3, 6:04 pm, mdipierro mdipie...@cs.depaul.edu wrote: do you have only one price per share or multiple prices? If multiple prices, do you want to list them all? Only the last one? what is the criteria? Are you running on GAE? On May 3, 7:12 am, ztd zac.thompsondav...@gmail.com wrote: Another quick question. I've now stored prices.ALL into a variable 'prices' and passed to the view. I want to show each share as a line with a subline for each price associated to that share. Here is the code: {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} ul {{for price in prices:}} {{=LI(price.price_close)}} {{pass}} /ul {{pass}} /ul (price_close is the value I want to show). This is how it comes out and the closest I can get it: * GDA o 3 o 67 o 45 o 31 * VZZ o 3 o 67 o 45 o 31 How do I alter the view to only make a new 'price_close' line if the price belongs to that share? They are linked here: Field('share_id',db.shares) Thanks! On May 3, 2:29 pm, ztd zac.thompsondav...@gmail.com wrote: With the above two solutions I cleaned up the code and it now works. I had changed this: [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] to this [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'shares.asx_code')] and this: {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} to this: {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} After this I'm getting a list of each share, finally! As soon as read your suggestion Nathan I twigged that 'share' is a variable created in the loop just for the loop - the naming had me thinking I was referencing a table or the earlier dict variable. So for reference, in the code above, 'share' is just a counter and '.asx_code' is the attribute, so the written flow is For every row ('share' variable) found in the dictionary 'shares' (from the controller), show the asx_code variable for the current row. On May 2, 9:27 pm, Nathan Freeze nat...@freezable.com wrote: You're not using the iteration variable. This line: {{=LI(shares.asx_code)}} should be: {{=LI(asx_code.asx_code)}} But a more logical iteration variable would be 'share': {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} /ul On Sun, May 2, 2010 at 11:02 AM, ztd zac.thompsondav...@gmail.com wrote: Hi, here is an error I receive in a simple stock tracking application I'm making to help me learn Web2Py: Traceback (most recent call last): File gluon/restricted.py, line 178, in restricted File C:\Users\Zac\Desktop\web2py\applications\shares/views\default/ index.html, line 86, in module AttributeError: 'Rows' object has no attribute 'asx_code' I think the problem is to do with passing variables between the controller and view. I've based this app on the 'image blog' example in the book. Here is my code so far: ---db.py--- db.define_table('shares', Field('asx_code'), Field('date_added','datetime',default=request.now), Field('quantity'), Field('buy_price')) db.define_table('prices', Field('share_id',db.shares), Field('date','datetime',default=request.now), Field('price_low',default='0'), Field('price_high',default='0'), Field('price_close',default='0')) db.shares.asx_code.requires = [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] db.shares.quantity.requires = IS_NOT_EMPTY() db.shares.buy_price.requires = IS_NOT_EMPTY() db.prices.share_id.requires = IS_IN_DB(db,db.shares.id,'%(asx_code)s') db.prices.share_id.writable = db.prices.share_id.readable = False ---index in default.py--- def index(): shares=db().select(db.shares.ALL, orderby=db.shares.asx_code) return dict(shares=shares) ---default/index.html--- {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for asx_code in shares:}} {{=LI(shares.asx_code)}}
[web2py] Re: Simple problem: 'Rows' object has no attribute...
rows=db(db.shares.id0).select(left=db.prices.on(db.prices.share_id==db.shares.id)) AND table {{for row in rows:}} trtd{{=row.shares.asx_code}}/tdtd{{=row.prices.price_close}} /td/tr {{pass}} /table OR BETTER {{id=None}} ul {{for row in rows:}} {{if row.shares.id!=id:}}{{if id:}}/ul/li{{pass}} li{{=row.shares.asx_code}}ul{{id=row.shares.id}}{{pass}} li{{=row.prices.price_close or '(nothing)'/li {{pass}} {{if id:}}/ul/li{{pass}} ul On May 3, 12:44 pm, ztd zac.thompsondav...@gmail.com wrote: Hi Massimo - I should say thanks for the simple and interesting framework you've made -thanks! One share can have between zero and (practically) unlimited prices associated to it, by i's ID. Initially I want to list all prices associated to each share just to get an idea of what I'm doing. Later I will implement a form to control the time period. Currently there aren't any other criteria, so the workflow is just 'list each share as a LI item and all recorded prices associated to that share as sub LI items'. I'm not running this on GAE. Below you can see that four prices appear under each of the two shares, each one should have only two - GDA should have the first two and VZZ the last two. On May 3, 6:04 pm, mdipierro mdipie...@cs.depaul.edu wrote: do you have only one price per share or multiple prices? If multiple prices, do you want to list them all? Only the last one? what is the criteria? Are you running on GAE? On May 3, 7:12 am, ztd zac.thompsondav...@gmail.com wrote: Another quick question. I've now stored prices.ALL into a variable 'prices' and passed to the view. I want to show each share as a line with a subline for each price associated to that share. Here is the code: {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} ul {{for price in prices:}} {{=LI(price.price_close)}} {{pass}} /ul {{pass}} /ul (price_close is the value I want to show). This is how it comes out and the closest I can get it: * GDA o 3 o 67 o 45 o 31 * VZZ o 3 o 67 o 45 o 31 How do I alter the view to only make a new 'price_close' line if the price belongs to that share? They are linked here: Field('share_id',db.shares) Thanks! On May 3, 2:29 pm, ztd zac.thompsondav...@gmail.com wrote: With the above two solutions I cleaned up the code and it now works. I had changed this: [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.shares.asx_code)] to this [IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'shares.asx_code')] and this: {{for asx_code in shares:}} {{=LI(shares.asx_code)}} {{pass}} to this: {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} After this I'm getting a list of each share, finally! As soon as read your suggestion Nathan I twigged that 'share' is a variable created in the loop just for the loop - the naming had me thinking I was referencing a table or the earlier dict variable. So for reference, in the code above, 'share' is just a counter and '.asx_code' is the attribute, so the written flow is For every row ('share' variable) found in the dictionary 'shares' (from the controller), show the asx_code variable for the current row. On May 2, 9:27 pm, Nathan Freeze nat...@freezable.com wrote: You're not using the iteration variable. This line: {{=LI(shares.asx_code)}} should be: {{=LI(asx_code.asx_code)}} But a more logical iteration variable would be 'share': {{extend 'layout.html'}} h1Share portfolio/h1 ul {{for share in shares:}} {{=LI(share.asx_code)}} {{pass}} /ul On Sun, May 2, 2010 at 11:02 AM, ztd zac.thompsondav...@gmail.com wrote: Hi, here is an error I receive in a simple stock tracking application I'm making to help me learn Web2Py: Traceback (most recent call last): File gluon/restricted.py, line 178, in restricted File C:\Users\Zac\Desktop\web2py\applications\shares/views\default/ index.html, line 86, in module AttributeError: 'Rows' object has no attribute 'asx_code' I think the problem is to do with passing variables between the controller and view. I've based this app on the 'image blog' example in the book. Here is my code so far: ---db.py--- db.define_table('shares', Field('asx_code'), Field('date_added','datetime',default=request.now), Field('quantity'), Field('buy_price')) db.define_table('prices', Field('share_id',db.shares), Field('date','datetime',default=request.now), Field('price_low',default='0'), Field('price_high',default='0'), Field('price_close',default='0'))
[web2py] GAE dynamic field
I'm sure there's a way to do this, but I'm not using the proper search terms. I'm wanting to use GAE but want to avoid having to re-upload the app just to change a bit of text on the site. My first thought was to simply store any dynamic text in a table and edit the table entry. This works great, for plain text. But if I wanted to including HTML tags they don't perform as I expected. The tag gets printed in my view instead of getting rendered as I had expected. Am I going about this wrong? Is there a way to include a field in a view exactly as it is shown in the database?
[web2py] Re: GAE dynamic field
On May 3, 1:15 pm, Chris S sanders.ch...@gmail.com wrote: I'm sure there's a way to do this, but I'm not using the proper search terms. I'm wanting to use GAE but want to avoid having to re-upload the app just to change a bit of text on the site. My first thought was to simply store any dynamic text in a table and edit the table entry. This works great, for plain text. But if I wanted to including HTML tags they don't perform as I expected. The tag gets printed in my view instead of getting rendered as I had expected. instead of {{=record.field}} do {{=XML(record.field)}} or perhaps {{=XML(record.field,sanitize=True)}} if you are worried about XSS injections form the text. Am I going about this wrong? Is there a way to include a field in a view exactly as it is shown in the database?
[web2py] Re: GAE dynamic field
Wonderful, that's exactly what I was looking for. Your response does raise one more curiosity for me. I was using a dictionary to pass the 'fields' to the view which it doesn't look like you were doing (record.field). My method requires each of the table entries to have a field where you specific the page it's located on. Then in the controller I pull all entries for that page and pass the dictionaries to the view. Finally in the view I write {{=XML(FieldDict['Field9']['text'])}} which inserts my text field. Is that similar to what you were describing? I've just gotten started and would hate to build on an initially design with poor efficiency. On May 3, 1:18 pm, mdipierro mdipie...@cs.depaul.edu wrote: On May 3, 1:15 pm, Chris S sanders.ch...@gmail.com wrote: I'm sure there's a way to do this, but I'm not using the proper search terms. I'm wanting to use GAE but want to avoid having to re-upload the app just to change a bit of text on the site. My first thought was to simply store any dynamic text in a table and edit the table entry. This works great, for plain text. But if I wanted to including HTML tags they don't perform as I expected. The tag gets printed in my view instead of getting rendered as I had expected. instead of {{=record.field}} do {{=XML(record.field)}} or perhaps {{=XML(record.field,sanitize=True)}} if you are worried about XSS injections form the text. Am I going about this wrong? Is there a way to include a field in a view exactly as it is shown in the database?
Re: [web2py] Re: Houston, Houston, the rocket lost contact!
On May 3, 2010, at 9:41 AM, Timothy Farrell wrote: So changing line 86 from ssl = None to ssl = False should take care of it. This pattern is repeated around line 130; that might be why mr freeze didn't see a change.
[web2py] Re: Houston, Houston, the rocket lost contact!
new rocket launched to trunk. On May 3, 1:39 pm, Timothy Farrell tfarr...@swgen.com wrote: Negative. The latter code is unrelated (though a similar style). However, I have changed it to be consistent in the patch I sent to Massimo. Look for it in an upcoming commit. -tim On 5/3/2010 1:33 PM, Jonathan Lundell wrote: On May 3, 2010, at 9:41 AM, Timothy Farrell wrote: So changing line 86 from ssl = None to ssl = False should take care of it. This pattern is repeated around line 130; that might be why mr freeze didn't see a change.
Re: [web2py] Re: web2py cheat sheet for a pyday
Sadly, this PDF imported with inkscape looks bad, and is more dificult to edit texts. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, May 3, 2010 at 1:06 AM, Jason Brower encomp...@gmail.com wrote: If you don't have the source, you can open and edit it with inkscape. Oh yeah! Did it when designers would throw stuff at in in pdf thinking they could make a few extra bucks by not letting me adjust it. Inkscape should do a pretty good job and it can save as pdf as well. (But can't all we linux users now-a-days.) Best Regards, Jason On Sun, 2010-05-02 at 20:26 -0700, mdipierro wrote: I cannot find the source. I will check if I have a copy at the office. massimo On May 2, 7:28 pm, Mariano Reingart reing...@gmail.com wrote: I'm looking at: http://www.web2py.com/examples/static/web2py_cheatsheet.pdf and I wonder if anyone have the source file, so we can adapt it and translate (to spanish)... I'm thinking of printing and distributing it to the attendees of the next PyDay here in Argentina (were I'm going to give a talk about w2p): http://www.pyday.com.ar (the site is also made with web2conf :-) Best regards, Mariano Reingarthttp://www.web2py.com.arhttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com
[web2py] Re: web2py cheat sheet for a pyday
The source (which I cannot find) was a Comic Life file. Unless you have a Mac that does not help. On May 3, 1:56 pm, Mariano Reingart reing...@gmail.com wrote: Sadly, this PDF imported with inkscape looks bad, and is more dificult to edit texts. Best regards Mariano Reingarthttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com On Mon, May 3, 2010 at 1:06 AM, Jason Brower encomp...@gmail.com wrote: If you don't have the source, you can open and edit it with inkscape. Oh yeah! Did it when designers would throw stuff at in in pdf thinking they could make a few extra bucks by not letting me adjust it. Inkscape should do a pretty good job and it can save as pdf as well. (But can't all we linux users now-a-days.) Best Regards, Jason On Sun, 2010-05-02 at 20:26 -0700, mdipierro wrote: I cannot find the source. I will check if I have a copy at the office. massimo On May 2, 7:28 pm, Mariano Reingart reing...@gmail.com wrote: I'm looking at: http://www.web2py.com/examples/static/web2py_cheatsheet.pdf and I wonder if anyone have the source file, so we can adapt it and translate (to spanish)... I'm thinking of printing and distributing it to the attendees of the next PyDay here in Argentina (were I'm going to give a talk about w2p): http://www.pyday.com.ar (the site is also made with web2conf :-) Best regards, Mariano Reingarthttp://www.web2py.com.arhttp://www.sistemasagiles.com.arhttp://reinga...
[web2py] Can we help?
I just read this: http://stackoverflow.com/questions/2758925/career-advice-for-a-frustrated-newbie-programmer If you are Satoru Logic of you know anything about him, please contact me or share your problem with this list. Parhaps we can help. Massimo
[web2py] Custom form renderings and attributes
Hello, Is it intentional that when using SQLFORM, and custom views (with form.custom.begin), that if i modify attributes after initial form construction I have to update form.custom.begin myself? here's my example: form = SQLFORM(db.artwork, request.args[0], fields=fields, upload=URL(r=request, c='gae', f='preview')) if request.env.web2py_runtime_gae: from google.appengine.ext import blobstore upload_url = blobstore.create_upload_url(URL(r=request,f='upload_art', args=request.args, vars={'redir':URL(r=request,c='account', f='index')})) form['_action']=upload_url (begin, end) = form._xml() form.custom.begin = XML(%s %s % (form.tag, begin)) note that if i don't update form.custom.begin myself it does not include the '_action' attribute. In most cases you just initialize the form with all the needed attributes, but in this case if i'm on google app engine i need the upload field to post to another URL (since i'm using blobstore), but if i'm not on GAE i can use the regular action. I suppose at this point the app only runs on GAE, so i can just skip the if statement, but thought this might be a low-priority bug. thanks, christian
[web2py] Re: gae import error
no, i'm using the source. i had a python problem with the other project i had been working on, where i upgraded to snow leopard and i didn't realize it upgraded me to 2.6. but in solving that problem i changed my python path, and i just tested and it's running 2.5. so i'm using gae launcher and i have my web2py source directory. i don't have launcher running while i'm testing web2py -- if i import gae, do i have to be doing it through the launcher (and thus port 8080)? i'm currently assuming test using web2py without running gae because i figure there's source code to handle the conversion. that may be an incorrect assumption. thanks! matt On May 3, 10:21 am, mdipierro mdipie...@cs.depaul.edu wrote: Are you using the web2py binary distribution? If so that uses its own python and will not see GAE libs installed. Make sure you run from source and use Python 2.5 On May 3, 5:08 am, mattynoce mattyn...@gmail.com wrote: i'm on a mac and i have the google app engine launcher installed in my applications folder, and it works fine for uploading and deploying. is there something else i need to be doing? matt On May 2, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote: You need the Google development api installed. On May 2, 10:01 am, mattynoce mattyn...@gmail.com wrote: hi, i was attempting to add a listproperty to my db.py file and encountered an import error. i haven't added the listproperty yet, i just added the import line: from gluon.contrib.gql import gae and i put it after the default mail lines and before i redefined the user table (which is working). here is the error message: Traceback (most recent call last): File [home directory]/web2py/gluon/restricted.py, line 178, in restricted exec ccode in environment File [home directory]/web2py/applications/init/models/db.py, line 50, in module from gluon.contrib.gql import gae File [home directory]/web2py/gluon/contrib/gql.py, line 29, in module from google.appengine.ext import db as gae ImportError: No module named google.appengine.ext i have version 1.77.3. do i need to do something special to find the google.appengine.ext module? thanks, matt
[web2py] Previous location
Is there a way to find the previous location / address in an action? For example: Currently in www.domain.com/a/c/f/arg1 Follow some link to action_x def action_x: if something_is_wrong: redirect(request.last_location) # including args ... My goal is to send the user to the page is comming from in case he calls an action with a incorrect or the wrong parameters. Txs, Miguel
[web2py] Re: Previous location
I'm not sure if it's reliable or safe but request.env.http_referer might be what you're looking for. On May 3, 4:39 pm, Miguel Lopes mig.e.lo...@gmail.com wrote: Is there a way to find the previous location / address in an action? For example: Currently inwww.domain.com/a/c/f/arg1 Follow some link to action_x def action_x: if something_is_wrong: redirect(request.last_location) # including args ... My goal is to send the user to the page is comming from in case he calls an action with a incorrect or the wrong parameters. Txs, Miguel
Re: [web2py] Re: Previous location
request.env.http_referer is not working for me. I checked (http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14) and the referer is optionally set by the client. So we can not take it for granted. Miguel On Mon, May 3, 2010 at 10:45 PM, mr.freeze nat...@freezable.com wrote: I'm not sure if it's reliable or safe but request.env.http_referer might be what you're looking for. On May 3, 4:39 pm, Miguel Lopes mig.e.lo...@gmail.com wrote: Is there a way to find the previous location / address in an action? For example: Currently inwww.domain.com/a/c/f/arg1 Follow some link to action_x def action_x: if something_is_wrong: redirect(request.last_location) # including args ... My goal is to send the user to the page is comming from in case he calls an action with a incorrect or the wrong parameters. Txs, Miguel
Re: [web2py] Re: Previous location
web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. How about putting the previous location in session before you redirect? On Mon, May 3, 2010 at 3:05 PM, Miguel Lopes mig.e.lo...@gmail.com wrote: request.env.http_referer is not working for me. I checked (http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14) and the referer is optionally set by the client. So we can not take it for granted. Miguel On Mon, May 3, 2010 at 10:45 PM, mr.freeze nat...@freezable.com wrote: I'm not sure if it's reliable or safe but request.env.http_referer might be what you're looking for. On May 3, 4:39 pm, Miguel Lopes mig.e.lo...@gmail.com wrote: Is there a way to find the previous location / address in an action? For example: Currently inwww.domain.com/a/c/f/arg1 Follow some link to action_x def action_x: if something_is_wrong: redirect(request.last_location) # including args ... My goal is to send the user to the page is comming from in case he calls an action with a incorrect or the wrong parameters. Txs, Miguel
Re: [web2py] Re: Previous location
On Mon, May 3, 2010 at 11:08 PM, Jonathan Lundell jlund...@pobox.comwrote: web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. No. If I have no redirect and call a location with no args the referer is not set when I arrive at web2py's default Internal error page. Which is okay because the standard says referer is optionally set by the client. How about putting the previous location in session before you redirect? That works on some instances, but not for controlling for the wrong number or the wrong parameters. A concrete example: 1. Currently in www.domain.com/a/c/f/arg1http://inwww.domain.com/a/c/f/arg1 2. User edits address bar and presses enter (removed arg1): www.domain.com/a/c/f/ http://inwww.domain.com/a/c/f/arg1 3. The called action: def f(): if not request.args: redirect(request.last_location) # including args Perhaps someone knows of an alternative way to accomplish the same? Miguel
[web2py] cache.disk.clear
Hi, I have installed a site on dreamhost and whenever I issue the command cache.disk.clear in an action, I get an invalid function error. I thought this could be a permissions problem for the cache directory or cache.shelve, so I added read/write permissions for everyone, but it didn't seem to work. Aache.ram.clear seems to work just fine. Any ideas? Avik
[web2py] Re: Using form.custom and auth
The way to do it is to do the following in the controller: register = auth.register() login = auth.login() Then, you can use: register[_class] = custome_css_classes and same for login. Then I simply pass a return dict(register=register, login=login), and I have two forms available for me to use {{=register.custom.widget.bla}} with in view. On May 3, 5:07 pm, waTR r...@devshell.org wrote: Is there any way to use form.custom.widget with AUTH.register() and AUTH.login() ? I have a design I am trying to plug my code into, and wanted to try not re-writing the login/register stuff this time.
[web2py] Re: Using form.custom and auth
Correction: Instead of register[_class] = bla, do: register.element(_name='fieldNAME')['_class'] = custom_css_classes On May 3, 5:18 pm, waTR r...@devshell.org wrote: The way to do it is to do the following in the controller: register = auth.register() login = auth.login() Then, you can use: register[_class] = custome_css_classes and same for login. Then I simply pass a return dict(register=register, login=login), and I have two forms available for me to use {{=register.custom.widget.bla}} with in view. On May 3, 5:07 pm, waTR r...@devshell.org wrote: Is there any way to use form.custom.widget with AUTH.register() and AUTH.login() ? I have a design I am trying to plug my code into, and wanted to try not re-writing the login/register stuff this time.
[web2py] Is a Web CLI possible with Web2PY?
http://tirania.org/blog/archive/2010/May-03.html ECMA CLI would have given the web both strongly typed and loosely typed programming languages. It would have given developers a choice between performance and scriptability. A programming language choice (use the right tool for the right job) and would have in general made web pages faster just by moving performance sensitive code to strongly typed languages. A wide variety of languages would have become first-class citizens on the web client. Today those languages can run, but they can run in plugin islands. They can run inside Flash or they can run inside Silverlight, but they are second class citizens: they run on separate VMs, and they are constrained on how they talk to the browser with very limited APIs (only some 20 or so entry points exist to integrate the browser with a plugin, and most advance interoperability scenarios require extensive hacks and knowing about a browser internal). Perhaps the time has come to experiment embedding the ECMA CLI inside the browser. Not as a separate plugin, and not as a plugin island, but as a first-class VM inside the browser. Running side-by-side to the Javascript engine. Such an effort would have two goals: * Access to new languages inside the browser, optionally statically typed for major performance boosts. * A new platform for innovating on the browser by providing a safe mechanism to extend the browser APIs. We could do this by linking Mono directly into the browser. This would allow developers to write code like this: script language=csharp from email in documents.ElementsByTag (email) email.Style.Font = bold; /script Or pulling the source from the server: script language=csharp source=ImageGallery.cs/script We could replace `csharp' with any of the existing open sourced compilers (C#, IronPython, IronRuby and others). Or alternatively, if users did not want to distribute their source and instead ship a compact binary to the end users, they could embed the binary CIL directly:
[web2py] Re: Using form.custom and auth
Strange behaviour in view: I can't seem to use password_two using custom form. It doesn't show up as a text-box. It simply shows up as the word None. On May 3, 5:20 pm, waTR r...@devshell.org wrote: Correction: Instead of register[_class] = bla, do: register.element(_name='fieldNAME')['_class'] = custom_css_classes On May 3, 5:18 pm, waTR r...@devshell.org wrote: The way to do it is to do the following in the controller: register = auth.register() login = auth.login() Then, you can use: register[_class] = custome_css_classes and same for login. Then I simply pass a return dict(register=register, login=login), and I have two forms available for me to use {{=register.custom.widget.bla}} with in view. On May 3, 5:07 pm, waTR r...@devshell.org wrote: Is there any way to use form.custom.widget with AUTH.register() and AUTH.login() ? I have a design I am trying to plug my code into, and wanted to try not re-writing the login/register stuff this time.
[web2py] Re: Custom form renderings and attributes
You can do form = SQLFORM(db.artwork, request.args[0], fields=fields, upload=URL(r=request, c='gae', f='preview'),_action=) On May 3, 4:11 pm, howesc how...@umich.edu wrote: Hello, Is it intentional that when using SQLFORM, and custom views (with form.custom.begin), that if i modify attributes after initial form construction I have to update form.custom.begin myself? here's my example: form = SQLFORM(db.artwork, request.args[0], fields=fields, upload=URL(r=request, c='gae', f='preview')) if request.env.web2py_runtime_gae: from google.appengine.ext import blobstore upload_url = blobstore.create_upload_url(URL(r=request,f='upload_art', args=request.args, vars={'redir':URL(r=request,c='account', f='index')})) form['_action']=upload_url (begin, end) = form._xml() form.custom.begin = XML(%s %s % (form.tag, begin)) note that if i don't update form.custom.begin myself it does not include the '_action' attribute. In most cases you just initialize the form with all the needed attributes, but in this case if i'm on google app engine i need the upload field to post to another URL (since i'm using blobstore), but if i'm not on GAE i can use the regular action. I suppose at this point the app only runs on GAE, so i can just skip the if statement, but thought this might be a low-priority bug. thanks, christian
[web2py] An example of CLI in the browser using Python
http://visitmix.com/Labs/gestalt/ http://visitmix.com/labs/gestalt/samples/canvas.2d.drawing/canvas.2d.drawing.html ***
[web2py] Re: Using form.custom and auth
You are right form.custom.widget.password_two is undefined. You must use input name=password_two type=password / On May 3, 7:36 pm, waTR r...@devshell.org wrote: Strange behaviour in view: I can't seem to use password_two using custom form. It doesn't show up as a text-box. It simply shows up as the word None. On May 3, 5:20 pm, waTR r...@devshell.org wrote: Correction: Instead of register[_class] = bla, do: register.element(_name='fieldNAME')['_class'] = custom_css_classes On May 3, 5:18 pm, waTR r...@devshell.org wrote: The way to do it is to do the following in the controller: register = auth.register() login = auth.login() Then, you can use: register[_class] = custome_css_classes and same for login. Then I simply pass a return dict(register=register, login=login), and I have two forms available for me to use {{=register.custom.widget.bla}} with in view. On May 3, 5:07 pm, waTR r...@devshell.org wrote: Is there any way to use form.custom.widget with AUTH.register() and AUTH.login() ? I have a design I am trying to plug my code into, and wanted to try not re-writing the login/register stuff this time.
[web2py] Re: Using form.custom and auth
Solved previous problem. However, the form won't actually insert into the database...am I missing something? On May 3, 5:36 pm, waTR r...@devshell.org wrote: Strange behaviour in view: I can't seem to use password_two using custom form. It doesn't show up as a text-box. It simply shows up as the word None. On May 3, 5:20 pm, waTR r...@devshell.org wrote: Correction: Instead of register[_class] = bla, do: register.element(_name='fieldNAME')['_class'] = custom_css_classes On May 3, 5:18 pm, waTR r...@devshell.org wrote: The way to do it is to do the following in the controller: register = auth.register() login = auth.login() Then, you can use: register[_class] = custome_css_classes and same for login. Then I simply pass a return dict(register=register, login=login), and I have two forms available for me to use {{=register.custom.widget.bla}} with in view. On May 3, 5:07 pm, waTR r...@devshell.org wrote: Is there any way to use form.custom.widget with AUTH.register() and AUTH.login() ? I have a design I am trying to plug my code into, and wanted to try not re-writing the login/register stuff this time.
Re: [web2py] Re: Previous location
On Mon, May 3, 2010 at 11:08 PM, Jonathan Lundell jlund...@pobox.com wrote: web2py probably isn't setting referer on a redirect, and if it did, you'd have to interpret the URL. No. If I have no redirect and call a location with no args the referer is not set when I arrive at web2py's default Internal error page. Which is okay because the standard says referer is optionally set by the client. How about putting the previous location in session before you redirect? That works on some instances, but not for controlling for the wrong number or the wrong parameters. A concrete example: 1. Currently in www.domain.com/a/c/f/arg1 2. User edits address bar and presses enter (removed arg1): www.domain.com/a/c/f/ 3. The called action: def f(): if not request.args: redirect(request.last_location) # including args Perhaps someone knows of an alternative way to accomplish the same? The session is pretty much the only place you've got to keep information between pages. In the above example, in step 1, you need to save the current location in session. You can do that in f() before you return, or if you want to always do it (from every c/f), you could perhaps do it in your layout.html: copy the location from request to session. (That won't work for redirects, but you might not want it to.)
[web2py] unittests
http://stackoverflow.com/questions/2762294/unit-testing-in-web2py
[web2py] Re: cache.disk.clear
can you show the complete traceback? Do you have the latest web2py? This seems to work for me. On May 3, 6:25 pm, Avik Basu avikb...@gmail.com wrote: Hi, I have installed a site on dreamhost and whenever I issue the command cache.disk.clear in an action, I get an invalid function error. I thought this could be a permissions problem for the cache directory or cache.shelve, so I added read/write permissions for everyone, but it didn't seem to work. Aache.ram.clear seems to work just fine. Any ideas? Avik
[web2py] Re: cache.disk.clear
Can you try it from the shell? python web2py.py -S welcome cache.disk.clear() On May 3, 9:29 pm, mdipierro mdipie...@cs.depaul.edu wrote: can you show the complete traceback? Do you have the latest web2py? This seems to work for me. On May 3, 6:25 pm, Avik Basu avikb...@gmail.com wrote: Hi, I have installed a site on dreamhost and whenever I issue the command cache.disk.clear in an action, I get an invalid function error. I thought this could be a permissions problem for the cache directory or cache.shelve, so I added read/write permissions for everyone, but it didn't seem to work. Aache.ram.clear seems to work just fine. Any ideas? Avik