[web2py] Re: new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread niknok
In the validation example,  I entered a single character in the Bio
and was allowed to proceed to the next field despite the
db.person.bio.requires = IS_LENGTH(minsize=5, maxsize=200). You  made
a note about "Client side validation is not supposed to validate
everything!", is this included in that exception?

A few suggestions:
* How about using "description" or "details" instead of the "legend"
keyword at it seems to be more appropriate for said function.

• As default behavior, instead of the default "X" errorImage beside
the step title, how about using an exclamation point icon to indicate
that this step needs attention and then in the specific field with an
error use the "X" icon instead.


The other day you answered my query re modal windows with a reference
to easyframework.com + web2py.

I pray that you have plans of adding that feature to your
PowerFormWizard Plugin (or perhaps turning this into a "PowerForms"
plugin to truly enable feature-full forms in Web2py?

Cheers and many thanks for your many contributions to the web2py
community.


/r
Nik


On Jun 29, 10:33 pm, Bruno Rocha  wrote:
> Hi,
>
> I just created a new plugin for stepped form wizards.
>
> I made it last night, so it is not tested very well, I would like your help
> to test it.
>
> web2py PowerFormWizard Plugin - based on Jquery Stepy
>
> - Steps
> - Customizable titles
> - Server side validation
> - Client side validation (with jquery validate)
> - Custom css
> - JS Callbaks
> - Error images
>
> Take a look:http://labs.blouweb.com/powerformwizard
>
> This plugin is the second plugin of blouweb PowerPlugins, I am now starting
> the third one which I hope to have the first version soon.
>
> http://labs.blouweb.com
>
> Suggestions, testers, issues, contributions etc on 
> bitbucket:https://bitbucket.org/rochacbruno/powerformwizard
>
> Hope it helps someone!
>
> Thanks.
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
> [ Aprenda Python:http://CursoDePython.com.br]
> [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
> [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: [OFF] Protect the web2py app of DDoS atack in GAE

2011-06-29 Thread pbreit
Check out CloudFlare which caches all your static files, prevents threats 
and more. All for free with a simple setup.

Info on 
GAE: http://blog.cloudflare.com/zone-apex-naked-domain-root-domain-cname-supp


Re: [web2py] Invalid view in 1.97.1

2011-06-29 Thread pbreit
Or this if you can get by with them only being available on "localhost":

# by default give a view/generic.extension to all actions from localhost
# none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []


[web2py] Re: Error on LOAD() in trunk

2011-06-29 Thread pbreit
The most recent changeset appears to be the culprit. Probably the copy.copy 
thing as shown in the error I suppose.

[web2py] Error on LOAD() in trunk

2011-06-29 Thread pbreit
I'm getting an error on a LOAD(...ajax=False) in trunk. OK in 1.97.1 and OK 
when ajax=True.


Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 192, in restricted
exec ccode in environment
  File "/opt/web2py/applications/init/views/checkout/add.html", line 105, in 

  File "/opt/web2py/gluon/compileapp.py", line 116, in __call__
other_request = copy.copy(request)
  File "/usr/lib/python2.6/copy.py", line 87, in copy
rv = reductor(2)
TypeError: 'NoneType' object is not callable


response.write(LOAD('components','order_summary.load', args=[item_id], 
ajax=False))



Re: [web2py] Invalid view in 1.97.1

2011-06-29 Thread Bruno Rocha
By default, generic views will be disabled, it is a security issue,

but you can active at your own risk.

in any model file include


response.generic_patterns = ['*']


And it will enable all generic views.


Massimo needs to update the example app to get this working again.


On Thu, Jun 30, 2011 at 2:33 AM, Gary Herron  wrote:

> I'm getting an occasional "invalid view" error since I upgraded to 1.97.1.
>  Since  it was on a web site I was experimenting/learning with, I thought it
> might be my problem, but I no longer think so.
>
> On controllers with no corresponding view, there is supposed to be a
> generic view which handles the formating of the page -- but that seems to
> have gotten lost in 1.97.1 -- in at least some cases.
>
> Here is a page right out of web2py.com which (I'm pretty sure) used to
> work, but now exhibits this error:
> Visit
>
> http://web2py.com/examples/**simple_examples/hello6
> and get
>invalid view (simple_examples/hello6.html)
>
> Any clues, fixes, explanations would be welcome.
>
> Thanks,
>
> Gary Herron
>
> --
> Gary Herron, PhD.
> Department of Computer Science
> DigiPen Institute of Technology
> (425) 895-4418
>
>
>


-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: Invalid view in 1.97.1

2011-06-29 Thread Anthony
On Thursday, June 30, 2011 1:33:38 AM UTC-4, Gary wrote: 
>
> I'm getting an occasional "invalid view" error since I upgraded to 
> 1.97.1.  Since  it was on a web site I was experimenting/learning with, 
> I thought it might be my problem, but I no longer think so. 
>
> On controllers with no corresponding view, there is supposed to be a 
> generic view which handles the formating of the page -- but that seems 
> to have gotten lost in 1.97.1 -- in at least some cases.
>
This change is by design, due to a potential security vulnerability. See 
https://groups.google.com/d/msg/web2py/JR_pyGVfm_g/VlCfeKZWAvkJ.
 

> Here is a page right out of web2py.com which (I'm pretty sure) used to 
> work, but now exhibits this error:
> Visit
>  http://web2py.com/examples/simple_examples/hello6
> and get
>  invalid view (simple_examples/hello6.html)
>
Good catch -- that example should be fixed.
 
Anthony


Re: [web2py] Navigation in Web2py having an active link

2011-06-29 Thread Bruno Rocha
I did this for web2py.com using request.function, I created a function
tooggle_class which receives request.function and do this job.

here is an example that I use in http://CursoDePython.com.br

The code
https://gist.github.com/1055688



On Wed, Jun 29, 2011 at 5:16 PM, ADE  wrote:

> Hello I am trying to figure out how to check if the current page is
> active in web2py
>
> I have my navigation as follows
>
>
>Home
>What's On li>
>About PSTV li>
>Blog
>Episodes li>
>Trailers li>
>http://shop.pstv.tv";>Shop
>Contact Us a>
>
>
> if the current page is active I would like to set  to  class="selected">
>
> Any ideas how to do this
>
> *cheers
>
>


-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Invalid view in 1.97.1

2011-06-29 Thread Gary Herron
I'm getting an occasional "invalid view" error since I upgraded to 
1.97.1.  Since  it was on a web site I was experimenting/learning with, 
I thought it might be my problem, but I no longer think so.


On controllers with no corresponding view, there is supposed to be a 
generic view which handles the formating of the page -- but that seems 
to have gotten lost in 1.97.1 -- in at least some cases.


Here is a page right out of web2py.com which (I'm pretty sure) used to 
work, but now exhibits this error:

Visit
http://web2py.com/examples/simple_examples/hello6
and get
invalid view (simple_examples/hello6.html)

Any clues, fixes, explanations would be welcome.

Thanks,

Gary Herron

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418




[web2py] [OFF] Protect the web2py app of DDoS atack in GAE

2011-06-29 Thread Bruno Barbosa
know if my web2py app is being attacked in the GAE?

The requests have tripled suddenly and very resource consuming is the
outgoing badwidth.

Does anyone have tips to soften it in the GAE?


# ---
# Bruno Barbosa
# Web Developer - Linux user and Free Software Enthusiast
# http://algoritmizando.com
# http://twitter.com/bruninbsb
# ---


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Anthony
OK, I forgot the underscore before 'action' (I also forgot to include 
request.args in the form action URL) -- I think this should do it:
 
form.update(_class='no_trap', 
_action=URL('default','create_fvte.html',args=request.args))
 
 
Note, adding the .html extension to create_fvte above ensures that when the 
form is submitted back to this function, the extension will be .html, which 
is the extension that will be passed to the redirects.
 
Also, you should remove the following from create_fvte:
 
else:
response.flash = T('please fill out the form')
 
 
The problem with that is that when you redirect to the /creation URL, it 
reloads your components, and the response.flash from the components 
overrides the session.flash that was passed to the /creation page. Instead, 
put the following in the creation() function:
 
if not request.args:
response.flash = T('please fill out the form')
 
 
That will flash 'please fill out the form' when the /creation page is loaded 
without any arguments, but not otherwise.
 
With those small changes, I believe it all works as you want now.
 
Anthony
 

On Wednesday, June 29, 2011 9:57:09 PM UTC-4, Richard wrote:

> It clear validator if they trigger and don't know why the redirection don't 
> works neither... 
>
> Maybe pbreit is right and I should just forget about redirection... It's 
> probably what I will do for now, cause I can't spend any longer on this 
> picky stuff for now. It's part of the 20% percent stuff...
>
> Thanks anyway, I really appreciate your help.
>
> ;-)
>
> Richard
>
> On Wed, Jun 29, 2011 at 6:54 PM, Anthony  wrote:
>
>> Sorry, the **dict() isn't really needed -- you can just do:
>>  
>> form.element('form').update(**_class='no_trap', 
>> action=URL('default','create_**fvte'))
>>  
>>  
>> Actually, in the URL() call above, you might be better off doing 
>> 'create_fvte.html' to ensure it doesn't use the .load extension, which would 
>> then propagate to the redirect (unless you explicitly specify .hmtl in the 
>> redirect).
>>  
>> Anthony
>>   
>> On Wednesday, June 29, 2011 6:02:42 PM UTC-4, Anthony wrote:
>>
>>> Try this:
>>>  
>>> form = crud.create(db[table])
>>> form.element('form').update(dict(_class='no_trap', 
>>> action=URL('default','create_**fvte')))
>>>  
>>>  
>>> The _class='no_trap' should turn off the trapping of the form, and the 
>>> action=URL('default','create_**fvte') should ensure that the untrapped 
>>> form gets submitted back to the create_fvte function rather than the parent 
>>> page (i.e., the index function). Because the form will not be submitted via 
>>> ajax, the redirect should work as usual and reload the entire page.
>>>  
>>> Anthony
>>>
>>
>

[web2py] Re: Disabling Input Validation/Output Incoding

2011-06-29 Thread Anthony
Also, I think all the escaping is done by web2py's template engine, so you 
could avoid the escaping by skipping use of templates. To do that, have your 
controller action return a string of (unsafe) HTML instead of a dictionary 
of values to pass to a view -- the HTML string will be returned as the 
response to the browser without any sanitizing.

On Wednesday, June 29, 2011 10:47:06 PM UTC-4, Anthony wrote:

> Anything you put inside XML() will not be escaped (unless you set its 
> sanitize argument to True). See 
> http://web2py.com/book/default/chapter/05#XML.
>  
> Anthony
>
> On Wednesday, June 29, 2011 3:30:33 PM UTC-4, David Schoenheit wrote:
>
>> Hi, 
>>
>> I am using web2py to write an intentionally vulnerable web app in 
>> order to demonstrate basic cross site request forgery and cross site 
>> scripting attacks for educational purposes. I'm running into some 
>> problems where web2py is automatically html encoding my output and 
>> preventing the intended attacks from working. Is there a way to 
>> disable data sanitization in web2py? 
>>
>> Sorry if there is already a post on this subject, I searched for one 
>> and couldn't find anything. 
>>
>> Thanks for any help you can provide.
>
>

[web2py] Re: Disabling Input Validation/Output Incoding

2011-06-29 Thread Anthony
Anything you put inside XML() will not be escaped (unless you set its 
sanitize argument to True). See 
http://web2py.com/book/default/chapter/05#XML.
 
Anthony

On Wednesday, June 29, 2011 3:30:33 PM UTC-4, David Schoenheit wrote:

> Hi, 
>
> I am using web2py to write an intentionally vulnerable web app in 
> order to demonstrate basic cross site request forgery and cross site 
> scripting attacks for educational purposes. I'm running into some 
> problems where web2py is automatically html encoding my output and 
> preventing the intended attacks from working. Is there a way to 
> disable data sanitization in web2py? 
>
> Sorry if there is already a post on this subject, I searched for one 
> and couldn't find anything. 
>
> Thanks for any help you can provide.



Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
It clear validator if they trigger and don't know why the redirection don't
works neither...

Maybe pbreit is right and I should just forget about redirection... It's
probably what I will do for now, cause I can't spend any longer on this
picky stuff for now. It's part of the 20% percent stuff...

Thanks anyway, I really appreciate your help.

;-)

Richard

On Wed, Jun 29, 2011 at 6:54 PM, Anthony  wrote:

> Sorry, the **dict() isn't really needed -- you can just do:
>
> form.element('form').update(**_class='no_trap',
> action=URL('default','create_**fvte'))
>
>
> Actually, in the URL() call above, you might be better off doing
> 'create_fvte.html' to ensure it doesn't use the .load extension, which would
> then propagate to the redirect (unless you explicitly specify .hmtl in the
> redirect).
>
> Anthony
>
> On Wednesday, June 29, 2011 6:02:42 PM UTC-4, Anthony wrote:
>
>> Try this:
>>
>> form = crud.create(db[table])
>> form.element('form').update(dict(_class='no_trap',
>> action=URL('default','create_**fvte')))
>>
>>
>> The _class='no_trap' should turn off the trapping of the form, and the
>> action=URL('default','create_**fvte') should ensure that the untrapped
>> form gets submitted back to the create_fvte function rather than the parent
>> page (i.e., the index function). Because the form will not be submitted via
>> ajax, the redirect should work as usual and reload the entire page.
>>
>> Anthony
>>
>


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
I don't find it's that hard... I think it should be as simple to perform
redirection with the components than it is with the standard forms... But
there is a other level of complexity here with the Tabs plugin and it
becomes tricky to test it, I become mix up sometime  ;-)

Richard

On Wed, Jun 29, 2011 at 9:17 PM, pbreit  wrote:

> I switched it to this which saves the data and shows the empty form again:
>
> if table == 'ref_fnaregistry':
> redirect(URL('default', 'create_fvte.load',
> args='ref_fnaregistry'))
>
> I would very strongly advise simplifying your app. This is far more
> complicated than it needs to be and I suspect you will continue to run into
> a lot of hard to solve problems like this.
>


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread pbreit
I switched it to this which saves the data and shows the empty form again:

if table == 'ref_fnaregistry':
redirect(URL('default', 'create_fvte.load', 
args='ref_fnaregistry'))

I would very strongly advise simplifying your app. This is far more 
complicated than it needs to be and I suspect you will continue to run into 
a lot of hard to solve problems like this.


[web2py] Re: new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread niknok
+1

Another golden egg from the proverbial goose ... or gander, in this
case. :P

Thank you Bruno

On Jun 29, 10:33 pm, Bruno Rocha  wrote:
> Hi,
>
> I just created a new plugin for stepped form wizards.
>
> I made it last night, so it is not tested very well, I would like your help
> to test it.
>
> web2py PowerFormWizard Plugin - based on Jquery Stepy
>
> - Steps
> - Customizable titles
> - Server side validation
> - Client side validation (with jquery validate)
> - Custom css
> - JS Callbaks
> - Error images
>
> Take a look:http://labs.blouweb.com/powerformwizard
>
> This plugin is the second plugin of blouweb PowerPlugins, I am now starting
> the third one which I hope to have the first version soon.
>
> http://labs.blouweb.com
>
> Suggestions, testers, issues, contributions etc on 
> bitbucket:https://bitbucket.org/rochacbruno/powerformwizard
>
> Hope it helps someone!
>
> Thanks.
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
> [ Aprenda Python:http://CursoDePython.com.br]
> [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
> [ Consultoria em desenvolvimento web:http://www.blouweb.com]


Re: [web2py] Using request.env.http_referrer to link to previous page

2011-06-29 Thread Jonathan Lundell
On Jun 29, 2011, at 1:18 PM, Richard Arts wrote:
> 
> Can somebody point out to me how to use the request.env.http_referrer
> to link to the previous page?
> 
> So far I have tried the following in the template file:
> {{=A('Back', _href=URL(request.env.http_referrer))}}
> but it links to the current page.
> 
> Trying to supply the http_referrer through a dict does not work either.
> 
> I'm certain I must be overlooking something...
> 
> Using 1.97.1.

It's not your problem, but it's 'http_referer'; it got misspelled somewhere 
back in the mists of Internet time.

It's an absolute URL, so URL() won't do anything useful with it. You'll need 
something more like _href=request.env.http_referer.

Alternatively, you can parse it and pull out the bits that you need to pass to 
URL() (assuming that the referring page is in your app).

Generally speaking, I think you're better off tracking the referral chain 
internally, rather than relying on http_referer.

[web2py] Disabling Input Validation/Output Incoding

2011-06-29 Thread David Schoenheit
Hi,

I am using web2py to write an intentionally vulnerable web app in
order to demonstrate basic cross site request forgery and cross site
scripting attacks for educational purposes. I'm running into some
problems where web2py is automatically html encoding my output and
preventing the intended attacks from working. Is there a way to
disable data sanitization in web2py?

Sorry if there is already a post on this subject, I searched for one
and couldn't find anything.

Thanks for any help you can provide.


[web2py] Using request.env.http_referrer to link to previous page

2011-06-29 Thread Richard Arts
Hello,

Can somebody point out to me how to use the request.env.http_referrer
to link to the previous page?

So far I have tried the following in the template file:
{{=A('Back', _href=URL(request.env.http_referrer))}}
but it links to the current page.

Trying to supply the http_referrer through a dict does not work either.

I'm certain I must be overlooking something...

Using 1.97.1.

Thanks in advance,
Richard


[web2py] Calculate field value only once

2011-06-29 Thread DanB
Sorry for the repeat question, but I'm trying to figure out how to
create a calculated field that only populates when the record is
originally created (i.e. calculate on create, but do not recalculate
on update). Same question as here:

http://groups.google.com/group/web2py/browse_thread/thread/1b29979f2c63f225/085221abcb401ff0?lnk=gst&q=calculated+field#085221abcb401ff0

Is there a way to do this "out of the box"? Or is it just better to
write a function that checks for an existing value before running and
returning the calculation.

Thanks in advance!

P.S. *Amazing* framework! Just got started and I'm loving every new
thing I learn!


[web2py] How to prevent eclipse from formatting sections of python embedded in your .html files.

2011-06-29 Thread Dave
This is my first post here. Hopefully I'm posting where I should and
that this hasn't been covered already. I am hoping that someone else
has a better solution.

Using eclipse to edit .html files that have embedded python can be a
little frustrating if you (like me) have a habit of pressing ctrl+shift
+f to ask eclipse to format the file for you. Sections of embedded
python code that look like this:
{{...}}
{{...}}
{{...}}
{{...}}

will end up looking like this:
{{...}}{{...}}{{...}}{{...}}

One way to prevent eclipse from playing with the code is by  doing
this:

{{=XML("<" "/pre>")}}
{{...}}
{{...}}
{{...}}
{{...}}
{{=XML("<" "pre>")}}


Does anyone know of a better way to achieve this result?

Thanks!

-Dave


[web2py] Navigation in Web2py having an active link

2011-06-29 Thread ADE
Hello I am trying to figure out how to check if the current page is
active in web2py

I have my navigation as follows


Home
What's On
About PSTV
Blog
Episodes
Trailers
http://shop.pstv.tv";>Shop
Contact Us


if the current page is active I would like to set  to 

Any ideas how to do this

*cheers



Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Anthony
Sorry, the **dict() isn't really needed -- you can just do:
 
form.element('form').update(_class='no_trap', 
action=URL('default','create_fvte'))
 
 
Actually, in the URL() call above, you might be better off doing 
'create_fvte.html' to ensure it doesn't use the .load extension, which would 
then propagate to the redirect (unless you explicitly specify .hmtl in the 
redirect).
 
Anthony

On Wednesday, June 29, 2011 6:02:42 PM UTC-4, Anthony wrote:

> Try this:
>  
> form = crud.create(db[table])
> form.element('form').update(**dict(_class='no_trap', 
> action=URL('default','create_fvte')))
>  
>  
> The _class='no_trap' should turn off the trapping of the form, and the 
> action=URL('default','create_fvte') should ensure that the untrapped form 
> gets submitted back to the create_fvte function rather than the parent page 
> (i.e., the index function). Because the form will not be submitted via ajax, 
> the redirect should work as usual and reload the entire page.
>  
> Anthony
>


Re: [web2py] Re: best practice for an upload with a very long file name

2011-06-29 Thread pbreit
I just ran into a problem with the Ebay API that does not accept image URL 
lengths over 150 chars. Is the only immediate fix to make that edit to 
gluon/sql.py? Maybe it should be even shorter of configurable? Is that much 
entropy needed?

[web2py] Image upload filenames too long

2011-06-29 Thread pbreit
The filename that Web2py is giving my uploaded images is too long. Is it 
possible to make it shorter?

For example (i need them to be under 150 chars):
item.image.8651e61b27b66998.6974656d2e696d6167652e396363373962663466616535313834392e3533353434313566333233323331333432653461353034375f646973706c61792e6a706567.jpeg


Re: [web2py] slices and generic.load

2011-06-29 Thread Anthony
On Wednesday, June 29, 2011 5:08:26 PM UTC-4, Richard wrote: 
>
> It the app associate to the slice... I made a comment. If the 
> product/create.load view was not created the page at app/product/create will 
> be blank... Create the product/create.load view fix it and may be it 
> requires to create product/create.html too since I create both... But didn't 
> test if only one of both is enought

 
Yes, that's the same issue as has been discussed before regarding generic 
views and is not unique to that slice. Due to a potential security issue, 
generic views are now disabled by default and can be enabled by specifying 
response.generic_patterns. The 'welcome' app includes a statement in db.py 
that enables all generic views, but only for local requests.
 
Also, response.generic_patterns is not getting passed to non-ajax 
components, so generic views aren't working at all for non-ajax components, 
unless you explicitly set response.view='generic.[extension]'. This problem 
will be fixed soon.
 
Anthony
 


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Anthony
Try this:
 
form = crud.create(db[table])
form.element('form').update(**dict(_class='no_trap', 
action=URL('default','create_fvte')))
 
 
The _class='no_trap' should turn off the trapping of the form, and the 
action=URL('default','create_fvte') should ensure that the untrapped form 
gets submitted back to the create_fvte function rather than the parent page 
(i.e., the index function). Because the form will not be submitted via ajax, 
the redirect should work as usual and reload the entire page.
 
Anthony


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
I will try to make a demo app to reproduce the wrong behavior and you could
maybe have a look at it...

I am not sure to know how to implement what you suggest...

Richard

On Wed, Jun 29, 2011 at 4:48 PM, Anthony  wrote:

> On Wednesday, June 29, 2011 4:11:23 PM UTC-4, Richard wrote:
>>
>> ajax_trap is ignored and assumed to be True if ajax=True.
>>
>>  Earlier tests with orther versions had a different behavior and I
>> conceived ajax_trap=False as a kind of two purposes option. On one hand when
>> ajax=False it could be use to keep the next form into ajax... And when
>> ajax=True it works as a mean to stop trapping the next form into ajax.
>>
>
> ajax_trap has always been ignored when ajax=True -- in other words, when
> ajax=True, the component will always trap forms submitted. Actually, it
> looks like you can override that by adding a 'no_trap' class to your form.
> But in that case, the form will get submitted to the parent page controller
> function, not to the original controller function that generated the form,
> and you probably don't want that. You may be able to explicitly set the form
> action to post to the component action, and along with setting
> class='no_trap', that might solve your problem.
>
> Anthony
>
>
>


Re: [web2py] slices and generic.load

2011-06-29 Thread Richard Vézina
It the app associate to the slice... I made a comment. If the
product/create.load view was not created the page at app/product/create will
be blank... Create the product/create.load view fix it and may be it
requires to create product/create.html too since I create both... But didn't
test if only one of both is enought

Richard

On Wed, Jun 29, 2011 at 4:53 PM, Anthony  wrote:

> Changes to web2py are supposed to be backward compatible (at least changes
> to the documented API) -- what specifically isn't working? Was it working in
> 1.96 (or previous), but not in 1.97?
>
> On Wednesday, June 29, 2011 3:43:42 PM UTC-4, Richard wrote:
>
>> Hello,
>>
>> With the last update I presume that many slice (app) are not working
>> anymore for example : http://www.web2pyslices.com/**
>> main/slices/take_slice/121
>>
>> The app coming from here not working before I create "product/create.load"
>> view :
>> https://bitbucket.org/**bmeredyk/web2py-select_or_add_**option-widget/src
>>
>> Richard
>>
>


Re: [web2py] slices and generic.load

2011-06-29 Thread Anthony
Changes to web2py are supposed to be backward compatible (at least changes 
to the documented API) -- what specifically isn't working? Was it working in 
1.96 (or previous), but not in 1.97?

On Wednesday, June 29, 2011 3:43:42 PM UTC-4, Richard wrote:

> Hello, 
>
> With the last update I presume that many slice (app) are not working 
> anymore for example : 
> http://www.web2pyslices.com/main/slices/take_slice/121
>
> The app coming from here not working before I create "product/create.load" 
> view :
> https://bitbucket.org/bmeredyk/web2py-select_or_add_option-widget/src
>
> Richard
>


[web2py] Re: web2py and async monkey patching

2011-06-29 Thread graeme
I tested with Eventlet and Gunicorn with Eventlet workers, and both
can be made to work. I loaded the page in two web browsers
concurrently rather than calling from the console, but I think I can
assume that this is immaterial?

Eventlet monkey patching only works if it is called before any imports
of the patched libraries happen, so it cannot just be dropped into
anyserver.py as is, but it is trivial to write a script to use it.

For Gunicorn, there is a bug in the gunicorn method (incidentally, it
is also called gnuicorn) in anyserver.py (too many arguments given to
Arbiter init) which stops it working at all. I could not find the docs
I needed to fix it, so I wrote this in a file called
web2py_eventlet.py:

from eventlet import monkey_patch
monkey_patch(all=True)
import gluon.main
app = gluon.main.wsgibase

and ran gunicorn with

gunicorn -w 1 -k eventlet web2py_eventlet:app

it also works fine.

It is possible to monkey patch psycopg to be always async as well, but
I do not think this will work with web2py as the connection.commit()
and connection.rollback() methods will not work as expected.

That brings me to another problem. I wonder if it is worth bothering
with an async web server, given that the database is going to require
a thread or process per concurrent request anyway. Is there anyway
around that? Does a request need to tie up a database connection while
waiting for something else to happen?

On Jun 23, 6:08 pm, Massimo Di Pierro 
wrote:
> The test is easy:
>
> def index():
>     import time
>     from gluon import current
>     print current.request.uuid
>     sleep(10)
>     print current.request.uuid
>     return 'done!'
>
> call this action twice from console within less then 10 seconds from
> each other what is the output?
> if it looks
> A
> B
> A
> B
> than the monkey patching is correct if it looks like
> A
> B
> B
> B
> then it is not. If it looks like
> A
> A
> B
> B
> then we are not testing right. A,B are uuids.
>
> massimo
>
> On Jun 23, 5:22 am, graeme  wrote:
>
>
>
>
>
>
>
> > Thanks for the reply.
>
> > So what anyserver.py does with gevent is not recommended? It calls
> > monkey.patch_all() which patches threading to use green threads.
>
> > Is this something that ought to work but is just untested? web2py is
> > pure python so the monkey patching should make thread locals into
> > greenlet locals, right? If that is so, then is the testing something I
> > could do myself, or does it need to be done by someone who knows the
> > internals of web2py?
>
> > Graeme
>
> > On Jun 23, 8:10 am, Massimo Di Pierro 
> > wrote:
>
> > > I am not sure this does not break the new internal web2py design that
> > > uses thread locals.
> > > I would not useasyncunless we have tested this more.
>
> > > Massimo
>
> > > On Jun 22, 6:44 pm, graeme  wrote:
>
> > > > I can see that anyserver.py uses monkey patching to make the standard
> > > > library cooperative with gevent.
>
> > > > Could the same be done with eventlet and with Gunicorn (with eventlet,
> > > > gevent or both)?
>
> > > > Eventlet has the advantages of being (AFAIK) pure python, and can
> > > > monkey patch psycopg as well as the standard library.
>
> > > > Has anyone measured whether it is significantly more memory efficient
> > > > to run web2py on green threads?
>
> > > > My use case is that I will have long running controllers (while
> > > > fetching data from web services). I would like it to be memory
> > > > efficient, but I am nt* looking for massive scalability or extreme
> > > > speed. I do not want it to be trivial to DOS (so I need either threads
> > > > or green threads to handle the long running controllers).


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Anthony
On Wednesday, June 29, 2011 4:11:23 PM UTC-4, Richard wrote: 
>
> ajax_trap is ignored and assumed to be True if ajax=True. 
>
>  Earlier tests with orther versions had a different behavior and I 
> conceived ajax_trap=False as a kind of two purposes option. On one hand when 
> ajax=False it could be use to keep the next form into ajax... And when 
> ajax=True it works as a mean to stop trapping the next form into ajax.
>
 
ajax_trap has always been ignored when ajax=True -- in other words, when 
ajax=True, the component will always trap forms submitted. Actually, it 
looks like you can override that by adding a 'no_trap' class to your form. 
But in that case, the form will get submitted to the parent page controller 
function, not to the original controller function that generated the form, 
and you probably don't want that. You may be able to explicitly set the form 
action to post to the component action, and along with setting 
class='no_trap', that might solve your problem.
 
Anthony
 
  


[web2py] login on dialog

2011-06-29 Thread Sebastian E. Ovide
Hi All,

is there an easy way to create a popup like dialog for logins ? I mean using
web2py auth

something like this: http://web2py.uservoice.com/forums/42577-general when
you click on "like"

thanks

-- 
Sebastian E. Ovide


Re: [web2py] slices and generic.load

2011-06-29 Thread Bruno Rocha
I think in web2pyslices2 will need to have some editors.

By now we can use the comments for this.

http://zerp.ly/rochacbruno
Em 29/06/2011 16:43, "Richard Vézina" 
escreveu:
> Hello,
>
> With the last update I presume that many slice (app) are not working
anymore
> for example : http://www.web2pyslices.com/main/slices/take_slice/121
>
> The app coming from here not working before I create "product/create.load"
> view :
> https://bitbucket.org/bmeredyk/web2py-select_or_add_option-widget/src
>
> Richard


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
ajax_trap is ignored and assumed to be True if ajax=True.

Earlier tests with orther versions had a different behavior and I conceived
ajax_trap=False as a kind of two purposes option. On one hand when
ajax=False it could be use to keep the next form into ajax... And when
ajax=True it works as a mean to stop trapping the next form into ajax.

I would like to have the validator trapped but not the next form... It was
working like that before but not anymore...

Richard

On Wed, Jun 29, 2011 at 3:55 PM, Richard Vézina  wrote:

> I don't understand that from the book :
>
> ajax_trap=True means that any form submission in the DIV must be captured
> and submitted via Ajax, and the response must be rendered inside the DIV.
> ajax_trap=False indicates that forms must be submitted normally, thus
> reloading the entire page. ajax_trap is ignored and assumed to be True if
> ajax=True.
>
> Let me explain a bit my problem :
>
> I use jQuery UI Tabs with a component into a couples of tabs and I manage
> those component with a unique function since the differents form-table
> passed like this crud.create(request.args(0)...
>
> So I redirect if form submit like this :
>
> if form.accepts(request.vars, session):
> session.flash = T('form accepted')
> request.extension = None
> if table == 'ref_fnaregistry':
> #redirect(URL(request.application,c='default',f='index.html'))
> redirect(URL(request.application,c='ref',
> f='creation.html',args=1))
> elif table == 'ref_vregistry':
> redirect(URL(request.application,c='ref',
> f='creation.html',args=2))
> elif table == 'ref_tregistry':
> redirect(URL(request.application,c='ref',
> f='creation.html',args=3))
>
>
> But the URL in the nav url box not change that let me think that the
> redirection is trap into ajax... Then there is a other sign with the
> calendar that show up but not return any date on clic...
>
> If I redirect on :
> redirect(URL(request.application,c='default',f='index.html')) I get the
> whole site into my first tab...
>
> Richard
>
> On Wed, Jun 29, 2011 at 3:38 PM, Anthony  wrote:
>
>> On Wednesday, June 29, 2011 3:29:33 PM UTC-4, Richard wrote:
>>>
>>> Could it be possible that my compoenent ajax_trap=False option is not
>>> considering??
>>
>>
>> ajax_trap isn't related to redirects -- it only applies when ajax=False --
>> in that case, when ajax_trap=True, it tells web2py to trap form submissions
>> in the component and post them to the component's action rather than to the
>> parent page's action
>>
>> Anthony
>>
>
>


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
I don't understand that from the book :

ajax_trap=True means that any form submission in the DIV must be captured
and submitted via Ajax, and the response must be rendered inside the DIV.
ajax_trap=False indicates that forms must be submitted normally, thus
reloading the entire page. ajax_trap is ignored and assumed to be True if
ajax=True.

Let me explain a bit my problem :

I use jQuery UI Tabs with a component into a couples of tabs and I manage
those component with a unique function since the differents form-table
passed like this crud.create(request.args(0)...

So I redirect if form submit like this :

if form.accepts(request.vars, session):
session.flash = T('form accepted')
request.extension = None
if table == 'ref_fnaregistry':
#redirect(URL(request.application,c='default',f='index.html'))
redirect(URL(request.application,c='ref',
f='creation.html',args=1))
elif table == 'ref_vregistry':
redirect(URL(request.application,c='ref',
f='creation.html',args=2))
elif table == 'ref_tregistry':
redirect(URL(request.application,c='ref',
f='creation.html',args=3))


But the URL in the nav url box not change that let me think that the
redirection is trap into ajax... Then there is a other sign with the
calendar that show up but not return any date on clic...

If I redirect on :
redirect(URL(request.application,c='default',f='index.html')) I get the
whole site into my first tab...

Richard

On Wed, Jun 29, 2011 at 3:38 PM, Anthony  wrote:

> On Wednesday, June 29, 2011 3:29:33 PM UTC-4, Richard wrote:
>>
>> Could it be possible that my compoenent ajax_trap=False option is not
>> considering??
>
>
> ajax_trap isn't related to redirects -- it only applies when ajax=False --
> in that case, when ajax_trap=True, it tells web2py to trap form submissions
> in the component and post them to the component's action rather than to the
> parent page's action
>
> Anthony
>


[web2py] slices and generic.load

2011-06-29 Thread Richard Vézina
Hello,

With the last update I presume that many slice (app) are not working anymore
for example : http://www.web2pyslices.com/main/slices/take_slice/121

The app coming from here not working before I create "product/create.load"
view :
https://bitbucket.org/bmeredyk/web2py-select_or_add_option-widget/src

Richard


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Anthony
On Wednesday, June 29, 2011 3:29:33 PM UTC-4, Richard wrote: 
>
> Could it be possible that my compoenent ajax_trap=False option is not 
> considering??

 
ajax_trap isn't related to redirects -- it only applies when ajax=False -- 
in that case, when ajax_trap=True, it tells web2py to trap form submissions 
in the component and post them to the component's action rather than to the 
parent page's action
 
Anthony


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
Could it be possible that my compoenent ajax_trap=False option is not
considering??

Richard

On Wed, Jun 29, 2011 at 3:27 PM, Richard Vézina  wrote:

> No still propagate... It trap the whole site if use for example
> : redirect(URL(request.application,c='default',f='index.html'))
>
> Richard
>
>
> On Wed, Jun 29, 2011 at 3:07 PM, pbreit  wrote:
>
>> Either of these should work:
>> redirect(URL('default', 'home', extension=''))
>> redirect(URL('default', 'home.html'))
>>
>
>


Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
No still propagate... It trap the whole site if use for example
: redirect(URL(request.application,c='default',f='index.html'))

Richard

On Wed, Jun 29, 2011 at 3:07 PM, pbreit  wrote:

> Either of these should work:
> redirect(URL('default', 'home', extension=''))
> redirect(URL('default', 'home.html'))
>


[web2py] Re: matplotlib image map using web2py

2011-06-29 Thread G
To follow up, if I were to go about this in a brute force manner, by
simply saving the dynamically generated figure to a randomly generated
file and then passing that file to an AREA MAP / IMG tag, where in the
web2py directory structure would be the recommended place to do so? I
suppose using the SQLLITE database might be a natural option. Any
opinions? Are there any examples of doing something like this? I
suppose it's vaguely similar to a photo album application, except the
photos are dynamically created and deleted after use.
Thanks,
G

On Jun 28, 4:50 pm, G  wrote:
> Hello,
> I would like to make a clickable image map of a scatter plot in my
> web2py application. The scatter plot will be dynamically generated. I
> can use the technique that Massimo has shown many times to generate
> matplotlib plots in web2py. The trouble is that the technique relies
> on a controller that returns a cStringIO stream and simply sets the
> headers for the browser to interpret the stream as a PNG image. This
> works fine when you just need to generate a plot. But the techniques
> for generating the corresponding clickable regions for an image map
> require getting the pixel coordinates of the scatter points from the
> plot.
>
> Here are some examples of people generating clickable image maps with
> matplotlib that I am referring 
> to:http://hackmap.blogspot.com/2008/06/pylab-matplotlib-imagemap.htmlhttp://www.dalkescientific.com/writings/diary/archive/2005/04/24/inte...http://www.pageofguh.org/random/668
>
> And here is one of Massimo's examples of using matplotlib with 
> web2py:http://www.web2py.com/appliances/default/show/72
>
> I appreciate any suggestions.
>
> Thanks,
> G


Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread pbreit
Oh, good point, my bad.

Re: [web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread pbreit
Either of these should work:
redirect(URL('default', 'home', extension=''))
redirect(URL('default', 'home.html'))


Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread Anthony
On Wednesday, June 29, 2011 2:44:40 PM UTC-4, pbreit wrote: 
>
> I usually just do {{if form:}}{{=form}}{{pass}}

 
He was doing that, but that will throw an error if the action doesn't return 
an object with a 'form' key in the dict.
 
Anthony


[web2py] SECOND TRY TO GET IT ON THE LIST how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
Hello,

I have problem with propagation of load extension I think with redirect that
not reload nav pages and the redirect to URL in nav box stay the same... +
Calendar plugin not working correctly on redirected pages...

Here what I found about my problem :
http://groups.google.com/group/web2py/browse_thread/thread/67e2a28a2e8ec7d6?pli=1

I tried what Jonathan suggested in the threads : request.extension=None but
it seems that .load still propagate... First the url that I pass in my
redirect should appear in the navigation address bar. Second the validator
don't show up on a redirected form that fail...

Help please ;-)

Richard


[web2py] Re: Use the ORM for a robot?

2011-06-29 Thread Anthony
On Wednesday, June 29, 2011 1:08:19 PM UTC-4, Nick Arnett wrote: 
>
> I'm just getting to know Web2Py after working with Django a fair bit.  I 
> have robots that gather data that I would like to insert using the Web2Py 
> ORM, but I can't quite figure out the right way to do that.  If I put the 
> bot scripts in the modules directory, I don't seem to have access to the 
> ORM.

 
Only web2py model, controller, and view files have access to the web2py 
globals -- in a module, you have to explicitly import web2py stuff. You 
could do:
 
from gluon import *   # to get all the web2py globals
 
or
 
from gluon.dal import DAL, Field  # for just the DAL stuff
 
 
If you're importing from outside web2py, make sure the web2py folder is in 
your sys.path. Or, since the DAL can be used independently of the web2py 
framework, you could just copy the /gluon/dal.py file to wherever you want 
to use it.
 

>   When I run a module in the controllers directory, I can import from the 
> modules directory with a simple import even though the documentation seems 
> to say that I should use local_import... which doesn't work.

 
Yes, as of 1.96.1, you can use regular Python import statements to import 
from the app's /modules folder, and local_import is deprecated (and I think 
may not work if your modules import other modules).
 

>  And running a module in the controllers directory doesn't seem to give it 
> access to the ORM, either.

 
No, just putting a module in the controllers directory wouldn't give it 
access to the DAL or any web2py globals. When a request comes in, the 
particular controller requested is executed in an environment with all the 
web2py globals defined, but that wouldn't apply to a module dumped in the 
controllers folder.
 

>  
> So... I'm lost and not finding the answer in the docs.  In Django, I would 
> just put the appropriate imports in the robot scripts, but I get that that's 
> not the Web2Py way!
>
 
If you're not creating an app that receives requests and just want to use 
the DAL as a module with your robot scripts, you can probably just pull out 
the dal.py file and use it as a standalone Python module, importing as 
usual.
 
Anthony
 


Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread David J.

Yeah;

I a using latest trunk;

I will try again.

Perhaps I am making a mistake? like I said it worked with Bruno's 
suggestion.




On 6/29/11 2:33 PM, Anthony wrote:

Hmm, it works fine for me. Did you do:
{{if 'form' in response._vars:}}
{{=form}}
{{pass}}
For me, if my controller returns dict(..., form=some_form_object), the 
form gets displayed, but if the dict does not include a 'form' key, 
nothing is displayed, and there is no error.

Anthony

On Wednesday, June 29, 2011 12:50:00 PM UTC-4, David J wrote:

Strange this did not work.


But Bruno's solution did.

if 'form' in globals():
   {{= form }}


On 6/29/11 11:40 AM, Anthony wrote:

If you want to test specifically whether 'form' was returned in
the dict of the controller action (as opposed to possibly being
defined in a model file), you can also do:
{{if 'form' in response._vars:}}

On Wednesday, June 29, 2011 11:02:06 AM UTC-4, rochacbruno wrote:

{{if 'form' in globals():}}
{{=form }}
{{pass}}



On Wed, Jun 29, 2011 at 12:00 PM, David J.
 wrote:

I am wondering why if I dont return anything in my dict
and in my view

{{if form:}}
{{= form }}
{{pass}}

I get an exception.


S'Traceback (most recent call last):\n  File
"/apps/www/web2py.trunk/gluon/restricted.py", line 192,
in restricted\nexec ccode in environment\n  File

"/apps/www/web2py.trunk/applications/sms/views/default/campaign.html",
line 87, in \nNameError: name \'form\' is not
defined\n'


I want to be able to check if a key is there before I use it.

Thanks.








Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread pbreit
I usually just do {{if form:}}{{=form}}{{pass}}

Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread Anthony
Hmm, it works fine for me. Did you do:
 
{{if 'form' in response._vars:}}
{{=form}}
{{pass}}
For me, if my controller returns dict(..., form=some_form_object), the form 
gets displayed, but if the dict does not include a 'form' key, nothing is 
displayed, and there is no error.
 
Anthony

On Wednesday, June 29, 2011 12:50:00 PM UTC-4, David J wrote:

> Strange this did not work.
>
>
> But Bruno's solution did.
>
> if 'form' in globals():
>{{= form }}
>
>
> On 6/29/11 11:40 AM, Anthony wrote: 
>
> If you want to test specifically whether 'form' was returned in the dict of 
> the controller action (as opposed to possibly being defined in a model 
> file), you can also do:
>  
> {{if 'form' in response._vars:}}
>  
>
> On Wednesday, June 29, 2011 11:02:06 AM UTC-4, rochacbruno wrote:
>
>>  {{if 'form' in globals():}}
>> {{=form }}
>> {{pass}}
>>
>>
>>
>> On Wed, Jun 29, 2011 at 12:00 PM, David J.  wrote:
>>
>>> I am wondering why if I dont return anything in my dict and in my view
>>>
>>> {{if form:}}
>>> {{= form }}
>>> {{pass}}
>>>
>>> I get an exception.
>>>
>>>
>>> S'Traceback (most recent call last):\n  File 
>>> "/apps/www/web2py.trunk/gluon/restricted.py", line 192, in restricted\n   
>>>  exec ccode in environment\n  File 
>>> "/apps/www/web2py.trunk/applications/sms/views/default/campaign.html", line 
>>> 87, in \nNameError: name \'form\' is not defined\n'
>>>
>>>
>>> I want to be able to check if a key is there before I use it.
>>>
>>> Thanks.
>>>
>>
>>
>

[web2py] Use the ORM for a robot?

2011-06-29 Thread Nick Arnett
I'm just getting to know Web2Py after working with Django a fair bit.  I
have robots that gather data that I would like to insert using the Web2Py
ORM, but I can't quite figure out the right way to do that.  If I put the
bot scripts in the modules directory, I don't seem to have access to the
ORM.  When I run a module in the controllers directory, I can import from
the modules directory with a simple import even though the documentation
seems to say that I should use local_import... which doesn't work.  And
running a module in the controllers directory doesn't seem to give it access
to the ORM, either.

So... I'm lost and not finding the answer in the docs.  In Django, I would
just put the appropriate imports in the robot scripts, but I get that that's
not the Web2Py way!

Can anybody point me to an example of this sort of thing - inserting data
that isn't coming from a request - or give me an idea of the right way to
organize it into the Web2Py structure?

Thanks in advance.

Nick


Re: [web2py] routes and SEO question

2011-06-29 Thread Jonathan Lundell
On Jun 29, 2011, at 9:40 AM, Bruno Rocha wrote:
> In default.py just create a function called default.
> 
> def default():
> if request.args(0):
> redirect(URL("default", request.args(0))
> 
> This will act as a proxy.
> 
> 

This depends on which router you use. The parametric router will continue to 
handle the old (unshortened) URLs just fine.

> http://zerp.ly/rochacbruno
> 
> Em 29/06/2011 13:27, "elffikk"  escreveu:
> > how is reacting google (and other search engines) at urls changes ?
> > I want to do a simple thing: to remove /default/ from all urls (I
> > don't have other controllers)
> > I already have a few thousands indexed pages by google
> > 
> > thank you




[web2py] Re: new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread blackthorne
yes! awesome!

just came to my mind having such a system for multiple forms/wizards
managed by the db. So you could easily add forms like that in your app
and manage them. Good for more complex apps like SAP.

On Jun 29, 5:17 pm, GoldenTiger  wrote:
> iujuu
>
> Bruno, it`s the best web2py plugin for me
>
> congratulations + thanks


Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread David J.

Strange this did not work.


But Bruno's solution did.

if 'form' in globals():
   {{= form }}


On 6/29/11 11:40 AM, Anthony wrote:
If you want to test specifically whether 'form' was returned in the 
dict of the controller action (as opposed to possibly being defined in 
a model file), you can also do:

{{if 'form' in response._vars:}}

On Wednesday, June 29, 2011 11:02:06 AM UTC-4, rochacbruno wrote:

{{if 'form' in globals():}}
{{=form }}
{{pass}}



On Wed, Jun 29, 2011 at 12:00 PM, David J. 
wrote:

I am wondering why if I dont return anything in my dict and in
my view

{{if form:}}
{{= form }}
{{pass}}

I get an exception.


S'Traceback (most recent call last):\n  File
"/apps/www/web2py.trunk/gluon/restricted.py", line 192, in
restricted\nexec ccode in environment\n  File
"/apps/www/web2py.trunk/applications/sms/views/default/campaign.html",
line 87, in \nNameError: name \'form\' is not defined\n'


I want to be able to check if a key is there before I use it.

Thanks.






Re: [web2py] routes and SEO question

2011-06-29 Thread Bruno Rocha
In default.py just create a function called default.

def default():
if request.args(0):
redirect(URL("default", request.args(0))

This will act as a proxy.

http://zerp.ly/rochacbruno
Em 29/06/2011 13:27, "elffikk"  escreveu:
> how is reacting google (and other search engines) at urls changes ?
> I want to do a simple thing: to remove /default/ from all urls (I
> don't have other controllers)
> I already have a few thousands indexed pages by google
>
> thank you


[web2py] Re: new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread GoldenTiger
iujuu

Bruno, it`s the best web2py plugin for me

congratulations + thanks 


[web2py] Re: export to csv - no header row

2011-06-29 Thread Massimo Di Pierro
No

On Jun 29, 10:39 am, Ed Greenberg  wrote:
> Looking at the code to gluon.dal.Rows.export_to_csv(), it does not
> seem possible to suppress the header on the first line.  Is there a
> way to do this?


[web2py] Re: Localising decimal values in form fields

2011-06-29 Thread Massimo Di Pierro
IS_DECIMAL_IN_RANGE and IS_FLOAT take a an attribute called dot="."
which you can internationalize

IS_DECIMAL_IN_RANGE(dot=T("."))


On Jun 29, 5:39 am, tomtom5  wrote:
> I'm currently diving into web2py and got a problem localising input/
> output of Decimal/Double form fields according to the users (browsers)
> locale. I understand the mechanism of internationalising messages with
> T(..), but that doesn't seem to help me further. What I need is, that
> for example a german user may input a decimal value as 123.456,78
> while an american user will use 123 456.78 as input/output format. I
> found methods to define the decimal separator char in the constructor
> of the IS_DECIMAL_IN_RANGE validator, but this is very rudimentary and
> will not be user-locale aware. Is there a way to solve the problem out
> of the box or should I create new validators or widgets for such a
> task?
> Thanks for advise


[web2py] Re: CAS

2011-06-29 Thread Massimo Di Pierro
Try use the latest web2py with

Auth(cas_provider='http://default/user/cas')

and it should be smart about passing over field values.
Ina ny case CAS can be customized a lot. Loot at the code examples in

gluon/contrib/login_methods/cas_auth.py



On Jun 29, 3:28 am, sagar  wrote:
> Hi,
>
> I have to use CAS for two of my apps.
>
> Its working fine when both having default same registration process.
>
> Here one of my app has some extra fields in registration like mobile
> no etc what is ideal way to deal with it in such a cases.
>
> Is there any documentation about CAS to get good understanding of it.
>
> Thanks,
> Sagar


Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread Anthony
If you want to test specifically whether 'form' was returned in the dict of 
the controller action (as opposed to possibly being defined in a model 
file), you can also do:
 
{{if 'form' in response._vars:}}
 

On Wednesday, June 29, 2011 11:02:06 AM UTC-4, rochacbruno wrote:

>  {{if 'form' in globals():}}
> {{=form }}
> {{pass}}
>
>
>
> On Wed, Jun 29, 2011 at 12:00 PM, David J.  wrote:
>
>> I am wondering why if I dont return anything in my dict and in my view
>>
>> {{if form:}}
>> {{= form }}
>> {{pass}}
>>
>> I get an exception.
>>
>>
>> S'Traceback (most recent call last):\n  File 
>> "/apps/www/web2py.trunk/gluon/**restricted.py", line 192, in restricted\n 
>>exec ccode in environment\n  File "/apps/www/web2py.trunk/**
>> applications/sms/views/**default/campaign.html", line 87, in 
>> \nNameError: name \'form\' is not defined\n'
>>
>>
>> I want to be able to check if a key is there before I use it.
>>
>> Thanks.
>>
>
>

[web2py] export to csv - no header row

2011-06-29 Thread Ed Greenberg
Looking at the code to gluon.dal.Rows.export_to_csv(), it does not
seem possible to suppress the header on the first line.  Is there a
way to do this?


[web2py] Re: plugins

2011-06-29 Thread Anthony
Adding to the plugins thread...
 
PowerFormWizard:
https://groups.google.com/d/msg/web2py/VOlroPs5Gyo/5khwrMTjwz0J
http://labs.blouweb.com/powerformwizard
 
Thanks, Bruno.
 


[web2py] Re: new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread Anthony
This is great! Thanks for contributing. :-)

On Wednesday, June 29, 2011 10:33:10 AM UTC-4, rochacbruno wrote:

> Hi, 
>
> I just created a new plugin for stepped form wizards.
>
> I made it last night, so it is not tested very well, I would like your help 
> to test it.
>
> web2py PowerFormWizard Plugin - based on Jquery Stepy
>
> - Steps
> - Customizable titles
> - Server side validation
> - Client side validation (with jquery validate)
> - Custom css
> - JS Callbaks
> - Error images
>
> Take a look: http://labs.blouweb.com/powerformwizard
>  
>
> This plugin is the second plugin of blouweb PowerPlugins, I am now starting 
> the third one which I hope to have the first version soon.
>
> http://labs.blouweb.com
>
> Suggestions, testers, issues, contributions etc on bitbucket: 
> https://bitbucket.org/rochacbruno/powerformwizard 
>
> Hope it helps someone!
>
> Thanks.
>
>  --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]
> [ Aprenda Python: http://CursoDePython.com.br ] 
> [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
> [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
>
>

Re: [web2py] Exception calling value in template that is not defined.

2011-06-29 Thread Bruno Rocha
{{if 'form' in globals():}}
{{=form }}
{{pass}}



On Wed, Jun 29, 2011 at 12:00 PM, David J.  wrote:

> I am wondering why if I dont return anything in my dict and in my view
>
> {{if form:}}
> {{= form }}
> {{pass}}
>
> I get an exception.
>
>
> S'Traceback (most recent call last):\n  File "/apps/www/web2py.trunk/gluon/
> **restricted.py", line 192, in restricted\nexec ccode in environment\n
>  File 
> "/apps/www/web2py.trunk/**applications/sms/views/**default/campaign.html",
> line 87, in \nNameError: name \'form\' is not defined\n'
>
>
> I want to be able to check if a key is there before I use it.
>
> Thanks.
>


[web2py] Re: [web2py-users-brazil:2119] new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread Bruno Rocha
On Wed, Jun 29, 2011 at 11:55 AM, Tito Garrido wrote:

> This is awesome! Really cool plugin ;)
>

Thanks, I did for use in one of my systems, and I like to share cool stuff.
That is based on great jquery libs made by @wbotelhos


>
> Is there a way to change the next step based on choices of a previous step?
>

Not yet in plugin, but, That's all Java Script, so you can raise the method
by hand.

Is there a public JS method:

$.fn.stepy.step(2, '#powerformwizard');

and you can change the _id on form creation.

I will think about to include it in plugin.

[]' s


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda Pythonr: http://CursoDePython.com.br
 ]


[web2py] Exception calling value in template that is not defined.

2011-06-29 Thread David J.

I am wondering why if I dont return anything in my dict and in my view

{{if form:}}
{{= form }}
{{pass}}

I get an exception.


S'Traceback (most recent call last):\n  File 
"/apps/www/web2py.trunk/gluon/restricted.py", line 192, in 
restricted\nexec ccode in environment\n  File 
"/apps/www/web2py.trunk/applications/sms/views/default/campaign.html", 
line 87, in \nNameError: name \'form\' is not defined\n'



I want to be able to check if a key is there before I use it.

Thanks.


[web2py] Re: [web2py-users-brazil:2118] new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread Tito Garrido
This is awesome! Really cool plugin ;)

Is there a way to change the next step based on choices of a previous step?

Regards,

Tito

On Wed, Jun 29, 2011 at 11:33 AM, Bruno Rocha  wrote:

> Hi,
>
> I just created a new plugin for stepped form wizards.
>
> I made it last night, so it is not tested very well, I would like your help
> to test it.
>
> web2py PowerFormWizard Plugin - based on Jquery Stepy
>
> - Steps
> - Customizable titles
> - Server side validation
> - Client side validation (with jquery validate)
> - Custom css
> - JS Callbaks
> - Error images
>
> Take a look: http://labs.blouweb.com/powerformwizard
>
>
> This plugin is the second plugin of blouweb PowerPlugins, I am now starting
> the third one which I hope to have the first version soon.
>
> http://labs.blouweb.com
>
> Suggestions, testers, issues, contributions etc on bitbucket:
> https://bitbucket.org/rochacbruno/powerformwizard
>
> Hope it helps someone!
>
> Thanks.
>
> --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]
> [ Aprenda Python: http://CursoDePython.com.br ]
> [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
> [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
>
>  --
> Você recebeu essa mensagem por estar inscrito no grupo web2py-users-brazil.
> Para enviar uma mensagem ao grupo, envie email a:
> web2py-users-bra...@googlegroups.com
> Para se desinscrever, envie email a:
> web2py-users-brazil+unsubscr...@googlegroups.com
> Para mais opções, visite o site do grupo em:
> http://groups.google.com/group/web2py-users-brazil?hl=en




-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] new plugin - web2py Form Wizard - PowerFormWizard

2011-06-29 Thread Bruno Rocha
Hi,

I just created a new plugin for stepped form wizards.

I made it last night, so it is not tested very well, I would like your help
to test it.

web2py PowerFormWizard Plugin - based on Jquery Stepy

- Steps
- Customizable titles
- Server side validation
- Client side validation (with jquery validate)
- Custom css
- JS Callbaks
- Error images

Take a look: http://labs.blouweb.com/powerformwizard


This plugin is the second plugin of blouweb PowerPlugins, I am now starting
the third one which I hope to have the first version soon.

http://labs.blouweb.com

Suggestions, testers, issues, contributions etc on bitbucket:
https://bitbucket.org/rochacbruno/powerformwizard

Hope it helps someone!

Thanks.

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda Python: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] how redirect without propagate the .load extension?

2011-06-29 Thread Richard Vézina
Hello,

I tried what Jonathan suggested in the threads : request.extension=None but
it seems that .load still propagate... First the url that I pass in my
redirect should appear in the navigation address bar. Second the validator
don't show up on a redirected form that fail...

Richard

On Tue, Jun 28, 2011 at 4:59 PM, Richard Vézina  wrote:

> To myself : this thread have some answer :
> https://mail.google.com/mail/?shva=1#search/stop+propagation+redirect+.load/12d347378771c15c
>
> I am open to suggestion or maybe there is implemented solution now?
>
> Richard
>
>
> On Tue, Jun 28, 2011 at 4:51 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> In the book it writed :
>>
>> If you LOAD a component having the .load extension and the corresponding
>> controller functionredirects to another action (for example a login
>> form), the .load extension propagates and the new url (the one to
>> redirect too) is also loaded with a .load extension.
>>
>> How may I redirect to a URL without this it keep .load cause of
>> propagation??
>>
>> Richard
>>
>
>


[web2py] Re: conditions in HTML Helper TABLE

2011-06-29 Thread Anthony
Helpers are callable objects that take arguments, and you cannot use an if 
statement as an argument in Python. However, you can use a conditional 
expression, so the following should work:
 
*[TR(TD(row.DBQuery.ExampleName), _class='Test1' if row.DBQuery.Value==1 
else 'Test2') for row in query]
 
 
See 
http://docs.python.org/reference/expressions.html#conditional-expressions.
 
Anthony

On Wednesday, June 29, 2011 9:22:58 AM UTC-4, Christian Degenkolb wrote:

> Hi 
>
> is it possible to use conditions in HTMl Helpers like TABLE()? 
>
> for example I build a HTML table with 
>
> tablehelper = TABLE( 
> TR( TD(TD(B("Example"))), 
> *[ TR(  TD( row.DBQuery.ExampleName) ) for row in query] 
> ) 
>
> now is it possible to do something like? 
> tablehelper = TABLE( 
> TR( TD(TD(B("Example"))), 
> *[ TR(  TD( row.DBQuery.ExampleName), if row.DBQuery.Value == 1: 
> _class='Test1' else: _class='Test2' ) for row in query] 
> ) 
>
> I couldnt find anything in the manual regardding this problem. 
>
> with regards 
> christian



[web2py] Re: proven hosting sites for web2py

2011-06-29 Thread blackthorne
well, I have to disagree.
Not that I wouldn't think like with your experience. I just have to
say that I have a webfaction account with around 3-4 apps at the most
cheap plan which is really low and It's working very well. Until now,
I had a great experience with them, almost 2 years have passed. Now I
am more apprehensive by your negative comments, but still would
recommend webfaction.

regards



On Jun 29, 1:42 am, Bruno Rocha  wrote:
> I agree a little with GoldenTiger,
>
> I recently changed my 20 web2py applications that were hosted in different
> webfaction accounts,
>
> I figured out that Linode with stack script is better, easy and less
> expensive.
>
> In 10 minutes you have a web2py application running on Linode with Uwsgi and
> Nginx, just need to use the script that comes with web2py as a stack script
> on Linode.
>
> webfaction is very nice if you have only one low traffic website.
>
> I recommend Linode.
>
> $19 512RAMhttp://www.linode.com/
>
> 1. Click in deploy a linux distro and choose Ubuntu 10.04 64 bits
> 2. downloa and run this 
> script:http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ng...
> 3. go to the DNS manager and include your domain and click 'OK'
>
> Thats it.  10 minutes web2py running on VPS.
>
>
>
> On Tue, Jun 28, 2011 at 8:43 PM, GoldenTiger  wrote:
> > I have reviewed over 20 differents shared hosting, I can share a very
> > complete list of web2py hosting I wrote , including speed tests,
> > custom modules supported, fcgi/wsgi,   nginx / lighttpd  (still shared
> > hosting)
>
> > Personally, my experience with webfaction WAS NOT GOOD.    My web2py
> > websites, often were slow or down, so I created a ticket.
> > Guess what they answered me!!   using another framework instead
> > web2py !
> > After I received that mail, I had to cancell my account, since my
> > priority is web2py, not webfaction.
>
> > Here the log:
> > 
> > > I am very unhappy with the service. My websites are slow and are
> > innacesibles 50% of the time.
> > > If no solution provided for me, I'll have to cancel my account
>
> > > examples of websites i can't connect:
>
> > > vecinos.razonaqui.es
> > > apps.web2py.es
> > > subin.tv
>
> > The problem you are seeing is not caused by the web server. Right now,
> > you have all of these domains going to one application:
>
> >https://panel.webfaction.com/site/list
>
> > Your application, named "test", is listening on port 54825. It cannot
> > handle the simultaneous connections from these different domains.
>
> > To fix the problem, you should have only one domain point to one
> > application. Also, you may want to consider using applications more
> > stable than web2py. These problems are coming from web2py, and not
> > from the server.
>
> > Please let us know if you have any specific questions regarding re-
> > organizing your websites.
>
> > Regards,
>
> > Ryan S.
> > WebFaction Support
> > --
> > WebFaction - Smarter web hosting
>
> > On 28 jun, 21:57, "Sebastian E. Ovide" 
> > wrote:
> > > I confirm that IPage has very poor technical support... nevertheless I've
> > > installed web2py (with CGI) and it works ! even if it is VERY slow...
> >  I
> > > would not recommend it !
>
> > > On Tue, Jun 28, 2011 at 8:51 PM, DenesL  wrote:
>
> > > > Sometimes it is like that, just a waste of time trying to figure out
> > > > what is really supported behind all those marketing ads, and that is
> > > > exactly why we should have this list of proven hosting sites.
>
> > > > Thanks to all that have shared their experience so far.
> > > > Keep it coming, there ought to be more.
>
> > > > On Jun 28, 3:06 pm, GoldenTiger  wrote:
> > > > > I did a large search over the net, chatting with technical support,
> > > > > doing next questions:
>
> > > > > 1 –Python Version installed
> > > > > 2- Possibility of install new modules? virtualenv?
> > > > > 3- SSH shell enable? / HTTPs?
>
> > > > > I did copy/paste inhttp://blog.web2py.es(my personal notes about
> > > > > web2py)
>
> > > > > Log with JustHosthttp://
> > > > blog.web2py.es/hosting-web2py/buscando-hosting-web2py-justhost...
>
> > > > > Log with CirtexHosting.comhttp://
> > > > blog.web2py.es/hosting-web2py/buscando-hosting-web2py-cirtexho...
>
> > > > > Log with IPage.comhttp://
> > > > blog.web2py.es/hosting-web2py/buscando-hosting-web2py-www-ipag...
>
> > > > > More logs...http://blog.web2py.es/category/hosting-web2py/page/4/
>
> > > > > On Jun 28, 6:21 pm, Vasile Ermicioi  wrote:
>
> > > > > > +1 for webfaction, soon I will post a website built with web2py and
> > > > hosted
> > > > > > by webfaction,
> > > > > > I am very happy with them
>
> > > --
> > > Sebastian E. Ovide


[web2py] conditions in HTML Helper TABLE

2011-06-29 Thread Christian Degenkolb
Hi

is it possible to use conditions in HTMl Helpers like TABLE()?

for example I build a HTML table with

tablehelper = TABLE(
TR( TD(TD(B("Example"))),
*[ TR(  TD( row.DBQuery.ExampleName) ) for row in query]
)

now is it possible to do something like?
tablehelper = TABLE(
TR( TD(TD(B("Example"))),
*[ TR(  TD( row.DBQuery.ExampleName), if row.DBQuery.Value == 1:
_class='Test1' else: _class='Test2' ) for row in query]
)

I couldnt find anything in the manual regardding this problem.

with regards
christian


[web2py] Localising decimal values in form fields

2011-06-29 Thread tomtom5
I'm currently diving into web2py and got a problem localising input/
output of Decimal/Double form fields according to the users (browsers)
locale. I understand the mechanism of internationalising messages with
T(..), but that doesn't seem to help me further. What I need is, that
for example a german user may input a decimal value as 123.456,78
while an american user will use 123 456.78 as input/output format. I
found methods to define the decimal separator char in the constructor
of the IS_DECIMAL_IN_RANGE validator, but this is very rudimentary and
will not be user-locale aware. Is there a way to solve the problem out
of the box or should I create new validators or widgets for such a
task?
Thanks for advise


[web2py] Re: Empty database default values?

2011-06-29 Thread Ross Peoples
The default, if not specified is always None (NULL). Some DBAs will argue 
for and against storing NULL values in a database, but I personally use 
NULLs simply because they allow more flexibility. For example, say you have 
a text field in one of your tables. This text field should be set by the 
user, even if the text is empty, the user should set it. This would be 
stored as '' (empty string) in the database. So now, if you wanted to go 
through the database to find records where this text field as never been 
set, all you have to do is search for None.

That may not be the best example, but you may find lots of cases where you 
can use None (NULL) to your advantage. A better example might be for a time 
clock. You have a start_date and end_date. If end_date is None, then you 
know that person hasn't clocked out yet.

It's all a matter of personal preference.


[web2py] Re: pop-up pages interface

2011-06-29 Thread niknok
This is interesting. Could you tell me how to use this in Web2py?

On Jun 29, 4:10 pm, Bruno Rocha  wrote:
> if want an easy way...
>
> http://easyframework.com/+ web2py
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
>
>
>
>
>
>
>
> On Tue, Jun 28, 2011 at 5:32 AM, niknok  wrote:
> > **
> > Hello all.
>
> > How can I create a web2py interface similar to that of the Chromium Browser
> > when you need to change the browser settings?  I particularly like those
> > screens where a page pops out and you can add/edit the details of a
> > particular item you're interested in (i.e. the Autofill settings, etc.) Or
> > when new pages appear "in front" of (dimmed) previous pages to show the
> > hierarchy or menu level you're in.
>
> > Thanks.
>
> > /r
> > Nik


[web2py] CAS

2011-06-29 Thread sagar
Hi,

I have to use CAS for two of my apps.

Its working fine when both having default same registration process.

Here one of my app has some extra fields in registration like mobile
no etc what is ideal way to deal with it in such a cases.

Is there any documentation about CAS to get good understanding of it.

Thanks,
Sagar






Re: [web2py] pop-up pages interface

2011-06-29 Thread Bruno Rocha
if want an easy way...

http://easyframework.com/ + web2py


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]




On Tue, Jun 28, 2011 at 5:32 AM, niknok  wrote:

> **
> Hello all.
>
> How can I create a web2py interface similar to that of the Chromium Browser
> when you need to change the browser settings?  I particularly like those
> screens where a page pops out and you can add/edit the details of a
> particular item you're interested in (i.e. the Autofill settings, etc.) Or
> when new pages appear "in front" of (dimmed) previous pages to show the
> hierarchy or menu level you're in.
>
> Thanks.
>
> /r
> Nik
>