[web2py] Re: Specify default values for custom form

2018-03-19 Thread Dave S


On Monday, March 19, 2018 at 10:30:04 PM UTC-7, Dave S wrote:
>
>
>
> On Monday, March 19, 2018 at 7:13:28 PM UTC-7, F.C. wrote:
>>
>> I use a custom form within my application to capture comments for 
>> specific records. The user clicks on a record and is directed to another 
>> view where they can capture the comments.
>>
>> Is it possible to define a custom value for a specific custom form field, 
>> and then hide that field so that the user does not see it. The reason I 
>> need to do that is that I want to save the comment to the associated record 
>> against whom the comments should be recorded.
>>
>> I hope this provides enough guidance on what I am looking for.
>>
>>
> I think there's help in the book:
>
>
>>- writable declares whether a field is writable in forms.
>>- readable declares whether a field is readable in forms. If a field 
>>is neither readable nor writable, it will not be displayed in create and 
>>update forms.
>>
>> found at
>  http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor
> >
>
> (warning: the online copy of the book still refers to "CRUD" as new; it is 
> now deprecated)
>
> Another reference that might be useful is
>  http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
> >
>  
>

Also, you can turn the readable and writable setting on or off on the fly:



/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: Specify default values for custom form

2018-03-19 Thread Dave S


On Monday, March 19, 2018 at 7:13:28 PM UTC-7, F.C. wrote:
>
> I use a custom form within my application to capture comments for specific 
> records. The user clicks on a record and is directed to another view where 
> they can capture the comments.
>
> Is it possible to define a custom value for a specific custom form field, 
> and then hide that field so that the user does not see it. The reason I 
> need to do that is that I want to save the comment to the associated record 
> against whom the comments should be recorded.
>
> I hope this provides enough guidance on what I am looking for.
>
>
I think there's help in the book:


>- writable declares whether a field is writable in forms.
>- readable declares whether a field is readable in forms. If a field 
>is neither readable nor writable, it will not be displayed in create and 
>update forms.
>
> found at


(warning: the online copy of the book still refers to "CRUD" as new; it is 
now deprecated)

Another reference that might be useful is

 
/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] Specify default values for custom form

2018-03-19 Thread F.C.
I use a custom form within my application to capture comments for specific 
records. The user clicks on a record and is directed to another view where 
they can capture the comments.

Is it possible to define a custom value for a specific custom form field, 
and then hide that field so that the user does not see it. The reason I 
need to do that is that I want to save the comment to the associated record 
against whom the comments should be recorded.

I hope this provides enough guidance on what I am looking for.


-- 
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: OAUTH2.0 help

2018-03-19 Thread Dave S


On Monday, March 19, 2018 at 3:58:00 PM UTC-7, Greenpoise wrote:
>
> I feel like I am having a monologue here geez.. ANyways, I sort of figured 
> this one out by going to the Index following the authentication and 
> redirecting to the menu. Eventually the redirect should only work if both 
> Access token and refresh token are received. Anyways, now (hopefully 
> someone will help me on this one), I receive json garble when I try to pull 
> customers data. How do I parse this all nicely in a table form???
>
>
> thanks
>
>

Um, json.loads() ?


I'd have been happy to help you more, but I've already shown how much I 
know, and I'm not sure your usecase is typical OAUTH2 (see my diagram in 
the earlier post).

I think Massimo and niphlod can tell you more about OAUTH2, but with their 
less-regular participation here, you may not get a quick answer from them.  
The other gurus may not have done as much with OAUTH2, which could be why 
they aren't tossing anything in here.

/dps


>
>
> On Thursday, March 15, 2018 at 2:38:08 PM UTC-7, greenpoise wrote:
>>
>> I need a push on this one. Now that I know how to properly Authenticate, 
>> also retrieve the code and the access_token which in turn is the same one 
>> used to refresh_token, how can I put everything together? I need to check 
>> whether the token is expired ( I am thinking a session) and if it is, 
>> authentication needs to happen again. So, all in all I have these pieces of 
>> code (they all work as far as I know):
>>
>> *Authenticate:*
>>
>> params = {"response_type": "code",
>>   "client_id": CLIENT_ID,
>>   "scope": "employee:customers_read"}
>> url = "https://jimbaroo.com/oauth/authorize.php?; + 
>> urllib.urlencode(params)
>> return dict(url=url)Enter code here...
>>
>> *Get Access_token:*
>> code = current.request.vars.code
>>
>> 
>> payload = {"client_id":CLIENT_ID,
>>  "client_secret":CLIENT_SECRET,
>>  "code":code,
>>  "grant_type":"authorization_code"}
>> url="https://jimbaroo.com/oauth/access_token.php;
>> r = requests.request("POST",url, data=payload)
>>  
>> token = r.json()
>> access_token = token['access_token']
>> current.session.token = access_token
>>
>> *Refresh:*
>> refresh_token_request = requests.get('
>> https://jimbaroo.com/oauth/access_token.php', data=payload).json()   
>>
>> payload = {
>> "refresh_token":current.session.token,
>> "client_secret":CLIENT_SECRET,
>> "client_id":CLIENT_ID,
>> "grant_type":"refresh_token"
>>}
>>
>> thanks appreciated
>>
>>
>>
>> On Wednesday, March 7, 2018 at 6:04:15 PM UTC-8, greenpoise wrote:
>>>
>>> Hi Dave, thanks for the input. I was able to post the temporary code and 
>>> get an authentication code. I will post tomorrow my updated code. I feel i 
>>> am close. 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: web2py api call from angular 4

2018-03-19 Thread Dave S


On Monday, January 22, 2018 at 4:57:34 AM UTC-8, yogeshwar khalkar wrote:
>
> Please help me,
>
>
> When I am try to login from angular 4 app to web2py rest api browser shows 
> error like
>
> OPTIONS http://127.0.0.1:8000/csautomation/user/login 405 (METHOD NOT 
> ALLOWED)
>
> *AND*
>
> Failed to load http://127.0.0.1:8000/csautomation/user/login: Response to 
> preflight request doesn't pass access control check: No 
> 'Access-Control-Allow-Origin' header is present on the requested resource. 
> Origin 'http://localhost:4200' is therefore not allowed access. The 
> response had HTTP status code 405.
>

It finally occurred to me that you might be needing a CORS header.  See 
 
for some discussion.
 
/dps


> *here is my angular code*
>
> login(user): Promise{
>   let url: string = `${this.BASE_URL}/login`;
>   return this.http.post(url,user).toPromise();
>   }
>
> *here my web2py api*
>
> @request.restful()
> def login():
> def POST(username, password):
> user = auth.login_bare(username, password)
> if user:
> return json(user.id)
> return user
> return locals()
>
>
> Thanks for any 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: OAUTH2.0 help

2018-03-19 Thread Greenpoise
I feel like I am having a monologue here geez.. ANyways, I sort of figured 
this one out by going to the Index following the authentication and 
redirecting to the menu. Eventually the redirect should only work if both 
Access token and refresh token are received. Anyways, now (hopefully 
someone will help me on this one), I receive json garble when I try to pull 
customers data. How do I parse this all nicely in a table form???


thanks




On Thursday, March 15, 2018 at 2:38:08 PM UTC-7, greenpoise wrote:
>
> I need a push on this one. Now that I know how to properly Authenticate, 
> also retrieve the code and the access_token which in turn is the same one 
> used to refresh_token, how can I put everything together? I need to check 
> whether the token is expired ( I am thinking a session) and if it is, 
> authentication needs to happen again. So, all in all I have these pieces of 
> code (they all work as far as I know):
>
> *Authenticate:*
>
> params = {"response_type": "code",
>   "client_id": CLIENT_ID,
>   "scope": "employee:customers_read"}
> url = "https://jimbaroo.com/oauth/authorize.php?; + 
> urllib.urlencode(params)
> return dict(url=url)Enter code here...
>
> *Get Access_token:*
> code = current.request.vars.code
>
> 
> payload = {"client_id":CLIENT_ID,
>  "client_secret":CLIENT_SECRET,
>  "code":code,
>  "grant_type":"authorization_code"}
> url="https://jimbaroo.com/oauth/access_token.php;
> r = requests.request("POST",url, data=payload)
>  
> token = r.json()
> access_token = token['access_token']
> current.session.token = access_token
>
> *Refresh:*
> refresh_token_request = requests.get('
> https://jimbaroo.com/oauth/access_token.php', data=payload).json()   
>
> payload = {
> "refresh_token":current.session.token,
> "client_secret":CLIENT_SECRET,
> "client_id":CLIENT_ID,
> "grant_type":"refresh_token"
>}
>
> thanks appreciated
>
>
>
> On Wednesday, March 7, 2018 at 6:04:15 PM UTC-8, greenpoise wrote:
>>
>> Hi Dave, thanks for the input. I was able to post the temporary code and 
>> get an authentication code. I will post tomorrow my updated code. I feel i 
>> am close. 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] I was thinking about python2 clock

2018-03-19 Thread Ty oc
There have been new frameworks comming for 3.5> and I just found 
https://pythonclock.org/ so I wonder, if I can start migrating my web2py 
apps right now to the next version of web2py?

It is because I have a large rewrite and would love to use 3.5 or 3.6 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: SyntaxError: Adapter not found for gae

2018-03-19 Thread Tommi Lahtonen
This is still broken. admin-interface does not work with google app engine. 
appadmin works just fine.


On Wednesday, November 22, 2017 at 3:22:46 PM UTC+2, Tommi Lahtonen wrote:
>
> Latest web2py (2.16.1 ) and 
> latest Google App Engine  launcher (1.9.63) do not work together on Windows 
> 7. Welcome application works but admin interface does not. Trying to open 
> Admin will give you this error:
>
> INFO 2017-11-22 15:15:22,841 module.py:825] default: "GET /admin 
> HTTP/1.1" 500 707
> WARNING  2017-11-22 13:15:25,806 sandbox.py:1082] The module _ctypes is 
> whitelisted for local dev only. If your application relies on _ctypes, it 
> is likely that it will not function properly in production.
>
> ERROR2017-11-22 13:15:26,867 restricted.py:174] Traceback (most recent 
> call last):
>
>   File "C:\MyTemp\web-sovellukset\web2py_2017\web2py\gluon\restricted.py", 
> line 219, in restricted
>
> exec(ccode, environment)
>
>   File 
> "C:\MyTemp\web-sovellukset\web2py_2017\web2py\applications\admin\models\access.py",
>  
> line 16, in 
>
> session_db = DAL('gae')
>
>   File 
> "C:\MyTemp\web-sovellukset\web2py_2017\web2py\gluon\packages\dal\pydal\base.py",
>  
> line 169, in __call__
>
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>
>   File 
> "C:\MyTemp\web-sovellukset\web2py_2017\web2py\gluon\packages\dal\pydal\base.py",
>  
> line 453, in __init__
>
> adapter = adapters.get_for(self._dbname)
>
>   File 
> "C:\MyTemp\web-sovellukset\web2py_2017\web2py\gluon\packages\dal\pydal\adapters\__init__.py",
>  
> line 20, in get_for
>
> 'Adapter not found for %s' % uri
>
> SyntaxError: Adapter not found for gae
>
>
>
> INFO 2017-11-22 13:15:26,867 gaehandler.py:75]  Request: 
> 184.00ms/184.05ms (real time/cpu time)
>
> INFO 2017-11-22 15:15:26,871 module.py:825] default: "GET /admin/ 
> HTTP/1.1" 500 707
>
>

-- 
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: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-19 Thread 'Awe' via web2py-users
OK, issue filed on: 2018-03-14
Andreas

Am Montag, 12. März 2018 09:14:22 UTC+1 schrieb Awe:
>
> Hello Leonel,
> thanks for analyzing. Will open issue today.
> Andreas
>
> Am Freitag, 9. März 2018 16:55:12 UTC+1 schrieb Leonel Câmara:
>>
>> This is definitely a bug, the solution doesn't seem easy, The problem is 
>> that it should not apply the common filters on the alias used on the left 
>> join again as they are already applied on the left join ON query itself. 
>>   
>> Please file an issue here:
>> https://github.com/web2py/pydal/issues
>>
>

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