[web2py] Re: alternate date and time picker

2014-04-21 Thread Greg Vaughan
Hi Annet...

Thank you so much for the detailed reply... I have made it a point to check 
out the styling you have done...

However the issue that I have is not just with the look but also with the 
way that the default one functions... particularly on tablets... it is 
clunky.

So I have hacked together an implementation of 
Pickadate.jshttp://amsul.ca/pickadate.js/index.htm 
which is the sort of thing my clients expect in a modern browser 
application.

Cheers
Greg


On Sunday, 20 April 2014 16:36:25 UTC+10, Annet wrote:

 Hi Greg,

 I use a customized version of jQuery UI (I only needed the datepicker and 
 autocomplete)...

 ...

 Kind regards,

 Annet



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Login ajax component

2014-04-21 Thread Louis Amon
I found a workaround to solve this issue by closing the form tag myself :

I removed the line : 

 {{ =login_form.custom.end }}


And replaced it with :

 input name=_formname type=hidden value=login



It IS a monkeypatch, and it comes with restrictions (regarding components 
for instance) but at least my problem is solved for now. 


On Thursday, April 17, 2014 8:31:57 PM UTC+2, Louis Amon wrote:

 I'm trying to build an Ajax-based login form using web2py's LOAD() helper.

 I made a controller named 'users.py', in which I defined a 'signin()' 
 function :

 def signin():
 form=auth.login()
 if form.process(formname=None).accepted: #hideerrors=True
 response.flash = 'form accepted'
 print form.vars
 elif form.errors:
 print form.errors
 return dict(login_form=form)


  The corresponding view ('users/signin.load') is as follows:

 h2 class=form-login-sign-up_titleS'identifier/h2
 p class=form-login-sign-up_subtitleJ'ai déjà un compte/p
 {{ =login_form.custom.begin }}
 {{ =login_form.custom.widget.email }}
 {{ =login_form.custom.widget.password }}
 {{ =login_form.custom.end }}


 Now if I go to the url : [...]/users/signin.load, my form displays 
 correctly but validation doesn't occur upon submitting the form. It's as 
 though the displayed form isn't linked to the one defined in the controller.


 After some research, I found that if I change my view to

 {{=login_form}}


 Then validation occurs correctly. My form isn't customized correctly 
 though (obviously).

 Further research indicates that, using the first view, the rendered html 
 code actually contains two signatures for the FORM (just before the /form 
 tag):

 div style=display:none;
 input name=_next type=hidden value=/
 input name=_formkey type=hidden 
 value=c33c0072-ac25-461f-8e37-0ba48cc53dc2
 /div

  
 And:

 div style=display:none;
 input name=_next type=hidden value=/
 input name=_formkey type=hidden 
 value=553bae82-7864-4620-93ee-d54eeea366bf
 input name=_formname type=hidden value=login
 /div



 My guess is that, having two different signatures, web2py gets confused 
 about how to manage this form.
 I tried several things like putting formname=None in the process() 
 function, but the only way I got my ajax component to work so far is by not 
 customizing my form.

 Any workaround ?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Admin is disabled because insecure channel error Hosting web2py app on Amazon EC2 Linux server

2014-04-21 Thread Marin Pranjić
http is insecure. you need to use https to access admin app.

Marin (mobile)
On Apr 21, 2014 5:02 AM, Pawan Gupta pawangupt...@gmail.com wrote:

 Hi Everyone

 We are having serious problem with our website 911india.com. We have
 hosted it on Amazon EC2 server and there is a ticket that is issued which
 redirects us to the admin interface that shows Admin is disabled because
 insecure channel

 I tried searching on the website but nothing seems to make sense probably
 because we are somewhat beginners.

 Can someone please help us with what could be done to resolve this.


 Cheers

 Pawan

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Login ajax component

2014-04-21 Thread Marin Pranjić
This sounds like a bug.

Marin (mobile)
On Apr 18, 2014 9:10 PM, Louis Amon moo...@msn.com wrote:

 I'm trying to build an Ajax-based login form using web2py's LOAD() helper.

 I made a controller named 'users.py', in which I defined a 'signin()'
 function :

 def signin():
 form=auth.login()
 if form.process(formname=None).accepted: #hideerrors=True
 response.flash = 'form accepted'
 print form.vars
 elif form.errors:
 print form.errors
 return dict(login_form=form)


  The corresponding view ('users/signin.load') is as follows:

 h2 class=form-login-sign-up_titleS'identifier/h2
 p class=form-login-sign-up_subtitleJ'ai déjà un compte/p
 {{ =login_form.custom.begin }}
 {{ =login_form.custom.widget.email }}
 {{ =login_form.custom.widget.password }}
 {{ =login_form.custom.end }}


 Now if I go to the url : [...]/users/signin.load, my form displays
 correctly but validation doesn't occur upon submitting the form. It's as
 though the displayed form isn't linked to the one defined in the controller.


 After some research, I found that if I change my view to

 {{=login_form}}


 Then validation occurs correctly. My form isn't customized correctly
 though (obviously).

 Further research indicates that, using the first view, the rendered html
 code actually contains two signatures for the FORM (just before the /form
 tag):

 div style=display:none;
 input name=_next type=hidden value=/
 input name=_formkey type=hidden
 value=c33c0072-ac25-461f-8e37-0ba48cc53dc2
 /div


 And:

 div style=display:none;
 input name=_next type=hidden value=/
 input name=_formkey type=hidden
 value=553bae82-7864-4620-93ee-d54eeea366bf
 input name=_formname type=hidden value=login
 /div



 My guess is that, having two different signatures, web2py gets confused
 about how to manage this form.
 I tried several things like putting formname=None in the process()
 function, but the only way I got my ajax component to work so far is by not
 customizing my form.

 Any workaround ?

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] how to use gluon Expose

2014-04-21 Thread Louis Amon
Hi,

I'm trying to expose a folder in my application, so I tried to use the 
Expose function as described 
herehttp://web2py.com/books/default/chapter/29/14/other-recipes#Publishing-a-folder

My controller looks like :

from gluon.tools import Expose
 def presse():
 files=Expose(request.folder+'static/presse')
 return dict(files=files)


When I reach the correct URL, I see links for every file in that folder, 
but they point to nothing.

Same goes for image previews : they are broken.


I checked one of the broken previews, and it points to : 
/presse/logo.png, when it should point to /static/presse/logo.png.


What did I do wrong ?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: 500 Internal Server Error under CentOS Apache and Web2py 2.9.5

2014-04-21 Thread LightDot
You use /opt/web-apps/web2py_2.9.5/ in one place and /opt/web-apps/web2py/ 
in other places. Besides, you should copy the wsgihandler.py into the 
web2py directory, don't call the file directly from handlers... (unless 
you've modified the paths within, but running directly from handlers isn't 
a really clean way of doing things...).

Have you made any other changes? For example, things like WSGISocketPrefix 
run/wsgi, was this used and working before?

Regards

On Sunday, April 20, 2014 4:25:29 PM UTC+2, lucas wrote:

 hello everyone,

 i just upgraded from web2py 2.4.6 to 2.9.5.  i am running centos 6.5 with 
 apache httpd server 2.2.15 and mod_wsgi is 3.2.3.

 i have no applications installed yet, just trying to get the default 
 welcome, examples, and admin interfaces working.  apache returns, 500 
 Internal Server Error.  not sure where to start to fix the error.

 here is my /etc/httpd/conf.d/wsgi.conf file:
 BOF...
 LoadModule wsgi_module modules/mod_wsgi.so
 WSGIDaemonProcess web2py user=apache group=apache
 WSGIApplicationGroup %{GLOBAL}
 WSGIProcessGroup web2py
 WSGISocketPrefix run/wsgi
 WSGIScriptAlias / /opt/web-apps/web2py_2.9.5/handlers/wsgihandler.py
 ...EOF

 here is my /etc/httpd/conf.d/default.conf file:
 BOF...
 NameVirtualHost *:80
 NameVirtualHost *:443

 VirtualHost *:443
   SSLEngine on
   SSLCertificateFile /etc/httpd/ssl/self_signed.cert
   SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

   Directory /opt/web-apps/web2py
 AllowOverride None
 Order Allow,Deny
 Deny from all
 Files wsgihandler.py
   Allow from all
 /Files
   /Directory

   AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
 /opt/web-apps/web2py/applications/$1/static/$2

   Directory /opt/web-apps/web2py/applications/*/static
 Options -Indexes
 ExpiresActive On
 ExpiresDefault access plus 1 hour
 Order Allow,Deny
 Allow from all
   /Directory

   CustomLog /var/log/httpd/access_log common
   ErrorLog /var/log/httpd/error_log
 /VirtualHost
 ...EOF

 here is my /etc/httpd/conf.d/welcome.conf file:
 BOF...
 LocationMatch ^/+$
 Options -Indexes
 ErrorDocument 403 /error/noindex.html
 /LocationMatch
 ...EOF

 thanx for your help in advance, lucas



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: how to use gluon Expose

2014-04-21 Thread Massimo Di Pierro
Can you try:

Expose(os.path.join(request.folder,'static','presse'))

On Monday, 21 April 2014 06:01:42 UTC-5, Louis Amon wrote:

 Hi,

 I'm trying to expose a folder in my application, so I tried to use the 
 Expose function as described 
 herehttp://web2py.com/books/default/chapter/29/14/other-recipes#Publishing-a-folder

 My controller looks like :

 from gluon.tools import Expose
 def presse():
 files=Expose(request.folder+'static/presse')
 return dict(files=files)


 When I reach the correct URL, I see links for every file in that folder, 
 but they point to nothing.

 Same goes for image previews : they are broken.


 I checked one of the broken previews, and it points to : 
 /presse/logo.png, when it should point to /static/presse/logo.png.


 What did I do wrong ?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: how to use gluon Expose

2014-04-21 Thread Louis Amon
It gets me the same result : broken links  images

On Monday, April 21, 2014 3:28:00 PM UTC+2, Massimo Di Pierro wrote:

 Can you try:

 Expose(os.path.join(request.folder,'static','presse'))

 On Monday, 21 April 2014 06:01:42 UTC-5, Louis Amon wrote:

 Hi,

 I'm trying to expose a folder in my application, so I tried to use the 
 Expose function as described 
 herehttp://web2py.com/books/default/chapter/29/14/other-recipes#Publishing-a-folder

 My controller looks like :

 from gluon.tools import Expose
 def presse():
 files=Expose(request.folder+'static/presse')
 return dict(files=files)


 When I reach the correct URL, I see links for every file in that folder, 
 but they point to nothing.

 Same goes for image previews : they are broken.


 I checked one of the broken previews, and it points to : 
 /presse/logo.png, when it should point to /static/presse/logo.png.


 What did I do wrong ?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] is it possible to hand over Rows object to sqlform.grid form ?

2014-04-21 Thread alex
Hello guys. I need to display different rows with checkboxes from different 
tables , so I decided to use grid form. With such demands I have to use one 
grid form for each table, but as far as I know that it's incorrect to do 
so. Maybe there is a way to extract rows from those tables and hand them 
over to a grid form ?? Any other options ? Thanks...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] View functions in module?

2014-04-21 Thread Thomas de Noronha e Silva
I have a file A.html containing a couple of view functions that I want to 
include in several view across different apps. Is there a way in web2py 
that avoids either replicating the files or using volatile file paths? 
Ideally, I wish I could import the compiled version of view functions in a 
similar way I'd do it with a module?

I might be missing something very obvious too, I'm prepared for that 
possibility :)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Classic Error with Rocket - can't launch web2py any more

2014-04-21 Thread Dansant vzw
I'am again trying (after several earlier and succesfull atempts) to learn 
some web2py. In the past I just got the framework up and running without 
any problem at all. 

Unless I tryed it recently again and got the following error, which seems 
to be a classic:

ERROR:Rocket.Errors.Port8000:Socket 127.0.0.1:8000 in use by other process 
and it won't share.
WARNING:Rocket.Errors.Port8000:Listener started when not ready.

I'am working on a Debian Linux machine (Wheezy) and have the Python IDLE 
2.6, 2.7 and 3.2 installed on my machine.

I also recently did some experiments with wordpress running on my desktop, 
but I uninstalled everything (incl. Apache).

And it is still not running properly. The only thing I can think off is the 
fact that I installed a virus protection clamav. But even when I 
uninstalled that one, it didn't work. 

It is even not working when I'am trying to use it offline (shutting down my 
home wifi for a while)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.widgets.radio.widget and jQuery Validation

2014-04-21 Thread Greg Vaughan
Hi everyone,

When I am using the SQLFORM.widgets.radio.widget my jquery selection code 
does not work. If I comment out the widget it works fine. Does anyone know 
if there is a workaround or is it just not possible to combine the two 
together.

In the Model...

db.define_table('leads',

Field('contact_result',
  requires=IS_IN_SET(['Appointment', 'Gatekeeper',
  'National/Head Office', 'Not Interested',
  'Send Information', 'Call Back Later']),
  default='Appointment',
  widget=SQLFORM.widgets.radio.widget
  ),

and in the View... (controller is essentially SQLFORM)

{{extend 'layout.html'}}
{{=form}}
script
jQuery(document).ready(function() {

if(jQuery('#leads_contact_result option:selected').text()=='Send 
Information') {
jQuery('#leads_info_email__row').show();
}
else
{ jQuery('#leads_info_email__row').hide();
}
jQuery('#leads_contact_result').change(function() {
if(jQuery('#leads_contact_result 
option:selected').text()=='Send Information') {
jQuery('#leads_info_email__row').show();
}
else
{ jQuery('#leads_info_email__row').hide();
}
});

if(jQuery('#leads_contact_result option:selected').text()=='Call 
Back Later') {
jQuery('#leads_recontact__row').show();
}
else
{ jQuery('#leads_recontact__row').hide();
}
jQuery('#leads_contact_result').change(function() {
if(jQuery('#leads_contact_result 
option:selected').text()=='Call Back Later') {
jQuery('#leads_recontact__row').show();
}
else
{ jQuery('#leads_recontact__row').hide();
}
});

})
/script

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM inserts new record instead of updating existing record

2014-04-21 Thread Sharon Correll
I changed it to look very similar to this:


 def myform():
 record = db.langResource(request.args(0))
 form = SQLFORM(db.langResource, record=record).process(
 message_onsuccess='Resource modified' if record else 'New 
 resource added')
 return dict(form=form)


except that I get the id variable using request.vars.id, and I include 
the id variable in the dictionary:

idToEdit = request.vars.id
recToEdit = db.langResource(idToEdit)
form = SQLFORM(db.langResource, record=recToEdit).process(
message_onsuccess='Resource modified' if recToEdit else 'New 
resource added')
return dict(sqlForm=form, idToEdit=idToEdit)

Now when I submit the form, this variable comes back as a list. So if 
originally the id was 6, after I press Submit it is ['6', '6'] (two 
strings). This was not happening before. And not surprisingly, submitting 
the form has no effect at all.

It makes sense to be sure to just call the process() function once, but 
when I reorganized my original code that way, I'm still getting the 
original behavior (a new record is created and the old one is not modified).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Classic Error with Rocket - can't launch web2py any more

2014-04-21 Thread LightDot
The error is pretty self-explanatory. Another service (or another instance 
of the same one) is already using port 8000.

So, the solution is to:

- find out which service is it (execute the command 'netstat -lnptu' in 
your terminal)
- shut that service down.

BTW, installing or uninstalling clamav won't have any effect on running 
services, nor will disconnecting from your home wi-fi.

Regards

On Monday, April 21, 2014 5:03:24 PM UTC+2, Dansant vzw wrote:

 I'am again trying (after several earlier and succesfull atempts) to learn 
 some web2py. In the past I just got the framework up and running without 
 any problem at all. 

 Unless I tryed it recently again and got the following error, which seems 
 to be a classic:

 ERROR:Rocket.Errors.Port8000:Socket 127.0.0.1:8000 in use by other 
 process and it won't share.
 WARNING:Rocket.Errors.Port8000:Listener started when not ready.

 I'am working on a Debian Linux machine (Wheezy) and have the Python IDLE 
 2.6, 2.7 and 3.2 installed on my machine.

 I also recently did some experiments with wordpress running on my desktop, 
 but I uninstalled everything (incl. Apache).

 And it is still not running properly. The only thing I can think off is 
 the fact that I installed a virus protection clamav. But even when I 
 uninstalled that one, it didn't work. 

 It is even not working when I'am trying to use it offline (shutting down 
 my home wifi for a while)



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: View functions in module?

2014-04-21 Thread Anthony
Would it be difficult to simply define the functions in a module, or do 
they include a lot of interspersed HTML? If the latter, you can still port 
the functions to standard Python functions in a module by wrapping any HTML 
lines in response.write(). You can also automate the conversion of existing 
functions as follows:

from gluon.template import TemplateParser
converted_code = TemplateParser(original_code).to_string()

Otherwise, you can store the shared files in a central location and 
reference them via ../../path/to/shared/views.

Anthony

On Monday, April 21, 2014 5:57:33 AM UTC-4, Thomas de Noronha e Silva wrote:

 I have a file A.html containing a couple of view functions that I want to 
 include in several view across different apps. Is there a way in web2py 
 that avoids either replicating the files or using volatile file paths? 
 Ideally, I wish I could import the compiled version of view functions in a 
 similar way I'd do it with a module?

 I might be missing something very obvious too, I'm prepared for that 
 possibility :)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM inserts new record instead of updating existing record

2014-04-21 Thread Anthony
When you say you are using request.vars.id, do you mean you have an id 
variable in the query string, as in /myform?id=1?

If so, change the name of that variable to something else, as the edit form 
will include its own hidden field with the name id -- so upon submission, 
there will be a request.post_vars.id and a request.get_vars.id, both of 
which will end up in a list in request.vars.id.

More generally, to be safe, it's a good idea to use request.post_vars and 
request.get_vars specifically when you are dealing with requests that are 
likely to have both.

Anthony

On Monday, April 21, 2014 11:38:21 AM UTC-4, Sharon Correll wrote:

 I changed it to look very similar to this:


 def myform():
 record = db.langResource(request.args(0))
 form = SQLFORM(db.langResource, record=record).process(
 message_onsuccess='Resource modified' if record else 'New 
 resource added')
 return dict(form=form)


 except that I get the id variable using request.vars.id, and I include 
 the id variable in the dictionary:

 idToEdit = request.vars.id
 recToEdit = db.langResource(idToEdit)
 form = SQLFORM(db.langResource, record=recToEdit).process(
 message_onsuccess='Resource modified' if recToEdit else 'New 
 resource added')
 return dict(sqlForm=form, idToEdit=idToEdit)

 Now when I submit the form, the second time the id variable becomes a 
 list! So if originally the id was 6, after I press Submit it is ['6', '6'] 
 (two strings). This was not happening before. And not surprisingly, 
 submitting the form has no effect at all. Why???

 It makes sense to be sure to just call the process() function once, but 
 when I reorganized my original code that way, I'm still getting the 
 original behavior (a new record is created and the old one is not modified).


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Greg Vaughan
Hi everyone,

I am using a bunch of jQuery hide effects based on the example code in the 
book... (Chapter 11... Conditional fields in forms) which work great with 
my SQLFORM.

However when I change the controller to use SQLFORM.factory so that I can 
post to two tables (based on Chapter 7... One form for multiple tables) the 
effects stop working. Can someone suggest a workaround or a code change so 
that they will work together?

The Controller...

@auth.requires_login()
def appointments():
call_id = request.get_vars.id
db.appointments.business.default=call_id
db.notes.business.default=call_id
form = SQLFORM.factory(db.appointments, db.notes)
if form.process().accepted:
id = 
db.appointments.insert(**db.appointments._filter_fields(form.vars))
form.vars.appointments=id
id = db.notes.insert(**db.notes._filter_fields(form.vars))
session.flash = 'Success'
redirect(URL('calls'))
elif form.errors:
response.flash = 'Form has errors'
else:
response.flash = 'Enter Data'
return dict(form=form)

and the View...

{{extend 'layout.html'}}
{{=form}}
script
jQuery(document).ready(function(){
if(jQuery('#appointments_unit').prop('checked'))
jQuery('#appointments_unit_type__row').show(),
jQuery('#appointments_unit_number__row').show();
else jQuery('#appointments_unit_type__row').hide(),
jQuery('#appointments_unit_number__row').hide();
jQuery('#appointments_unit').change(function(){
if(jQuery('#appointments_unit').prop('checked'))
jQuery('#appointments_unit_type__row').show(),
jQuery('#appointments_unit_number__row').show();
else jQuery('#appointments_unit_type__row').hide(),
jQuery('#appointments_unit_number__row').hide();
});
if(jQuery('#appointments_level_floor').prop('checked'))
jQuery('#appointments_level_type__row').show(),
jQuery('#appointments_level_number__row').show();
else jQuery('#appointments_level_type__row').hide(),
jQuery('#appointments_level_number__row').hide();
jQuery('#appointments_level_floor').change(function(){
if(jQuery('#appointments_level_floor').prop('checked'))
jQuery('#appointments_level_type__row').show(),
jQuery('#appointments_level_number__row').show();
else jQuery('#appointments_level_type__row').hide(),
jQuery('#appointments_level_number__row').hide();
});
if(jQuery('#appointments_building').prop('checked'))
jQuery('#appointments_building_number__row').show(),
jQuery('#appointments_building_name__row').show();
else jQuery('#appointments_building_number__row').hide(),
jQuery('#appointments_building_name__row').hide();
jQuery('#appointments_building').change(function(){
if(jQuery('#appointments_building').prop('checked'))
jQuery('#appointments_building_number__row').show(),
jQuery('#appointments_building_name__row').show();
else jQuery('#appointments_building_number__row').hide(),
jQuery('#appointments_building_name__row').hide();
});
if(jQuery('#appointments_lot').prop('checked'))
jQuery('#appointments_lot_section__row').show();
else jQuery('#appointments_lot_section__row').hide();
jQuery('#appointments_lot').change(function(){
if(jQuery('#appointments_lot').prop('checked'))
jQuery('#appointments_lot_section__row').show();
else jQuery('#appointments_lot_section__row').hide();
});
if(jQuery('#appointments_cross_street').prop('checked'))
jQuery('#appointments_street_number__row').hide(),
jQuery('#appointments_cross_name__row').show(),
jQuery('#appointments_cross_type__row').show(),
jQuery('#appointments_cross_suffix__row').show();
else jQuery('#appointments_street_number__row').show(),
jQuery('#appointments_cross_name__row').hide(),
jQuery('#appointments_cross_type__row').hide(),
jQuery('#appointments_cross_suffix__row').hide();
jQuery('#appointments_cross_street').change(function(){
if(jQuery('#appointments_cross_street').prop('checked'))
jQuery('#appointments_street_number__row').hide(),
jQuery('#appointments_cross_name__row').show(),
jQuery('#appointments_cross_type__row').show(),
jQuery('#appointments_cross_suffix__row').show();
else jQuery('#appointments_street_number__row').show(),
jQuery('#appointments_cross_name__row').hide(),
jQuery('#appointments_cross_type__row').hide(),
jQuery('#appointments_cross_suffix__row').hide();
});

[web2py] Re: Unique Field Name AND Case

2014-04-21 Thread Niphlod
add a computed column that stores the uppercased or lowercased value, and 
set a unique constraint on that, or use 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks

On Sunday, April 20, 2014 10:58:04 PM UTC+2, David wrote:

 So I been looking for a couple hours on a solution to this but it evades 
 me.

 When I create a unique field such as:

 db.define_table('list',
 Field('name, unique=True))


 I can add David, david and dAvid and they are all rightfully unique 
 and added accordingly.

 How do I add a field so it doesn't matter the case or capitalization?  I 
 only want David or any variation in the table only 1 time.  The reason is 
 I want to keep the case as a specific name like ForEx or NASDAQ but not 
 forex or nasdaq.

 Thanks,
 David




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Need to access SQLite3 database file but have no definitions for tables

2014-04-21 Thread Niphlod
to be able to access the data with DAL, you need to define tables that you 
want to use. If they exist already, as in your case, a simple migrate=False 
will turn the migrations off and just define the table without creating it.

db.define_table('', migrate=False)

On Saturday, April 19, 2014 8:26:20 PM UTC+2, Spencer Underwood wrote:

 I'm pretty new to web development as a whole and am planning to make a 
 website for people playing the game EVE Online to use but have encountered 
 some difficulty trying to access the database dump that CCP Games has 
 released. The database dump is available 
 herehttps://www.fuzzwork.co.uk/dump/in a SQLite, MySQL and PostGres. I use 
 Win7 with minimal rights so if I 
 have to use MySQL or PostGres to fix this problem it has to be able to 
 install and run without admin rights.

 When accessing the database in the sqlite3 executable everything work 
 perfectly, all that's needed to load the file is a .open 
 sqlite-latest.sqlite and it just works. When opening the database file 
 using the web2py DAL, it appears to load the file properly but doesn't know 
 of any the tables that exist. This appears to be working as intended, but 
 is a problem I can't figure out how to solve. When I try to manually define 
 one of the tables I know exists (list of existing tables found 
 herehttp://wiki.eve-id.net/Category:CCP_DB_Tables), 
 I receive the error: sqlite3.OperationError: table invTypes already exists. 
 The code I used to do this is as follows:

 from os.path import join, exists
 from httplib import HTTPException
 from gluon.sql import DAL, Field
 from gluon.validators import *

 import eveapi
 import datetime

 api = eveapi.EVEAPIConnection()
 db = DAL('sqlite://sqlite-latest.sqlite')

 #
 db.define_table('invTypes') 

 I haven't figured out how to run a python file as part of an application, 
 so I just make a test.py file inside the root web2py director and run it 
 from command line (py.exe test.py). 


 Does anyone know anything I could use to access this database?

 Thanks,
 Spencer Underwood


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM inserts new record instead of updating existing record

2014-04-21 Thread Sharon Correll
Yes, using request.get_vars.id solved that problem. And it turns out that I 
was confusing it by using different form-names, so the modification is now 
happening as expected! Hurray, thanks for your help.

Just to clarify, when I I look at the HTML I see:

form
 ...
 div style=display:none;
 input name=id type=hidden value=*12* /
 input name=_formkey type=hidden value=
3d7c7125-9223-4dc4-ae9f-e10efeb3149b /
 input name=_formname type=hidden value=langResource/*12* /
 /div
/form


The ID 12 is in there twice, once as the value of the id input and once 
as part of the value of the _formname input. So does one of these input 
structures generate the get value and the other the post value (as a result 
of submitting the form)?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Niphlod
check the resulting html markup for sqlform.factory. As it's intended 
originally to work with Fields that don't belong to a table, the table 
part prefix to every field is no_table.

So, your #appointments_unit that is probably related to a table 
appointments and a field unit with SQLFORM, with SQLFORM.factory becomes 
#no_table_unit.

There's an undocumented trick that allows you to do 

form = SQLFORM.factory(Field() ., table_name='appointments')

that should close the deal for you.

BTW: instead of relying on #ids, you can take fields by input names and use 
js variables: it's usually a more robust method than your fixed one.



On Monday, April 21, 2014 5:56:50 PM UTC+2, Greg Vaughan wrote:

 Hi everyone,

 I am using a bunch of jQuery hide effects based on the example code in the 
 book... (Chapter 11... Conditional fields in forms) which work great with 
 my SQLFORM.

 However when I change the controller to use SQLFORM.factory so that I can 
 post to two tables (based on Chapter 7... One form for multiple tables) the 
 effects stop working. Can someone suggest a workaround or a code change so 
 that they will work together?

 The Controller...

 @auth.requires_login()
 def appointments():
 call_id = request.get_vars.id
 db.appointments.business.default=call_id
 db.notes.business.default=call_id
 form = SQLFORM.factory(db.appointments, db.notes)
 if form.process().accepted:
 id = 
 db.appointments.insert(**db.appointments._filter_fields(form.vars))
 form.vars.appointments=id
 id = db.notes.insert(**db.notes._filter_fields(form.vars))
 session.flash = 'Success'
 redirect(URL('calls'))
 elif form.errors:
 response.flash = 'Form has errors'
 else:
 response.flash = 'Enter Data'
 return dict(form=form)

 and the View...

 {{extend 'layout.html'}}
 {{=form}}
 script
 jQuery(document).ready(function(){
 if(jQuery('#appointments_unit').prop('checked'))
 jQuery('#appointments_unit_type__row').show(),
 jQuery('#appointments_unit_number__row').show();
 else jQuery('#appointments_unit_type__row').hide(),
 jQuery('#appointments_unit_number__row').hide();
 jQuery('#appointments_unit').change(function(){
 if(jQuery('#appointments_unit').prop('checked'))
 jQuery('#appointments_unit_type__row').show(),
 jQuery('#appointments_unit_number__row').show();
 else jQuery('#appointments_unit_type__row').hide(),
 jQuery('#appointments_unit_number__row').hide();
 });
 if(jQuery('#appointments_level_floor').prop('checked'))
 jQuery('#appointments_level_type__row').show(),
 jQuery('#appointments_level_number__row').show();
 else jQuery('#appointments_level_type__row').hide(),
 jQuery('#appointments_level_number__row').hide();
 jQuery('#appointments_level_floor').change(function(){
 if(jQuery('#appointments_level_floor').prop('checked'))
 jQuery('#appointments_level_type__row').show(),
 jQuery('#appointments_level_number__row').show();
 else jQuery('#appointments_level_type__row').hide(),
 jQuery('#appointments_level_number__row').hide();
 });
 if(jQuery('#appointments_building').prop('checked'))
 jQuery('#appointments_building_number__row').show(),
 jQuery('#appointments_building_name__row').show();
 else jQuery('#appointments_building_number__row').hide(),
 jQuery('#appointments_building_name__row').hide();
 jQuery('#appointments_building').change(function(){
 if(jQuery('#appointments_building').prop('checked'))
 jQuery('#appointments_building_number__row').show(),
 jQuery('#appointments_building_name__row').show();
 else jQuery('#appointments_building_number__row').hide(),
 jQuery('#appointments_building_name__row').hide();
 });
 if(jQuery('#appointments_lot').prop('checked'))
 jQuery('#appointments_lot_section__row').show();
 else jQuery('#appointments_lot_section__row').hide();
 jQuery('#appointments_lot').change(function(){
 if(jQuery('#appointments_lot').prop('checked'))
 jQuery('#appointments_lot_section__row').show();
 else jQuery('#appointments_lot_section__row').hide();
 });
 if(jQuery('#appointments_cross_street').prop('checked'))
 jQuery('#appointments_street_number__row').hide(),
 jQuery('#appointments_cross_name__row').show(),
 jQuery('#appointments_cross_type__row').show(),
 jQuery('#appointments_cross_suffix__row').show();
 else jQuery('#appointments_street_number__row').show(),
 jQuery('#appointments_cross_name__row').hide(),
 

[web2py] Re: SQLFORM inserts new record instead of updating existing record

2014-04-21 Thread Anthony
Neither of those has anything to do with any GET vars. request.get_vars.id 
represents an id variable passed in the query string of the URL.

On Monday, April 21, 2014 12:19:56 PM UTC-4, Sharon Correll wrote:

 Yes, using request.get_vars.id solved that problem. And it turns out that 
 I was confusing it by using different form-names, so the modification is 
 now happening as expected! Hurray, thanks for your help.

 Just to clarify, when I I look at the HTML I see:

 form
  ...
  div style=display:none;
  input name=id type=hidden value=*12* /
  input name=_formkey type=hidden value=
 3d7c7125-9223-4dc4-ae9f-e10efeb3149b /
  input name=_formname type=hidden value=langResource/*12* /
  /div
 /form


 The ID 12 is in there twice, once as the value of the id input and once 
 as part of the value of the _formname input. So does one of these input 
 structures generate the get value and the other the post value (as a result 
 of submitting the form)?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] A helper callback not working

2014-04-21 Thread Ruud Schroen
Hi,

I've got a A helper with a callback function, which is created in the 
controller

return A(T('Send friend request'), callback=URL('friendship', args=[
'request', user.id]), _class='bt_white sendrequest', _id='friendship_button'
, target=':eval')

It used to render this:

a class=bt_white sendrequest 
href=#nullhttp://localhost:9000/studyportal/default/profile?user=ruudje#null
 id=friendship_button onclick=ajax(#x27;/studyportal/default/friendship
/request/1#x27;,[],#x27;:eval#x27;);return falseSend friend request/a

But now it renders this:

a class=bt_white sendrequest data-w2p_disable_with=default 
data-w2p_method=POST data-w2p_target=:eval href=
/study2go/default/friendship/request/2http://localhost:8000/study2go/default/friendship/request/2
 id=friendship_buttonSend friend request/a

And the callback doesn't work. It just follows the URL like a normal href...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Spokes
I'm using SQLFORM.factory() to generate a form from multiple tables, some 
of which have fields that have the same names as fields in other tables. In 
the form that's generated, the first instance of the field with the common 
name appears, but any subsequent instances of the field with that name are 
absent. A basic version of the code is something like this:

Model: 

db.define_table('table1', ... Field('address', type='text',length=512, Label 
= T('address')), ...)
db.define_table('table2', ...)
db.define_table('table3', ... Field('address', type='text',length=512, Label 
= T('address')), ...)

Controller:

form = SQLFORM.factory(db.table1, db.table2, db.table3)

In the generated form, only one instance of 'address' would appear. Is 
there a way to have SQLFORM.factory() create a form that contains all 
instances of fields with shared names, and to have it distinguish them so 
as to facilitate inputting the values of the form.vars into the appropriate 
tables (I'd imagine an insert with _filter_fields should still work, but 
asking just in case)? Thank you.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: A helper callback not working

2014-04-21 Thread Massimo Di Pierro
You need to replace web2py.js with the latest one from the welcome app.


On Monday, 21 April 2014 11:56:41 UTC-5, Ruud Schroen wrote:

 Hi,

 I've got a A helper with a callback function, which is created in the 
 controller

 return A(T('Send friend request'), callback=URL('friendship', args=[
 'request', user.id]), _class='bt_white sendrequest', _id=
 'friendship_button', target=':eval')

 It used to render this:

 a class=bt_white sendrequest 
 href=#nullhttp://localhost:9000/studyportal/default/profile?user=ruudje#null
  id=friendship_button onclick=ajax(#x27;/studyportal/default/
 friendship/request/1#x27;,[],#x27;:eval#x27;);return falseSend 
 friend request/a

 But now it renders this:

 a class=bt_white sendrequest data-w2p_disable_with=default 
 data-w2p_method=POST data-w2p_target=:eval href=
 /study2go/default/friendship/request/2http://localhost:8000/study2go/default/friendship/request/2
  id=friendship_buttonSend friend request/a

 And the callback doesn't work. It just follows the URL like a normal 
 href...


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Anthony
No, the documentation mentions this as a limitation of using 
SQLFORM.factory with multiple tables.

On Monday, April 21, 2014 1:56:44 PM UTC-4, Spokes wrote:

 I'm using SQLFORM.factory() to generate a form from multiple tables, some 
 of which have fields that have the same names as fields in other tables. In 
 the form that's generated, the first instance of the field with the common 
 name appears, but any subsequent instances of the field with that name are 
 absent. A basic version of the code is something like this:

 Model: 

 db.define_table('table1', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)
 db.define_table('table2', ...)
 db.define_table('table3', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)

 Controller:

 form = SQLFORM.factory(db.table1, db.table2, db.table3)

 In the generated form, only one instance of 'address' would appear. Is 
 there a way to have SQLFORM.factory() create a form that contains all 
 instances of fields with shared names, and to have it distinguish them so 
 as to facilitate inputting the values of the form.vars into the appropriate 
 tables (I'd imagine an insert with _filter_fields should still work, but 
 asking just in case)? Thank you.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Spokes
Thanks for the clarification, Anthony. Can you recommend a good way to 
achieve the functionality I mentioned, or does such a form, along with 
processing, inserts, etc., have to be manually crafted?

On Monday, April 21, 2014 1:20:16 PM UTC-5, Anthony wrote:

 No, the documentation mentions this as a limitation of using 
 SQLFORM.factory with multiple tables.

 On Monday, April 21, 2014 1:56:44 PM UTC-4, Spokes wrote:

 I'm using SQLFORM.factory() to generate a form from multiple tables, some 
 of which have fields that have the same names as fields in other tables. In 
 the form that's generated, the first instance of the field with the common 
 name appears, but any subsequent instances of the field with that name are 
 absent. A basic version of the code is something like this:

 Model: 

 db.define_table('table1', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)
 db.define_table('table2', ...)
 db.define_table('table3', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)

 Controller:

 form = SQLFORM.factory(db.table1, db.table2, db.table3)

 In the generated form, only one instance of 'address' would appear. Is 
 there a way to have SQLFORM.factory() create a form that contains all 
 instances of fields with shared names, and to have it distinguish them so 
 as to facilitate inputting the values of the form.vars into the appropriate 
 tables (I'd imagine an insert with _filter_fields should still work, but 
 asking just in case)? Thank you.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: A helper callback not working

2014-04-21 Thread Ruud Schroen
It no longer follows the href, but it now gives me this jQuery error:

Uncaught Error: Syntax error, unrecognized expression: #:eval

I am using the jquery.js from the welcome app

On Monday, April 21, 2014 6:56:41 PM UTC+2, Ruud Schroen wrote:

 Hi,

 I've got a A helper with a callback function, which is created in the 
 controller

 return A(T('Send friend request'), callback=URL('friendship', args=[
 'request', user.id]), _class='bt_white sendrequest', _id=
 'friendship_button', target=':eval')

 It used to render this:

 a class=bt_white sendrequest 
 href=#nullhttp://localhost:9000/studyportal/default/profile?user=ruudje#null
  id=friendship_button onclick=ajax(#x27;/studyportal/default/
 friendship/request/1#x27;,[],#x27;:eval#x27;);return falseSend 
 friend request/a

 But now it renders this:

 a class=bt_white sendrequest data-w2p_disable_with=default 
 data-w2p_method=POST data-w2p_target=:eval href=
 /study2go/default/friendship/request/2http://localhost:8000/study2go/default/friendship/request/2
  id=friendship_buttonSend friend request/a

 And the callback doesn't work. It just follows the URL like a normal 
 href...


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Anthony
You'll have to create a custom form in some fashion, setting the input 
names to distinguish the specific tables for fields with the same name.

Anthony

On Monday, April 21, 2014 2:34:30 PM UTC-4, Spokes wrote:

 Thanks for the clarification, Anthony. Can you recommend a good way to 
 achieve the functionality I mentioned, or does such a form, along with 
 processing, inserts, etc., have to be manually crafted?

 On Monday, April 21, 2014 1:20:16 PM UTC-5, Anthony wrote:

 No, the documentation mentions this as a limitation of using 
 SQLFORM.factory with multiple tables.

 On Monday, April 21, 2014 1:56:44 PM UTC-4, Spokes wrote:

 I'm using SQLFORM.factory() to generate a form from multiple tables, 
 some of which have fields that have the same names as fields in other 
 tables. In the form that's generated, the first instance of the field with 
 the common name appears, but any subsequent instances of the field with 
 that name are absent. A basic version of the code is something like this:

 Model: 

 db.define_table('table1', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)
 db.define_table('table2', ...)
 db.define_table('table3', ... Field('address', type='text',length=512, 
 Label = T('address')), ...)

 Controller:

 form = SQLFORM.factory(db.table1, db.table2, db.table3)

 In the generated form, only one instance of 'address' would appear. Is 
 there a way to have SQLFORM.factory() create a form that contains all 
 instances of fields with shared names, and to have it distinguish them so 
 as to facilitate inputting the values of the form.vars into the appropriate 
 tables (I'd imagine an insert with _filter_fields should still work, 
 but asking just in case)? Thank you.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: RFC: web2py-based workflow engine

2014-04-21 Thread Dave S


On Friday, April 18, 2014 8:17:54 PM UTC-7, Andrew W wrote:

 Thanks.  That's a .net solution so not quite the web2py solution I was 
 looking for.



A quick look didn't turn up anything about workflows by Ross outside of 
this thread.

BTW, my thoughts on a multiperson-signoff that would be only 1 step involve 
some sort of tuple.  I haven't thought this through enough, but I think I 
would have a requires tuple  and you'd match the entries of a signed 
(or accepts') tuple against it; when fully matched you proceed to the next 
step.

A minor variation allows a choice of signers:  If Allen and Bradley both 
could sign for QA, then the QA field of the requires would have a tuple 
of (Allen, Bradley).

I'd want a way to force an item into a particular state, but have very 
tight auth requirments on that and extra logging when it was used.

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] generating your own _formkey values

2014-04-21 Thread Sharon Correll
I'm a web2py newbie, so please excuse me if I'm overlooking something 
obvious.

I'm trying to build my own custom form for creating and editing records in 
a database. I'm trying to garner clues from the way SQLFORM does it.

The documentation says:

The hidden field called _formkey is a one-time token that web2py uses to 
 prevent double submission of forms. The value of this key is generated when 
 the form is serialized and stored in the session. When the form is 
 submitted this value must match, or elseaccepts returns False without 
 errors as if the form was not submitted at all.


I've dug into the session and found places where these keys appear to be 
stored for the forms. My hypothesis is that after the form is processed, 
the associated _formkey is placed in the session's list to prevent the form 
being processed again.

It seems then that I should be able to generate these myself. But when I 
put my own key in the form, it never seems to be added to the session.

Is it possible there is also some magic that happens when the form is 
generated...?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: is it possible to hand over Rows object to sqlform.grid form ?

2014-04-21 Thread Dave S
On Monday, April 21, 2014 7:15:10 AM UTC-7, alex wrote:

 Hello guys. I need to display different rows with checkboxes from 
 different tables , so I decided to use grid form. With such demands I have 
 to use one grid form for each table, but as far as I know that it's 
 incorrect to do so. Maybe there is a way to extract rows from those tables 
 and hand them over to a grid form ?? Any other options ? Thanks...


Can you make a temporary table for the collected data, and make your fom 
from that?   Do the different tables have similar structure, or are you 
collecting disparate items (part number from the parts table, document 
title from the documentation table, and appointment time from the 
scheduling table?)

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: generating your own _formkey values

2014-04-21 Thread Anthony
Yes, when the form.accepts (or form.process) is called, web2py generates 
the formname and formkey, adds those hidden fields to the form, and adds 
the formkey to the session (with the formname as the key). When the form is 
submitted, it checks that the formkey associated with the formname in the 
session matches the forname and formkey submitted. If not, it generates a 
new formkey and replaces the version in both the hidden field of the form 
and the session (for use on the next submission). If the submission is 
successful, the formkey is removed from the session so the form cannot be 
submitted again. This mechanism also protects against CSRF attacks (in 
fact, that is its primary benefit, as double submission can and is 
prevented via client-side freezing of the submit button).

Anthony

On Monday, April 21, 2014 3:07:47 PM UTC-4, Sharon Correll wrote:

 I'm a web2py newbie, so please excuse me if I'm overlooking something 
 obvious.

 I'm trying to build my own custom form for creating and editing records in 
 a database. I'm trying to garner clues from the way SQLFORM does it.

 The documentation says:

 The hidden field called _formkey is a one-time token that web2py uses to 
 prevent double submission of forms. The value of this key is generated when 
 the form is serialized and stored in the session. When the form is 
 submitted this value must match, or elseaccepts returns False without 
 errors as if the form was not submitted at all.


 I've dug into the session and found places where these keys appear to be 
 stored for the forms. My hypothesis is that after the form is processed, 
 the associated _formkey is placed in the session's list to prevent the form 
 being processed again.

 It seems then that I should be able to generate these myself. But when I 
 put my own key in the form, it never seems to be added to the session.

 Is it possible there is also some magic that happens when the form is 
 generated...?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Bug in deflate of json fields

2014-04-21 Thread Sebastian Ortiz Vasquez
Hi, i discovered a bug, but don't have enoght time to solve this.

The problem is this, i'm using psycopg2==2.5.2 to get this working, because 
pg8000 still in web2py distribution does not work.

I defined a field of type 'json', (postgresql supports it), when web2py 
inflates the json field as a dict, thats good, but if i do change the json 
field, and i do a row.update_record() it fails as follows, becuse DAL is 
not able to deflate the field as json, a work arround i used is to set the 
field using row[field] = gluon.contrib.simplejson.dumps(dict) and it works, 
but is really annoying if i do change any other field in this way 
row[any_field] = 'some data', and the call the row.update_record() it fails 
becuase the same problem with the json field.


Thank you,


File applications/pyforms/modules/pyform_forms.py, line 339, in 
_edit_grid_data
if row.update_record():
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 10640, in 
__call__
table._db(table._id==id,ignore_common_filters=True).update(**newfields)
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 10549, in 
update
ret = db._adapter.update(%s % table._tablename,self.query,fields)
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 1620, in update
raise e
DataError: invalid input syntax for type json
LINE 1: ...topografica=NULL,reviso=NULL,estructura_ecologica='{u''1'': ...


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: View functions in module?

2014-04-21 Thread Thomas de Noronha e Silva
Thanks, that does it :) I'll probably automate the conversion since I'm 
using Jade to generate the html

On Monday, 21 April 2014 16:43:03 UTC+1, Anthony wrote:

 Would it be difficult to simply define the functions in a module, or do 
 they include a lot of interspersed HTML? If the latter, you can still port 
 the functions to standard Python functions in a module by wrapping any HTML 
 lines in response.write(). You can also automate the conversion of existing 
 functions as follows:

 from gluon.template import TemplateParser
 converted_code = TemplateParser(original_code).to_string()

 Otherwise, you can store the shared files in a central location and 
 reference them via ../../path/to/shared/views.

 Anthony

 On Monday, April 21, 2014 5:57:33 AM UTC-4, Thomas de Noronha e Silva 
 wrote:

 I have a file A.html containing a couple of view functions that I want to 
 include in several view across different apps. Is there a way in web2py 
 that avoids either replicating the files or using volatile file paths? 
 Ideally, I wish I could import the compiled version of view functions in a 
 similar way I'd do it with a module?

 I might be missing something very obvious too, I'm prepared for that 
 possibility :)



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pre-registering users

2014-04-21 Thread Horst Horst
Thanks, Massimo, what I ended up doing so far is:

 1. Pre-registering users with register_bare(), using a random password and 
an empty user name
 2. Sending out a password reset mail like you wrote
 3. After the user changed the password, on the subsequent call of index(), 
having the app check whether the user name is empty and redirect to 
user/profile

This works, but the user experience for new users is less than ideal, as 
they get to see two forms in a row. In addition, the reset_password form 
lacks the nice password strength coloring feature - and the new users 
choose their first password here. 

Do you see a way to present them with the actual register form or an 
equivalent single form?




Am Montag, 10. März 2014 02:02:52 UTC+1 schrieb Massimo Di Pierro:

 One way is to create accounts in auth.auth_user and the call

 for user in newly_registered_users:
  auth.messages.reset_password = I have shared a document with you click 
 on the link %(link)s to reset your password, your document is . bla bla 
 bla
  auth.email_reset_password(user)

 On Friday, 7 March 2014 08:14:21 UTC-6, Horst Horst wrote:

 I'd like to implement a feature similar to sharing Google docs or 
 Dropbox: If you share something with a non-registered user, he gets a 
 notification email, but once he signed up, the permissions are already in 
 place.

 Programmatically registering users should be no problem, but how can I 
 show the registration form on their first visit, and have it not complain 
 about the email being already present?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: generating your own _formkey values

2014-04-21 Thread Sharon Correll
Well, that *seems* like a very different process from what I'm seeing. I 
have a form called langResource/9 (to modify a record with id=9 from the 
langResource table). The value that I see in the session is:

'_formkey[langResource/9]': ['79f4f99e-9205-460d-97b1-44038b475307',
'1c0d6498-0807-470c-a12a-b322b4497ebe', 
'741f801b-3aed-41e1-8677-f60441d7d08f',
'1f02a0fe-ad43-4d7b-b5a3-8f243cfa61a2', 
'a5217aeb-54c5-4431-8531-444a3306f09d',
'381170ee-4c94-4fad-b2bf-76234cc01df2', 
'15949cfb-d7ce-41a5-b211-f023fedc747f',
'ab577662-311d-4b54-9706-0a63bedac2db', 
'5861005d-5eb1-406b-826f-7e7995ed03e4']

(and of course there are many other keys similar to this). The hidden 
fields in the HTML look like:

div style=display:none
   input name=id type=hidden value=9
   input name=_formkey type=hidden value=
734b92bb-6c05-4916-858c-fe11765d8aff 
   input name=_formname type=hidden value=langResource/9 
 /div

I don't see that number in the list above, or anywhere in the session. 
After I press the submit button, the session looks like:

'_formkey[langResource/9]': ['79f4f99e-9205-460d-97b1-44038b475307',
'1c0d6498-0807-470c-a12a-b322b4497ebe', 
'741f801b-3aed-41e1-8677-f60441d7d08f',
'1f02a0fe-ad43-4d7b-b5a3-8f243cfa61a2', 
'a5217aeb-54c5-4431-8531-444a3306f09d', 
'381170ee-4c94-4fad-b2bf-76234cc01df2', 
'15949cfb-d7ce-41a5-b211-f023fedc747f', 
'ab577662-311d-4b54-9706-0a63bedac2db', 
'5861005d-5eb1-406b-826f-7e7995ed03e4',
'734b92bb-6c05-4916-858c-fe11765d8aff']

I.e, it has now been appended to the end of the list.

So if the key is somewhere in the session *before* the form is processed, I 
sure would like to know where. I don't see it at all.

On Monday, April 21, 2014 2:50:33 PM UTC-5, Anthony wrote:

 Yes, when the form.accepts (or form.process) is called, web2py generates 
 the formname and formkey, adds those hidden fields to the form, and adds 
 the formkey to the session (with the formname as the key). When the form is 
 submitted, it checks that the formkey associated with the formname in the 
 session matches the forname and formkey submitted. If not, it generates a 
 new formkey and replaces the version in both the hidden field of the form 
 and the session (for use on the next submission). If the submission is 
 successful, the formkey is removed from the session so the form cannot be 
 submitted again. This mechanism also protects against CSRF attacks (in 
 fact, that is its primary benefit, as double submission can and is 
 prevented via client-side freezing of the submit button).

 Anthony


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Classic Error with Rocket - can't launch web2py any more

2014-04-21 Thread samuel bonill
try:

python web2py.py -i 127.0.0.1 -p 500



El lunes, 21 de abril de 2014 10:03:24 UTC-5, Dansant vzw escribió:

 I'am again trying (after several earlier and succesfull atempts) to learn 
 some web2py. In the past I just got the framework up and running without 
 any problem at all. 

 Unless I tryed it recently again and got the following error, which seems 
 to be a classic:

 ERROR:Rocket.Errors.Port8000:Socket 127.0.0.1:8000 in use by other 
 process and it won't share.
 WARNING:Rocket.Errors.Port8000:Listener started when not ready.

 I'am working on a Debian Linux machine (Wheezy) and have the Python IDLE 
 2.6, 2.7 and 3.2 installed on my machine.

 I also recently did some experiments with wordpress running on my desktop, 
 but I uninstalled everything (incl. Apache).

 And it is still not running properly. The only thing I can think off is 
 the fact that I installed a virus protection clamav. But even when I 
 uninstalled that one, it didn't work. 

 It is even not working when I'am trying to use it offline (shutting down 
 my home wifi for a while)



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pre-registering users

2014-04-21 Thread Massimo Di Pierro
Please open a ticket:
- the reset password should display password strenght
- there should be an option to automatically login after reset password.

On Monday, 21 April 2014 16:25:20 UTC-5, Horst Horst wrote:

 Thanks, Massimo, what I ended up doing so far is:

  1. Pre-registering users with register_bare(), using a random password 
 and an empty user name
  2. Sending out a password reset mail like you wrote
  3. After the user changed the password, on the subsequent call of 
 index(), having the app check whether the user name is empty and redirect 
 to user/profile

 This works, but the user experience for new users is less than ideal, as 
 they get to see two forms in a row. In addition, the reset_password form 
 lacks the nice password strength coloring feature - and the new users 
 choose their first password here. 

 Do you see a way to present them with the actual register form or an 
 equivalent single form?




 Am Montag, 10. März 2014 02:02:52 UTC+1 schrieb Massimo Di Pierro:

 One way is to create accounts in auth.auth_user and the call

 for user in newly_registered_users:
  auth.messages.reset_password = I have shared a document with you click 
 on the link %(link)s to reset your password, your document is . bla bla 
 bla
  auth.email_reset_password(user)

 On Friday, 7 March 2014 08:14:21 UTC-6, Horst Horst wrote:

 I'd like to implement a feature similar to sharing Google docs or 
 Dropbox: If you share something with a non-registered user, he gets a 
 notification email, but once he signed up, the permissions are already in 
 place.

 Programmatically registering users should be no problem, but how can I 
 show the registration form on their first visit, and have it not complain 
 about the email being already present?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: generating your own _formkey values

2014-04-21 Thread Anthony
Oops, I forgot the mechanism was altered not long ago. Now you can open up 
to 10 versions of a form and submit any of them (previously, opening a new 
version of a form, say in a separate browser tab, would invalidate any 
previously opened versions because the formkey was overwritten in the 
session). The process is still similar -- when you create and process the 
form, its formkey goes into a list in the session (which grows to a max of 
10, on a first-in-first-out basis). When the form is submitted, it checks 
for the form's formkey in that list, and if present, the form is accepted 
and that formkey is deleted from the list (so it cannot be re-used).

I'm not sure you are inspecting the session at the right time. When you 
load a new form on a page, you should see the formkey in the hidden field 
of that form also appear appened to the end of the formkey list in the 
session. When you submit that form, you should no longer see its formkey in 
the session -- instead, assuming a fresh form has loaded into the page, it 
should have a new formkey, and that new formkey should now be in the 
session list.

I would say to check the session, include response.toolbar() in the view, 
but unfortunately, it looks like there is a bug that prevents the toolbar 
from showing session keys that begin with an underscore (such as _formkey).

Anthony

On Monday, April 21, 2014 5:38:11 PM UTC-4, Sharon Correll wrote:

 Well, that *seems* like a very different process from what I'm seeing. I 
 have a form called langResource/9 (to modify a record with id=9 from the 
 langResource table). The value that I see in the session is:

 '_formkey[langResource/9]': ['79f4f99e-9205-460d-97b1-44038b475307',
 '1c0d6498-0807-470c-a12a-b322b4497ebe', 
 '741f801b-3aed-41e1-8677-f60441d7d08f',
 '1f02a0fe-ad43-4d7b-b5a3-8f243cfa61a2', 
 'a5217aeb-54c5-4431-8531-444a3306f09d',
 '381170ee-4c94-4fad-b2bf-76234cc01df2', 
 '15949cfb-d7ce-41a5-b211-f023fedc747f',
 'ab577662-311d-4b54-9706-0a63bedac2db', 
 '5861005d-5eb1-406b-826f-7e7995ed03e4']

 (and of course there are many other keys similar to this). The hidden 
 fields in the HTML look like:

 div style=display:none
input name=id type=hidden value=9
input name=_formkey type=hidden value=
 734b92bb-6c05-4916-858c-fe11765d8aff 
input name=_formname type=hidden value=langResource/9 
  /div

 I don't see that number in the list above, or anywhere in the session. 
 After I press the submit button, the session looks like:

 '_formkey[langResource/9]': ['79f4f99e-9205-460d-97b1-44038b475307',
 '1c0d6498-0807-470c-a12a-b322b4497ebe', 
 '741f801b-3aed-41e1-8677-f60441d7d08f',
 '1f02a0fe-ad43-4d7b-b5a3-8f243cfa61a2', 
 'a5217aeb-54c5-4431-8531-444a3306f09d', 
 '381170ee-4c94-4fad-b2bf-76234cc01df2', 
 '15949cfb-d7ce-41a5-b211-f023fedc747f', 
 'ab577662-311d-4b54-9706-0a63bedac2db', 
 '5861005d-5eb1-406b-826f-7e7995ed03e4',
 '734b92bb-6c05-4916-858c-fe11765d8aff']

 I.e, it has now been appended to the end of the list.

 So if the key is somewhere in the session *before* the form is processed, 
 I sure would like to know where. I don't see it at all.

 On Monday, April 21, 2014 2:50:33 PM UTC-5, Anthony wrote:

 Yes, when the form.accepts (or form.process) is called, web2py generates 
 the formname and formkey, adds those hidden fields to the form, and adds 
 the formkey to the session (with the formname as the key). When the form is 
 submitted, it checks that the formkey associated with the formname in the 
 session matches the forname and formkey submitted. If not, it generates a 
 new formkey and replaces the version in both the hidden field of the form 
 and the session (for use on the next submission). If the submission is 
 successful, the formkey is removed from the session so the form cannot be 
 submitted again. This mechanism also protects against CSRF attacks (in 
 fact, that is its primary benefit, as double submission can and is 
 prevented via client-side freezing of the submit button).

 Anthony



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Greg Vaughan
Hey Niphlod,

Thanks for that answer...  you are spot on in seeing the problem... my 
#appointments_blah id's did get changed to #no_table_blah hence the 
jQuery was targeting id's that no longer existed...

To fix it I simply changed the hard coded script at this point to target 
#no_table_unit, #no_table_unit, #no_table_unit, #no_table_unit 
etc... which is very ugly :(

I can use input names to hide the data fields as you suggested above which 
is preferred but how would I hide the labels? They do not have a name 
property...

I could not work out how to use the form = SQLFORM.factory(Field() ., 
table_name='appointments') suggestion in this instance... I get it if I am 
using a normal instance of SQLFORM.factory... but in this case where i am 
referencing and updating two tables i cannot seem to get the syntax right...

The relevent part  form = SQLFORM.factory(db.appointments, db.notes) 
 are you sating I wrap this section with the above?

Eg... form = SQLFORM.factory(
Field('field name'), ('field name'), ., table_name='appointments')

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Hosting separate web2py application and PHP application on same apache fedora server

2014-04-21 Thread Tim Richardson
I thought it wasn't recommended to run php on a multi-threaded (MPM) 
apache? 
http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Adding fields to auth_user (and creating alternate username validation)

2014-04-21 Thread Rufus
Still a noob, but starting to actually use web2py, and getting hands dirty:

I am working on  an actual web2py project (low-bandwidth word game 
back-end logic), and I'm finding as I make
incremental changes I hit potholes on the way.   I have some users who are 
going to the website to download alpha
versions of the program.   I recently enabled auth, to get registration 
capability.  Some enthusiastic users registered
before I noticed the separate username was not enabled.  When I enabled 
it, the database records has username of
None upon  migration, so people couldn't log on by username.   What I did 
is just plug in some  user names which
they can now change in their profile (once they find they can't log in, 
they can ask for their user name)

   In examining username, there is a limited format for user name, allowing 
only hyphens and decimal points. I wanted
more liberal character set, but there's not simple way to extend that 
capability.  To do that, I have to modify gluon.tools.
(Starting to get messy...)

   So my question is:  What procedure is recommended for expanding the 
auth_user data table, adding more fields and
changing validation.  Do I rewrite all of it?  Can I actually subclass it 
and extend it?  Do I edit gluon.tools in my own
system?




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.grid and in-place-update

2014-04-21 Thread Jayadevan M
I am learning how to use SQLFORM.grid. I am able to display a set of 
records. 
1) If the user clicks on Edit for a record, it goes to a new page and also 
displays all the columns (though I chose only a few fields in the grid). 
How can I avoid that?
2) Is it possible to update multiple records in the initial form that comes 
up? The form displays a list of users and their key attributes. The user 
just needs to check a verified flag against the users and click submit. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] CouchDB driver No Tables/FIELDS?

2014-04-21 Thread Brando
I want to use CouchDB for an upcoming project.  I know that i'm supposed to 
install a couchdb driver, but i have no idea where to get the driver from 
and where exactly it needs to be installed.

Also, I'm assuming since couch is a document database that it will be 
unnecessary for me to define tables and fields, is this correct?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.