[web2py] Re: Bare Login using API key

2014-07-30 Thread lyn2py
Thanks Leonel! I just thought that web2py had something like that already 
in place, perhaps needed to add a correct decorator, and I didn't need to 
reinvent the wheel.

Sidenote to Massimo: What do you think of the idea? Have a decorator to 
check for a special field or fields (API key related, like API key, API 
secret) in order to get a particular / restricted access to the API calls.



On Thursday, July 31, 2014 2:06:21 AM UTC+8, Leonel Câmara wrote:
>
> An easy way would be to have your default.py/call function check the API 
> key and raise HTTP(403) if it's not valid. You could subclass Auth, make 
> your own basic_login using the API key, use that as the Auth for your 
> application, and then use auth.requires_login() in call, but it seems 
> unnecessarily complicated for this.
>

-- 
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 Consume external NetTcp SOAP service in Web2Py

2014-07-30 Thread Dave S
So it's not too bad consuming a service I provide for myself, but I'm also 
interested in a service provided by a third-party device.

This particular service doesn't use "action", instead it uses "control" and 
"flag".

In a SUDS client (sudsclient = suds.client.Client(serviceurl, transport), 
I use sudsclient.factory.create('ns2:typename') to create the xmlnodes,
and in sudsclient.service.XYZService(control, action="", node, flag) use 
the 
settings I've given them (string and integer, respectively) while leaving 
the action blank (as you see).

The debug info from the SUDS client shows the XML with the usual stuff and 
the body as follows:
HEADERS: {'SOAPAction':'""', [...], 'Soapaction' : '""'}

and

http://www/w3/org/ 
[etc, including 1 proprietary
 and 2 xmlsoap.org] ]>
STR1NODEIDSTR
1234

Does someone have a suggestion how to do this with pysimplesoap?  I'm 
looking at the source of client.py, but it will take me a while to make 
sense of it and to find where the corresponding bit to 
sudsclient.factory.create() is.

Thanks for your help.

Dave
/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: Display registration error for auth.register_bare()

2014-07-30 Thread Mark Li
I'd like to give a shot at AJAX-ifying the auth.register() form, but I'm 
not quite sure where to start. Looks quite daunting (for me). I'm looking 
at auth.register() source and web2py.js; would I simply want to add code to 
web2py.js to force the auth.register() forms to submit via AJAX (and return 
errors via ajax as well)?

Or would this involve adding changes to auth.register() as well, such as 
providing an option auth.register(ajax=False)?

On Wednesday, July 23, 2014 4:42:05 PM UTC-7, Mark Li wrote:
>
> Posted up a ticket for both suggestions:
>
> https://code.google.com/p/web2py/issues/detail?id=1955
> https://code.google.com/p/web2py/issues/detail?id=1956
>
> On Wednesday, July 23, 2014 12:49:01 AM UTC-7, Massimo Di Pierro wrote:
>>
>> Both are good suggestions.
>>
>> On Tuesday, 22 July 2014 11:55:33 UTC-5, Mark Li wrote:
>>>
>>> Hey Massimo! Just for clarification, are you referring to opening a 
>>> ticket for:
>>>
>>> 1. auth.register() only showing a flash msg on registration error, 
>>> without a page reload
>>>
>>> OR
>>>
>>> 2. auth.register_bare() returning error msg on registration fail, 
>>> instead of just False
>>>
>>>
>>> In my case I would like functionality for #1, but I just wanted to know 
>>> to which of my suggestions you were referring to.
>>>
>>>
>>> On Monday, July 21, 2014 11:32:13 PM UTC-7, Massimo Di Pierro wrote:

 Please open a ticket. Perhaps this should be the default behavior. Easy 
 to change.

 On Monday, 21 July 2014 14:59:34 UTC-5, Mark Li wrote:
>
> Maybe I'm not going about this in the right way. I basically want 
> auth.register() functionality, but without a page reload on registration 
> fail; just a flash msg of the error.
>
> On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote:
>>
>> Is it possible to return the registration error msg from 
>> auth.register_bare(), similar to how auth.register() would display the 
>> error msg after submit? From what I can gather in the source, seems like 
>> it 
>> only returns False on fail, and the user object on success. I would like 
>> to 
>> display more information to the user (password too short, username 
>> already 
>> taken, etc.), if registration fails.
>>
>> I am implementing an ajax registration, where I do not want the page 
>> to reload on submit unless registration is successful. 
>>
>

-- 
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: jquery onchange help

2014-07-30 Thread ocascante
After having read more than 30 post in google, about web2py and ajax that 
have not been answered yet, I could find the way to answer my question. 
Here is for help if someone have the same doubt.

in db.py

def card_name():
if request.vars.card != "":
query = db.cards(db.cards.card==request.vars.card)
return query.name+" "+query.firstname+" "+query.secondname
else:
return ''

In custom form:


{{=form.custom.begin}}
Card Number: {{=form.custom.widget.card}}
.
Card name:

{{=form.custom.end}}

jQuery(document).ready(function(){
   jQuery('#documents_card').change(function(){
   ajax('card_name', ['card'], 'target');
});
});



El miércoles, 30 de julio de 2014 09:41:40 UTC-6, Leonel Câmara escribió:
>
> Eheheh don't read it with a tone, keep asking questions if you need help.
>

-- 
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: Can not import copy_reg

2014-07-30 Thread Niphlod
well, you can't expect a compiled app to work amongst python versions. 
you should compile it on the destination 

On Wednesday, July 30, 2014 10:48:52 PM UTC+2, Leonel Câmara wrote:
>
> Richard if packing and unpacking the application in pythonanywhere is 
> causing problems the cause may be because .pyc files are going with your 
> application pack (you can open the application pack with any archive 
> application and check), maybe in your modules folder. If that's the case 
> this could probably be considered a web2py bug.
>

-- 
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: Can not import copy_reg

2014-07-30 Thread Leonel Câmara
Richard if packing and unpacking the application in pythonanywhere is 
causing problems the cause may be because .pyc files are going with your 
application pack (you can open the application pack with any archive 
application and check), maybe in your modules folder. If that's the case 
this could probably be considered a web2py bug.

-- 
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 Consume external NetTcp SOAP service in Web2Py

2014-07-30 Thread Dave S

On Wednesday, July 30, 2014 10:43:12 AM UTC-7, Dave S wrote:
>
> I kind of let this lay around until last night, when I had the happy idea 
> that this would help me with a particular user problem.  I have stand-alone 
> SOAP clients using SUDS or Java, but I have a user where installing those 
> clients could be problematic.  So I tried as below, but failed.
>
> Note that instead of doing this from a console, I was trying to make this 
> a function within my controller, so that it could be used by clinking a 
> link on a page I'm serving.  
>

When I use -S welcome to have a shell, I get the same connection refused 
error trying to instantiate the client.

Oh, blush.  I forgot the port number in the wsdl URL.

/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.


Re: [web2py] Re: Can not import copy_reg

2014-07-30 Thread Richard
I'll did delete the tables already because I did suspect the database 
because a backup before a database corruption was working and the version 
after the corruption (restored the tables from an other backup) was having 
this issue. I'll keep you informed.

On Wednesday, July 30, 2014 7:33:18 PM UTC+2, Giles Thomas wrote:
>
> Thanks, Leonel.  We'll look into that.
>
>
> On 30 July 2014 18:12, Leonel Câmara > 
> wrote:
>
>> My guess would be this is happening because of you copying files with 
>> pickles around. Some stuff is not portable, for instance, web2py uses 
>> marshal in some places.
>>
>> Pickle is infamous for giving very weird error messages like the one you 
>> are getting that appear to point to other problems.
>>
>> If I am right, a solution can be to delete everything with pickles on it. 
>> Like the table files in the database folder, the sessions and everything in 
>> the cache.
>>  
>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/8toVDprfqwM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Giles Thomas
> gi...@giles.net 
> http://www.gilesthomas.com/
> http://www.pythonanywhere.com/
>
> 

-- 
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: Are MD5sums posted for Web2Py?

2014-07-30 Thread Dave S


On Wednesday, July 30, 2014 10:45:32 AM UTC-7, lyn2py wrote:
>
> You need to use HTTPS to access admin
>
>
I am not doing so on the Fedora machine. I am using 
http://xx.yy.zz.ww:8000/admin/default/site from a browser running on the 
same machine as the web2py instance.  Since it is an antique version of 
Fedora (16!  Installed 2 years ago!), it may be the system libraries 
supporting web2py are less sensitive to this issue.

/dps

 

> On Saturday, May 24, 2014 3:18:06 AM UTC+8, Dave S wrote:
>>
>>
>>
>> On Friday, May 23, 2014 11:57:27 AM UTC-7, Dave S wrote:
>>>
>>> I just downloaded the Normal ("stable"?) version and the Developer's 
>>> ("nightly"?) version for use on a Centos machine,
>>>
>>
>> Also, I can't see what I did wrong at startup, but the "admin interface 
>> is disabled because of insecure channel".
>>
>> I'm using a browser on the same machine, same user session.   The local 
>> IP is 10.xx.yy.zz, and I used "-i 10.xx.yy.zz", and set a password on the 
>> first try,
>> and used "-a '' " on the second try.  And that matches how I did 
>> it on the Fedora machine, where I don't have any problems.
>> Both are using Version 2.9.5-stable+timestamp.2014.03.16.02.35.39.
>>
>> (I also have the Windows version working on Yet Another Machine (my 
>> laptop)).
>>
>>
>> /dps
>>
>>
>>  
>>
>>> and I wanted to check that I got what I think I got.
>>>
>>> The values I get are
>>>
>>> # developer version
>>> d083f552b19ac25d24020fdc6388baea
>>>
>>> # normal
>>> fe8e532990006964fda40478ef18d663
>>>
>>> /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.


Re: [web2py] Re: Bootstrap is really killing web2py

2014-07-30 Thread Anthony
On Wednesday, July 30, 2014 1:21:20 PM UTC-4, Ramos wrote:
>
> meteorjs has a nice feature 
>
> you want bootstrap? 
> just do 
> meteor add boostrap
>  inside your folder app and you are good to go.
>

As far as I can tell, though, that is a legacy package based on Bootstrap 
2. You have to install a third party package for Bootstrap 3, and I don't 
think they plan to move Bootstrap 3 to the core packages. No other CSS 
frameworks are supported via core packages. Furthermore, I think all that 
gets you is the actual Bootstrap CSS and JS files, along with some minor 
CSS overrides. There is no HTML layout as with the web2py scaffolding app.

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: Bare Login using API key

2014-07-30 Thread Leonel Câmara
An easy way would be to have your default.py/call function check the API 
key and raise HTTP(403) if it's not valid. You could subclass Auth, make 
your own basic_login using the API key and use that as the Auth for your 
application but it seems unnecessarily complicated for this.

-- 
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: Are MD5sums posted for Web2Py?

2014-07-30 Thread lyn2py
You need to use HTTPS to access admin

On Saturday, May 24, 2014 3:18:06 AM UTC+8, Dave S wrote:
>
>
>
> On Friday, May 23, 2014 11:57:27 AM UTC-7, Dave S wrote:
>>
>> I just downloaded the Normal ("stable"?) version and the Developer's 
>> ("nightly"?) version for use on a Centos machine,
>>
>
> Also, I can't see what I did wrong at startup, but the "admin interface is 
> disabled because of insecure channel".
>
> I'm using a browser on the same machine, same user session.   The local IP 
> is 10.xx.yy.zz, and I used "-i 10.xx.yy.zz", and set a password on the 
> first try,
> and used "-a '' " on the second try.  And that matches how I did 
> it on the Fedora machine, where I don't have any problems.
> Both are using Version 2.9.5-stable+timestamp.2014.03.16.02.35.39.
>
> (I also have the Windows version working on Yet Another Machine (my 
> laptop)).
>
>
> /dps
>
>
>  
>
>> and I wanted to check that I got what I think I got.
>>
>> The values I get are
>>
>> # developer version
>> d083f552b19ac25d24020fdc6388baea
>>
>> # normal
>> fe8e532990006964fda40478ef18d663
>>
>> /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: Bare Login using API key

2014-07-30 Thread lyn2py
I may have been misunderstood. 

I meant to ask, how can I have a user use *API keys* (API key + secret if 
needed) to access JSON-RPC instead of user login/pass.

Thanks.

On Thursday, July 31, 2014 12:03:02 AM UTC+8, Michael Gheith wrote:
>
> From a high level view you can create an extra field in the auth table, 
> and put random keys in it as a default value for each of your users.  Or 
> when someone signs up, they can automatically get assigned a random key 
> using the DAL default parameter in Field.  So each user will have a unique 
> key.  There are several methods to generate these random keys, you can 
> search for it here in the web2py group.  Let me know if that makes sense.
>
> Best,
> M.G.
>
> On Tuesday, July 29, 2014 4:45:47 PM UTC-5, lyn2py wrote:
>>
>> Hi guys, 
>>
>> Creating an API (within my web2py app), and need to use a login that's 
>> not the user's login, hence the API key. How should I go about a bare login 
>> using API key?
>>
>>
>>

-- 
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 Consume external NetTcp SOAP service in Web2Py

2014-07-30 Thread Dave S
I kind of let this lay around until last night, when I had the happy idea 
that this would help me with a particular user problem.  I have stand-alone 
SOAP clients using SUDS or Java, but I have a user where installing those 
clients could be problematic.  So I tried as below, but failed.

Note that instead of doing this from a console, I was trying to make this a 
function within my controller, so that it could be used by clinking a link 
on a page I'm serving.  I have an instance of web2py on an old Fedora, 
where it has been running happily for nearly a year.  The SOAP provider 
works fine there.  In addition, there is a summary page I can browse to.  
This works from the local browser, but when I try to use the SOAP client 
code I get connection refused.  So I turned to another instance of web2py, 
running on Centos machine.  I can access it just fine via my stand-alone 
SOAP clients and the summary page, but again I get "connection refused".
(from urlib2.py, line 1165, Errno 111 per the ticket.; HTTP 500 sent to the 
client machine).

tcpdump on the Centos machine shows it being the access to the function 
that acts as the SOAP client, and console output indicates that 
instantiating the client is the problem.  I've tried with both the location 
parameters as shown below, or with the wsdl parameter as in the first 
example on pysimplesoap, and with and without setting the Authorization 
header (the servers are on an internal network, and still using Rocket, and 
so I've turned off authorization on the SOAP provider;  the stand-alone 
clients send the authorization header, but it isn't used).  One of the 
stand-alone clients uses pyssimplesoap.

Any suggestions?

Dave
/dps





On Wednesday, July 9, 2014 6:47:42 AM UTC-7, Matheus Cardoso wrote:
>
> There are some examples in the web2py's book 
>  and lots of 
> more in pysimplesoap repository , 
> as Massimo said. Besides, I just created a WS and a SOAP client with basic 
> authentication and I used some of many forms of consuming a WS like this:
>
>
> ws_user = "your_login"
> ws_pass = "your_password"
>
> #I am using web2py to create the client
> from gluon.contrib.pysimplesoap.client import SoapClient
> import base64
> encoded = base64.b64encode('%s:%s' % (ws_user, ws_pass)).replace('\n', '')
>
> # The following IS NOT the address of the WSDL from WS
> ws_location = "your_web_service_location"
> ws_action = "your_web_service_action"
> ws_namespace = "your_web_service_namespace"
>
> # Create the client
> client_soap = SoapClient(
> location = ws_location,
> action = ws_action, # SOAPAction
> namespace = ws_namespace,
> soap_ns='soap', trace = False, ns = False, exceptions=True, 
> http_headers={'Authorization': "Basic %s" % encoded})
>
> Enjoy! :)
>
> On Monday, June 23, 2014 2:39:22 PM UTC-3, Gopi wrote:
>>
>> Hi All.. I am new to web2py. Is there a way to call external NetTcp SOAP 
>> service in Web2Py. What are the best practices to call such  services in 
>> Web2Py?
>>
>

-- 
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: Can not import copy_reg

2014-07-30 Thread Giles Thomas
Thanks, Leonel.  We'll look into that.


On 30 July 2014 18:12, Leonel Câmara  wrote:

> My guess would be this is happening because of you copying files with
> pickles around. Some stuff is not portable, for instance, web2py uses
> marshal in some places.
>
> Pickle is infamous for giving very weird error messages like the one you
> are getting that appear to point to other problems.
>
> If I am right, a solution can be to delete everything with pickles on it.
> Like the table files in the database folder, the sessions and everything in
> the cache.
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/8toVDprfqwM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Giles Thomas
gi...@giles.net
http://www.gilesthomas.com/
http://www.pythonanywhere.com/

-- 
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: Bootstrap is really killing web2py

2014-07-30 Thread António Ramos
meteorjs has a nice feature

you want bootstrap?
just do
meteor add boostrap
 inside your folder app and you are good to go.







2014-07-30 18:09 GMT+01:00 Jim S :

> I agree with Anthony.  What I've done with my apps is to rip apart the
> base layout and provide my own.  I typically find something I like in
> https://wrapbootstrap.com/ and update layout.html to accommodate.
>
> -Jim
>
>
>
>
> On Wednesday, July 30, 2014 11:52:35 AM UTC-5, Anthony wrote:
>>
>> Thanks for the answer, I was aware of that completely. It is just that
>>> Massimo said that it is trivial to replace BS2 with BS3 yet when I try to
>>> do it the trivial way and then create a FORM in controller (whether it be
>>> simple form, sqlform or sqlform.factory) the form looks completely wrong.
>>> The same is with main menu.
>>>
>>
>> By trivial, I don't think Massimo meant to take templates with non-BS3
>> HTML structure and CSS classes and simply load the BS3 CSS file and expect
>> to have everything work.
>>
>>
>>> Now I know that in this case I should create form in HTML using
>>> appropriate BS3 classes and then use that form in controller but I think
>>> you will agree that this takes away the ease of use which is one of the
>>> main strengths of web2py.
>>>
>>
>> First, web2py does include a BS3 formstyle, so you can simply do:
>>
>> SQLFORM(..., formstyle='bootstrap3')
>>
>> and assuming you have the BS3 CSS loaded, your forms should look fine.
>>
>> More generally, though, web2py cannot cater to every CSS framework.
>> Because Bootstrap is so popular, it is used for the scaffolding app, and
>> there are built-in formstyles for BS2 and BS3. If you want to use another
>> CSS framework, however, you can simply spend a few minutes writing a custom
>> formstyle function, and then use that for all of your forms -- no need to
>> write custom HTML in every form view.
>>
>>
>>> I suppose that was why OP named this thread "Bootstrap is killing
>>> web2py". I think a lot of web2py users (like myself) are novices in web
>>> programming and while it may be trivial for versed web programmer to use
>>> BS3 with web2py it is not the case for the beginners. BS3 is more than a
>>> year old but I still develop my web apps using BS2 because that is what
>>> ships with web2py. I don't want to criticize, web2py is an excellent
>>> framework but I think it needs to ship with BS3, otherwise it will lose a
>>> lot of novice programmers and I think novice programmers are important
>>> because those are the future user base of web2py.
>>>
>>
>> I agree that the scaffolding app should migrate to BS3, but this is a bit
>> of an odd complaint. Most server side frameworks come with no scaffolding
>> app at all. How could the lack of a BS3 scaffolding app be killing web2py
>> if the alternatives don't offer one either? web2py certainly doesn't make
>> it any harder to work with BS3 than any other framework, and in fact it is
>> generally easier because web2py does include a BS3 formstyle and BS3
>> classes for the grid (most other frameworks don't even include a grid for
>> that matter).
>>
>> Of course it's easier if the scaffolding app already happens to be based
>> on the CSS framework you want to use, but it really is not that difficult
>> to take any front-end template you find and convert it to a web2py layout
>> template, as described here
>> .
>> Just start with the HTML template and insert some of the web2py template
>> code you see in the welcome layout.html, tweaked as needed. You might also
>> keep some or all of web2py.css.
>>
>> In any case, Massimo has distributed a BS3 version of the welcome app,
>> though if you're not planning to make any layout/styling modifications
>> anyway, it really won't be any different from using the BS2 version.
>>
>> 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.
>

-- 
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: Can not import copy_reg

2014-07-30 Thread Leonel Câmara
My guess would be this is happening because of you copying files with 
pickles around. Some stuff is not portable, for instance, web2py uses 
marshal in some places.

Pickle is infamous for giving very weird error messages like the one you 
are getting that appear to point to other problems.

If I am right, a solution can be to delete everything with pickles on it. 
Like the table files in the database folder, the sessions and everything in 
the cache.

-- 
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: Bootstrap is really killing web2py

2014-07-30 Thread Jim S
I agree with Anthony.  What I've done with my apps is to rip apart the base 
layout and provide my own.  I typically find something I like 
in https://wrapbootstrap.com/ and update layout.html to accommodate.

-Jim



On Wednesday, July 30, 2014 11:52:35 AM UTC-5, Anthony wrote:
>
> Thanks for the answer, I was aware of that completely. It is just that 
>> Massimo said that it is trivial to replace BS2 with BS3 yet when I try to 
>> do it the trivial way and then create a FORM in controller (whether it be 
>> simple form, sqlform or sqlform.factory) the form looks completely wrong. 
>> The same is with main menu.
>>
>
> By trivial, I don't think Massimo meant to take templates with non-BS3 
> HTML structure and CSS classes and simply load the BS3 CSS file and expect 
> to have everything work.
>  
>
>> Now I know that in this case I should create form in HTML using 
>> appropriate BS3 classes and then use that form in controller but I think 
>> you will agree that this takes away the ease of use which is one of the 
>> main strengths of web2py.
>>
>
> First, web2py does include a BS3 formstyle, so you can simply do:
>
> SQLFORM(..., formstyle='bootstrap3')
>
> and assuming you have the BS3 CSS loaded, your forms should look fine.
>
> More generally, though, web2py cannot cater to every CSS framework. 
> Because Bootstrap is so popular, it is used for the scaffolding app, and 
> there are built-in formstyles for BS2 and BS3. If you want to use another 
> CSS framework, however, you can simply spend a few minutes writing a custom 
> formstyle function, and then use that for all of your forms -- no need to 
> write custom HTML in every form view.
>  
>
>> I suppose that was why OP named this thread "Bootstrap is killing 
>> web2py". I think a lot of web2py users (like myself) are novices in web 
>> programming and while it may be trivial for versed web programmer to use 
>> BS3 with web2py it is not the case for the beginners. BS3 is more than a 
>> year old but I still develop my web apps using BS2 because that is what 
>> ships with web2py. I don't want to criticize, web2py is an excellent 
>> framework but I think it needs to ship with BS3, otherwise it will lose a 
>> lot of novice programmers and I think novice programmers are important 
>> because those are the future user base of web2py.
>>
>
> I agree that the scaffolding app should migrate to BS3, but this is a bit 
> of an odd complaint. Most server side frameworks come with no scaffolding 
> app at all. How could the lack of a BS3 scaffolding app be killing web2py 
> if the alternatives don't offer one either? web2py certainly doesn't make 
> it any harder to work with BS3 than any other framework, and in fact it is 
> generally easier because web2py does include a BS3 formstyle and BS3 
> classes for the grid (most other frameworks don't even include a grid for 
> that matter).
>
> Of course it's easier if the scaffolding app already happens to be based 
> on the CSS framework you want to use, but it really is not that difficult 
> to take any front-end template you find and convert it to a web2py layout 
> template, as described here 
> . 
> Just start with the HTML template and insert some of the web2py template 
> code you see in the welcome layout.html, tweaked as needed. You might also 
> keep some or all of web2py.css.
>
> In any case, Massimo has distributed a BS3 version of the welcome app, 
> though if you're not planning to make any layout/styling modifications 
> anyway, it really won't be any different from using the BS2 version.
>
> 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: Are MD5sums posted for Web2Py?

2014-07-30 Thread Dave S


On Friday, May 23, 2014 12:18:06 PM UTC-7, Dave S wrote:
>
>
>
> On Friday, May 23, 2014 11:57:27 AM UTC-7, Dave S wrote:
>>
>> I just downloaded the Normal ("stable"?) version and the Developer's 
>> ("nightly"?) version for use on a Centos machine,
>>
>
> Also, I can't see what I did wrong at startup, but the "admin interface is 
> disabled because of insecure channel".
>
> I'm using a browser on the same machine, same user session.   The local IP 
> is 10.xx.yy.zz, and I used "-i 10.xx.yy.zz", and set a password on the 
> first try,
> and used "-a '' " on the second try.  And that matches how I did 
> it on the Fedora machine, where I don't have any problems.
> Both are using Version 2.9.5-stable+timestamp.2014.03.16.02.35.39.
>


FWIW, on the Centos machine, the admin interface _is_ available when I 
start an instance with -i 127.0.0.1, as recommended in


Not sure why the Fedora machine can recognize its outside IP as local and 
the Centos can't, but there you have it.

/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.


Re: [web2py] grid problem

2014-07-30 Thread Anthony
On Wednesday, July 30, 2014 4:59:41 AM UTC-4, Manuele wrote:
>
> Il 30/07/14 09:30, ceriox ha scritto: 
> > thanks Javier! 
> > but can you explain "must be a function"? 
> > i use this code in other functions (for other tables) and it work fine! 
> > how i need to change it? 
> Dear ceriox, 
> I think here lie the problem: 
> https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2602-L2605 
>
> look your self, if selectable is not callable its value is passed to 
> enumerate function... 
>
> you can use selectable=lambda _: True instead 
>

You can do the above, but it will make the selection functionality useless 
(unless you are intercepting the submitted request.vars elsewhere 
manually). The "selectable" argument should be a function that takes the 
list of records selected and then does something with them (e.g., delete 
them). It can also be a list of lists if you want to allow more than one 
possible function to be applied to the list of records (in that case, each 
list should include a button label, a callback function, and a button 
class).

Anthony

 

> hope it could help 
> Cheers 
>
> Manuele 
>

-- 
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: Bootstrap is really killing web2py

2014-07-30 Thread Anthony

>
> Thanks for the answer, I was aware of that completely. It is just that 
> Massimo said that it is trivial to replace BS2 with BS3 yet when I try to 
> do it the trivial way and then create a FORM in controller (whether it be 
> simple form, sqlform or sqlform.factory) the form looks completely wrong. 
> The same is with main menu.
>

By trivial, I don't think Massimo meant to take templates with non-BS3 HTML 
structure and CSS classes and simply load the BS3 CSS file and expect to 
have everything work.
 

> Now I know that in this case I should create form in HTML using 
> appropriate BS3 classes and then use that form in controller but I think 
> you will agree that this takes away the ease of use which is one of the 
> main strengths of web2py.
>

First, web2py does include a BS3 formstyle, so you can simply do:

SQLFORM(..., formstyle='bootstrap3')

and assuming you have the BS3 CSS loaded, your forms should look fine.

More generally, though, web2py cannot cater to every CSS framework. Because 
Bootstrap is so popular, it is used for the scaffolding app, and there are 
built-in formstyles for BS2 and BS3. If you want to use another CSS 
framework, however, you can simply spend a few minutes writing a custom 
formstyle function, and then use that for all of your forms -- no need to 
write custom HTML in every form view.
 

> I suppose that was why OP named this thread "Bootstrap is killing web2py". 
> I think a lot of web2py users (like myself) are novices in web programming 
> and while it may be trivial for versed web programmer to use BS3 with 
> web2py it is not the case for the beginners. BS3 is more than a year old 
> but I still develop my web apps using BS2 because that is what ships with 
> web2py. I don't want to criticize, web2py is an excellent framework but I 
> think it needs to ship with BS3, otherwise it will lose a lot of novice 
> programmers and I think novice programmers are important because those are 
> the future user base of web2py.
>

I agree that the scaffolding app should migrate to BS3, but this is a bit 
of an odd complaint. Most server side frameworks come with no scaffolding 
app at all. How could the lack of a BS3 scaffolding app be killing web2py 
if the alternatives don't offer one either? web2py certainly doesn't make 
it any harder to work with BS3 than any other framework, and in fact it is 
generally easier because web2py does include a BS3 formstyle and BS3 
classes for the grid (most other frameworks don't even include a grid for 
that matter).

Of course it's easier if the scaffolding app already happens to be based on 
the CSS framework you want to use, but it really is not that difficult to 
take any front-end template you find and convert it to a web2py layout 
template, as described here 
. Just 
start with the HTML template and insert some of the web2py template code 
you see in the welcome layout.html, tweaked as needed. You might also keep 
some or all of web2py.css.

In any case, Massimo has distributed a BS3 version of the welcome app, 
though if you're not planning to make any layout/styling modifications 
anyway, it really won't be any different from using the BS2 version.

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: Can not import copy_reg

2014-07-30 Thread Giles Thomas
Hi all,

Giles from PythonAnywhere here.  I've been working with Richard to try to 
track this down further.  One thing I can confidently say is that it's not 
an Apache/mod_wsgi problem in this case, because we use nginx and uWSGI.

I've also double-checked that the `copy_reg` import works from a trivial 
Flask app, and that was fine, so I don't think it's the interpreter.

Does anyone have any thoughts on how we could further debug this?


All the best,

Giles





On Wednesday, July 30, 2014 7:18:02 AM UTC+1, Richard wrote:
>
> Some progress is not what I expect :( . It takes time to learn how to 
> configure a webserver. 
>
> I am now hosting the app at Pythonanyware, I expect the libraries they use 
> are up to date. assuming they are, also at pythonanyware running python2.7 
> the same error occurs.
>
> Could it be a bug in Web2py? Please assist me in diagnosing and testing so 
> nobody else will run in this issue.
>
> Richard
>
>

-- 
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: Bare Login using API key

2014-07-30 Thread 'Michael Gheith' via web2py-users
>From a high level view you can create an extra field in the auth table, and 
put random keys in it as a default value for each of your users.  Or when 
someone signs up, they can automatically get assigned a random key using 
the DAL default parameter in Field.  So each user will have a unique key. 
 There are several methods to generate these random keys, you can search 
for it here in the web2py group.  Let me know if that makes sense.

Best,
M.G.

On Tuesday, July 29, 2014 4:45:47 PM UTC-5, lyn2py wrote:
>
> Hi guys, 
>
> Creating an API (within my web2py app), and need to use a login that's not 
> the user's login, hence the API key. How should I go about a bare login 
> using API key?
>
>
>

-- 
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: jquery onchange help

2014-07-30 Thread Leonel Câmara
Eheheh don't read it with a tone, keep asking questions if you need help.

-- 
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: Bootstrap is really killing web2py

2014-07-30 Thread Anthony
On Wednesday, July 30, 2014 5:05:13 AM UTC-4, Gael Princivalle wrote:
>
> Hi Anthony.
>
> I think that web2py grids are really powerful and useful. If web2py grids 
> are not fully compatible with BS3 for me it's a problem. As websites must 
> be generally designed now first for mobile devices, I think that web2py 
> front end as to be done with BS3, and has to be responsive.
>

In what way is the grid not compatible with BS3? Right now it even includes 
BS3 classes.

Note, even the current BS2 scaffolding app is responsive. Yes, the grid 
itself is not "responsive", but it won't be with BS3 either. There are 
various ways to design responsive tables, but people have different 
preferences for how they want to do that, and the best solution may depend 
on the specifics of the data being displayed. I suppose we could develop a 
"responsive" grid option, though that is unrelated to whether we're using 
BS2 or BS3 (and you would want the grid layout to work independent of the 
CSS framework anyway). The best approach will probably be to modularize the 
grid code (which has been discussed), separating the backend querying from 
the actual data display, which would make it easier for users to develop 
custom displays in the views.

Keep in mind that most server side frameworks like web2py don't include 
grid functionality at all. web2py can only do so much regarding grid 
functionality. At some point, if you need more sophisticated grid behavior, 
it may make sense to use a more full-featured solution, such as 
https://datatables.net/extensions/responsive/.

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: jquery onchange help

2014-07-30 Thread ocascante
Thanks for your answer Leonel,
I am new in web2py and that's the reason i ask for help.
Anyway...thanks again

El miércoles, 30 de julio de 2014 09:32:34 UTC-6, Leonel Câmara escribió:
>
> >  # this is a function in db.py to retrieve firstname and secondname 
> fields value. THIS NOT WORK!!
>
> This doesn't make any sense. How is javascript which runs on the user's 
> browser supposed to have access to functions defined in python that are in 
> your db.py model file in the webserver?  
>   
> If you actually want that, you need a controller and then use ajax to call 
> it and get the result.
>

-- 
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: jquery onchange help

2014-07-30 Thread Leonel Câmara
>  # this is a function in db.py to retrieve firstname and secondname 
fields value. THIS NOT WORK!!

This doesn't make any sense. How is javascript which runs on the user's 
browser supposed to have access to functions defined in python that are in 
your db.py model file in the webserver?  
  
If you actually want that, you need a controller and then use ajax to call 
it and get the result.

-- 
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: jquery onchange help

2014-07-30 Thread ocascante
Hello,

I wrote this into my custom form code :


   jQuery(document).ready(function(){
   jQuery('#documents_card').change(function(){
   var sel_value = $('#documents_card').val();   # this is working ok 
and get the card number selected by user
   var name = call_name(sel_value);# this is a function in 
db.py to retrieve firstname and secondname fields value. THIS NOT WORK!!
   alert(name);});
});


Somebody can help me!! 
Thanks.

El martes, 29 de julio de 2014 09:58:01 UTC-6, ocascante escribió:
>
> Massimo, my tables:
>
> db.define_table('cards',
> Field('card','string',unique=True,required=True),
> Field('firstname','string',required=True),
> Field('secondname','string',required=True),
> 
> db.define_table('documents',
> Field('card'requires=IS_IN_DB(db,db.cards.card)),
> Field('document','string',required=True),
> Field('state','string'),
>
> The form is to include documents.
>
> El martes, 29 de julio de 2014 09:51:07 UTC-6, Massimo Di Pierro escribió:
>>
>> Not sure what the card widget is in your example. Probably you want 
>> onkeyup instead of onchange. Anyway, if you share your model and your js 
>> code we can help more.
>>
>> On Tuesday, 29 July 2014 10:40:54 UTC-5, ocascante wrote:
>>>
>>> Hello,
>>>
>>> I have this custom form:
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Documental System
>>> 
>>> 
>>> 
>>> 
>>> New Records
>>> 
>>> 
>>> {{=form.custom.begin}}
>>> 
>>> Card Number: {{=form.custom.widget.card}}
>>> Document: {{=form.custom.widget.document}}
>>> 
>>> 
>>> State: {{=form.custom.widget.state}}
>>> 
>>> 
>>> Click to submint: {{=form.custom.submit}}
>>> 
>>> {{=form.custom.end}}
>>>
>>> When the user choose a card, i need to read from other table the first 
>>> name, second name of this card, and display that information.
>>> I am trying with jquery onchange but is not working.
>>> 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] Re: Two parallel methods of authenticating users based on Auth class

2014-07-30 Thread Marcin Jaworski
Hi Massimo,
Thanks for your input. 
Yes, they would receive email, since they have got external (out of google 
services) email accounts.
I realized that I should describe shortly my approach.

Most of aplication users will use GaeGoogleLogin. 
There are only few that will use alternative login method.
The minority have their own records in datastore with id, login and 
password. 

How to authenticate the minority?
I have found function in web2py.gluon.tools.Auth called login_user() that 
should log in requested user as can be checked via is_logged_id(). 
I prepared separate login screen (avoiding Google login) getting user input 
namely login and password.
Now If user input match user data I would like use auth.user_login() to get 
'logged in' status.
Suppose that I have empty class ChineseUser in db.py and I am instantiating 
it in default controller like so:

user = ChineseUser()

and I am binding required (by other gluon functions) attributes like so:
user.id = id_taken_from_database
user.email = email_taken_from_database

and I am using auth.user_login(user) to log in the user. 
call of 'if auth.is_logged_in()' confirms the success of logging operation
And within one function all is fine, which means session.auth.user.id 
returns correct id of the user that have been logged in.  

Unfortunately, calling session variables (session.auth.user.id) or 
auth.user.id within other function(s) returns error saying None type(s) 
(session and auth in this case) have no requested attributes (id).

How to provide session and auth (meaning the session and the auth called by 
'my' loggin in method - not the Google LoginService based method) to hold 
their states across functions?

Thanks in advance,
Marcin

On Tuesday, July 29, 2014 5:42:30 PM UTC+2, Massimo Di Pierro wrote:
>
> Even if you use GaeGoogleLogin the auth_user table contains both id and 
> email (as provided by gmail). Now if you switch from GaeGoogleLogin to 
> local authentication and email everybody a link to reset the password they 
> will not need to register again and therefore they will retain the current 
> id. I have not tried this but should work.
>
> For example you can make a script that does:
>
> auth.messages.reset_password = 'You must reset your password. Click on 
> the link %(link)s to reset your password'
> for user in db(db.auth_user).select(): auth.email_reset_password(user)
>
> Now the issue is, if they cannot access GAE for login, would they receive 
> the email?
>
>
> On Tuesday, 29 July 2014 09:01:07 UTC-5, Marcin Jaworski wrote:
>>
>> Hello,
>>
>> I have web2py on GAE and it works fine. Unfortunately, clients from China 
>> cannot access Google ServiceLogin lately. I have declared it in db.py 
>> settings like so: auth.settings.login_form=GaeGoogleAccount() after 
>> importing this method from gluon.contrib.login_methods.gae_google_account. 
>> I need some kind of "fix" or rather some kind of enhanced, alternative 
>> solution enabling users from China to be authenticated via available web2py 
>> Auth class despite the fact Google ServiceLogin is not accessible for them 
>> and most of the remaining users should be logged in via Google 
>> ServiceLogin? The problem (?) is that huge parts of application 
>> functionality id based on calling auth.user.id in controllers and views 
>> after auth tables based on declared login method had been generated. Is 
>> there any painless solution not to give up the auth.user.id construct in 
>> function call, but redefining the reference of auth in my situation? 
>>
>> Thanks in advance,
>> Marcin
>>
>>
>> BI-Lion Analytics
>> mobile: +48 72880
>>
>
-- 
BI-Lion Analytics
mobile: +48 72880

-- 
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: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-07-30 Thread Ivan
It seems this bug is still present in 2.9.5


Il giorno venerdì 24 gennaio 2014 03:19:05 UTC+1, User ha scritto:
>
> Thanks.  Here is the issue in case anyone is interested:
>
> http://code.google.com/p/web2py/issues/detail?id=1395
>
>
> On Wednesday, January 22, 2014 3:39:56 PM UTC-5, Anthony wrote:
>
>> This is a bug, and an issue has been created. Yes, you should be able to 
>> make the change directly in the database.
>>
>> Anthony
>>
>> On Wednesday, January 22, 2014 1:13:30 PM UTC-5, User wrote:
>>>
>>> I also would like a non-null foreign key reference, but like OP 
>>> experienced web2py will not create one (I'm using postgresql).  Why is 
>>> this?  And is there a workaround to make reference fields not null?  Or 
>>> worst case can I add the not null constraint manually in the db without 
>>> breaking anything?
>>>
>>>
>>> On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote:
>>>
 Same problem here!
 The "notnull=True" parameter doesn't append the "NOT NULL" clause for 
 reference fields.
 The IS_IN_DB function activates the check at form-level while the 
 notnull parameter should set the constraint at db-level.



-- 
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] IPN paypal 404 ???

2014-07-30 Thread Ivan Gazzola
When i call /paypal/ipn from a browser is ok, when paypall try to send IPN 
the relay is 404???

x.x.x.x - - [30/Jul/2014:13:09:03 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:10:25 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:13:07 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:14:24 +0200] "GET /paypal/ipn HTTP/1.1" 200 35 
"-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/36.0.1985.125 Safari/537.36"

any advice?
The controller is like this:

def ipn():
verifyurl = "www.paypal.com"
if request.vars.test_ipn != None and request.vars.test_ipn == '1':
verifyurl = "www.sandbox.paypal.com"
stato=""
params=""
if len(request.vars.keys()) > 0:
params = "cmd=_notify-validate&" + urllib.urlencode(parameters)
headers = {"Content-type": "application/x-www-form-urlencoded",
   "Content-Length": "%s" % (len(params))}

stato=None
conn = httplib.HTTPSConnection(verifyurl)
conn.request("POST", "/cgi-bin/webscr", params, headers )
stato = conn.getresponse()


 if stato != "VERIFIED":
#@todo: figure out how to fail
f = open(logfile, "a")
f.write("Message not verified: %s\n" %(stato))
f.write(repr(params) + "\n\n")
f.close()
return None

  if request.vars.payment_status != 'Completed':
 f = open(logfile, "a")
f.write("Ignore pending transaction:\n")
f.write(repr(params) + "\n\n")
f.close()
return None
  . 
 return None

-- 
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: Bootstrap is really killing web2py

2014-07-30 Thread Dragan Matic
Anthony, 

Thanks for the answer, I was aware of that completely. It is just that 
Massimo said that it is trivial to replace BS2 with BS3 yet when I try to 
do it the trivial way and then create a FORM in controller (whether it be 
simple form, sqlform or sqlform.factory) the form looks completely wrong. 
The same is with main menu. 

Now I know that in this case I should create form in HTML using appropriate 
BS3 classes and then use that form in controller but I think you will agree 
that this takes away the ease of use which is one of the main strengths of 
web2py. 

I suppose that was why OP named this thread "Bootstrap is killing web2py". 
I think a lot of web2py users (like myself) are novices in web programming 
and while it may be trivial for versed web programmer to use BS3 with 
web2py it is not the case for the beginners. BS3 is more than a year old 
but I still develop my web apps using BS2 because that is what ships with 
web2py. I don't want to criticize, web2py is an excellent framework but I 
think it needs to ship with BS3, otherwise it will lose a lot of novice 
programmers and I think novice programmers are important because those are 
the future user base of web2py. 

Just my 2c. 

On Wednesday, July 30, 2014 1:12:44 AM UTC+2, Anthony wrote:
>
> On Tuesday, July 29, 2014 12:16:13 PM UTC-4, Dragan Matic wrote:
>>
>> Is there some tutorial how to do it for those of us not so versed in CSS? 
>> If you just replace bootstrap.min.css in static/css the menus and forms do 
>> not work the way they used to in BS2.
>>
>
> Note, in general, you should not expect to simply replace the CSS for one 
> framework with that of another and have it work. The reason is that 
> front-end frameworks require a combination of CSS and specific HTML 
> structure with framework-specific classes. So, the layout must be 
> customized for the framework.
>
> The layout and CSS of the web2py scaffolding app is just intended as a 
> basic template. It is not part of the web2py framework nor coupled to the 
> framework. It is just one layout that you can use if you want. If you want 
> to use a different front end framework or some other template, you should 
> mostly throw out the scaffolding app layout and instead start with an 
> external template. You can then modify your template to turn it into a 
> layout.html view file (look at the scaffolding layout.html for ideas of how 
> to set it up). Check out 
> http://web2py.com/books/default/chapter/29/05/the-views#Page-layout for 
> more details.
>
> 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] Add (customer) number to url

2014-07-30 Thread Eric
Hi,

We need a way to get the customer number into web2py by it's url so we can 
display the corresponding data to the visitor. To keep it easy for the 
visitor this number needs to be visible in every url.

Since the site runs under SSL and we don't want to buy another SSL 
certificate, we're looking for a different solution, so this isn't an 
option:
https://.sub.domain.com

That would be the easy way :)

I was looking at the routers, but I can't figure out how to do something 
like this in an router and have  available in the Python scripts:
https://sub.domain.com//c/f/a?vars=example

Is here anyone with an idea how to create this and have the "" 
accessible in Python? The  is a dynamic value, so zero maintenance 
in the routes would be really, really nice ;)

The number can probably be retrieved from the HTTP_HOST that is available 
in Web2Py, but how to handle the number in a router? I've tried this, but 
that's not working:

# # -*- coding: utf-8 -*-

default_controller = 'default'
default_function = 'index'

routers = dict(
   BASE=dict(default_application='app',
   map_static=True,
   map_hyphen=True)
)

routes_in = (
 # Keep admin working
 ('/admin', '/admin'),
 ('/admin/$anything', '/admin/$anything'),

 # Keep appadmin working
 ('/$app/appadmin', '/$app/appadmin'),
 ('/$app/appadmin/$anything', '/$app/appadmin/$anything'),

 ('/$app/$number/$anything', '/$app/$anything'),

)

routes_out = [(x, y) for (y, x) in routes_in]

Thanks for the input!

-- 
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 do you gracefully terminate a scheduled task

2014-07-30 Thread Niphlod
set the worker status who's processing the task to STOP_TASK.

On Monday, July 28, 2014 10:45:07 PM UTC+2, Stephen Weiss wrote:
>
>
> I'm trying to find a way in a scheduled task to terminate itself 
> gracefully and have it set the status to FAILED.
>
> Say for example, a scheduled task is executing and for some reason doesn't 
> find a required record in a table or what not and thus shouldn't continue.
>
> How does one go about stopping the task from continuing and smoothly clean 
> up after itself?
>
> 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] Re: Bootstrap is really killing web2py

2014-07-30 Thread Gael Princivalle
Hi Anthony.

I think that web2py grids are really powerful and useful. If web2py grids 
are not fully compatible with BS3 for me it's a problem. As websites must 
be generally designed now first for mobile devices, I think that web2py 
front end as to be done with BS3, and responsive.

Il giorno mercoledì 30 luglio 2014 01:12:44 UTC+2, Anthony ha scritto:
>
> On Tuesday, July 29, 2014 12:16:13 PM UTC-4, Dragan Matic wrote:
>>
>> Is there some tutorial how to do it for those of us not so versed in CSS? 
>> If you just replace bootstrap.min.css in static/css the menus and forms do 
>> not work the way they used to in BS2.
>>
>
> Note, in general, you should not expect to simply replace the CSS for one 
> framework with that of another and have it work. The reason is that 
> front-end frameworks require a combination of CSS and specific HTML 
> structure with framework-specific classes. So, the layout must be 
> customized for the framework.
>
> The layout and CSS of the web2py scaffolding app is just intended as a 
> basic template. It is not part of the web2py framework nor coupled to the 
> framework. It is just one layout that you can use if you want. If you want 
> to use a different front end framework or some other template, you should 
> mostly throw out the scaffolding app layout and instead start with an 
> external template. You can then modify your template to turn it into a 
> layout.html view file (look at the scaffolding layout.html for ideas of how 
> to set it up). Check out 
> http://web2py.com/books/default/chapter/29/05/the-views#Page-layout for 
> more details.
>
> 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.


Re: [web2py] grid problem

2014-07-30 Thread Manuele Pesenti
Il 30/07/14 09:30, ceriox ha scritto:
> thanks Javier!
> but can you explain "must be a function"?
> i use this code in other functions (for other tables) and it work fine!
> how i need to change it?
Dear ceriox,
I think here lie the problem:
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2602-L2605

look your self, if selectable is not callable its value is passed to
enumerate function...

you can use selectable=lambda _: True instead

hope it could help
Cheers

Manuele

-- 
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] grid problem

2014-07-30 Thread ceriox
thanks Javier!
but can you explain "must be a function"?
i use this code in other functions (for other tables) and it work fine!
how i need to change it?



Il giorno martedì 29 luglio 2014 17:51:47 UTC+2, Massimo Di Pierro ha 
scritto:
>
> good catch!
>
> On Tuesday, 29 July 2014 10:39:15 UTC-5, Javier Pepe wrote:
>>
>> form = SQLFORM.grid(db.t_proposte,
>>searchable=True,
>>   deletable=True,
>>details=False,
>> *   selectable**=True,** <- must be a function*
>>csv=True,
>>   user_signature=False)  # change to True in 
>> production
>>
>>
>> On Tue, Jul 29, 2014 at 12:05 PM, ceriox > 
>> wrote:
>>
>>> hi all,
>>> i have a table with some fields (two of the type boolean)
>>>
>>> if i use 
>>> form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)
>>>
>>>
>>> all work fine!
>>>
>>> but if i use:
>>> form = SQLFORM.grid(db.t_proposte,
>>>searchable=True,
>>>   deletable=True,
>>>details=False,
>>>selectable=True,
>>>csv=True,
>>>   user_signature=False)  # change to True in 
>>> production
>>>
>>>
>>> i have the error:
>>>  'bool' object is not iterable
>>> i'm doing something wrong?
>>> (i don't have any type of requires on the fields)
>>>
>>>  -- 
>>> 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+un...@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.