[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread Scott Hunter
Did you try removing the quotes around the address?

- Scott



On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:
>
> I've created an emailing form in my application but have substituted where 
> the email goes with a reference that contains the email, the problem is 
> that now the email is not being sent unless i write a proper explicit email 
> address. Whats the difference between writing an explicit email address & 
> using a variable that supposedly contains the email? I have to use the 
> referencing variable as I currently am because different registered users 
> get to log in & send emails, its not just one user. How can I solve this 
> problem???
>
> *CODE*
> def contact_us():
> details=db.hotel_profile(request.args(0, cast=int))
> form = SQLFORM.factory(
> Field('name', requires=IS_NOT_EMPTY()),
> Field('cell_number', requires=IS_NOT_EMPTY()),
> Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
> IS_NOT_EMPTY() ]),
> Field('subject', requires=IS_NOT_EMPTY()),
> Field('message', requires=IS_NOT_EMPTY(), type='text')
> )
> if form.process().accepted:
> *mail.send(to='details.email_address', *
>   #subject='contact request from %(your_name)s %(email)s' 
>  % form.vars,
>   subject=form.vars.subject,
>   message = '%(message)s \nName: %(name)s \nEmail 
> Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
> response.flash = T('Thank you, your form was submitted')
> #redirect(URL('index'))
> return dict(form=form)
>
>
> Regards;
>
> Mostwanted
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/83a9d596-48b5-49c5-b0fe-36f93ba792a1%40googlegroups.com.


[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread mostwanted
I did try  it without the quotes & it still gave me an error!

On Sunday, February 23, 2020 at 2:59:04 PM UTC+2, Scott Hunter wrote:
>
> Did you try removing the quotes around the address?
>
> - Scott
>
>
>
> On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:
>>
>> I've created an emailing form in my application but have substituted 
>> where the email goes with a reference that contains the email, the problem 
>> is that now the email is not being sent unless i write a proper explicit 
>> email address. Whats the difference between writing an explicit email 
>> address & using a variable that supposedly contains the email? I have to 
>> use the referencing variable as I currently am because different registered 
>> users get to log in & send emails, its not just one user. How can I solve 
>> this problem???
>>
>> *CODE*
>> def contact_us():
>> details=db.hotel_profile(request.args(0, cast=int))
>> form = SQLFORM.factory(
>> Field('name', requires=IS_NOT_EMPTY()),
>> Field('cell_number', requires=IS_NOT_EMPTY()),
>> Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
>> IS_NOT_EMPTY() ]),
>> Field('subject', requires=IS_NOT_EMPTY()),
>> Field('message', requires=IS_NOT_EMPTY(), type='text')
>> )
>> if form.process().accepted:
>> *mail.send(to='details.email_address', *
>>   #subject='contact request from %(your_name)s 
>> %(email)s'  % form.vars,
>>   subject=form.vars.subject,
>>   message = '%(message)s \nName: %(name)s \nEmail 
>> Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
>> response.flash = T('Thank you, your form was submitted')
>> #redirect(URL('index'))
>> return dict(form=form)
>>
>>
>> Regards;
>>
>> Mostwanted
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f4b484cf-3e8c-4714-b8d7-a54a2038a714%40googlegroups.com.


[web2py] Re: p4web auth issues

2020-02-23 Thread Ruslan Gareev
Hi! Looks like no import of auth

воскресенье, 23 февраля 2020 г., 7:28:10 UTC+5 пользователь Maurice Waka 
написал:
>
> Using this code,
>
> File "apps/_scaffolds/controllers.py", line 82, in index 
> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' Thank you for 
> signing in with us. Blah blah blah.', author=auth.user_id, 
> created_by=auth.user_id, modified_by=auth.user_id) 
>
>
> I get an error:
>
>
> NameError: name 'auth_user' is not defined
>
> I also tried:
>
>
> Auth.first_name;
> auth.first_name;
> auth.user.first_name
>
>
>
> and the errors are the same
>
>
> Please help here.
>
>
> Regards
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1df09c56-a21e-4bc7-8c54-f38b73447939%40googlegroups.com.


[web2py] Re: p4web auth issues

2020-02-23 Thread Maurice Waka
Hi
I have this with the same error:

from .common import db, session, T, cache, auth, logger, authenticated, 
unauthenticated
from py4web.utils.auth import Auth


On Sunday, February 23, 2020 at 4:38:25 PM UTC+3, Ruslan Gareev wrote:
>
> Hi! Looks like no import of auth
>
> воскресенье, 23 февраля 2020 г., 7:28:10 UTC+5 пользователь Maurice Waka 
> написал:
>>
>> Using this code,
>>
>> File "apps/_scaffolds/controllers.py", line 82, in index 
>> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' Thank you for 
>> signing in with us. Blah blah blah.', author=auth.user_id, 
>> created_by=auth.user_id, modified_by=auth.user_id) 
>>
>>
>> I get an error:
>>
>>
>> NameError: name 'auth_user' is not defined
>>
>> I also tried:
>>
>>
>> Auth.first_name;
>> auth.first_name;
>> auth.user.first_name
>>
>>
>>
>> and the errors are the same
>>
>>
>> Please help here.
>>
>>
>> Regards
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cf945769-fa72-4293-93f3-7eb4b2a66f59%40googlegroups.com.


[web2py] Re: p4web auth issues

2020-02-23 Thread Val K
Show your code, please

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/48d6789e-e2c0-4e74-8654-3650cded2cd2%40googlegroups.com.


[web2py] Re: p4web auth issues

2020-02-23 Thread Maurice Waka

import os
import datetime as dt
from datetime import datetime, timedelta, date 
from .common import db, session, T, cache, auth, logger, authenticated, 
unauthenticated
from py4web import action, request, DAL, Field, Session, Cache, user_in, 
abort, redirect, URL, Field
from py4web.utils.auth import Auth
from py4web import action, request, abort, redirect, URL, Field
from py4web.utils.form import Form, FormStyleBulma
from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET, 
IS_IN_DB, IS_EMAIL, IS_MATCH
from yatl.helpers import INPUT, H1, HTML, BODY, A
from pydal.validators import *

db.define_table('answers',
Field('author', 'reference auth_user', 
default=auth.user_id, readable=False, writable=False),
Field('userId','reference 
auth_user',unique=True,readable=False,writable=False),
Field('quest', 'text', requires=IS_NOT_EMPTY(),),
auth.signature
)
db.define_table('posts',
Field('author', 'reference auth_user', 
default=auth.user_id, writable=False, readable=False),
Field("message", 'text', requires=IS_NOT_EMPTY(), 
notnull=False),
auth.signature
)

@authenticated()
def index():
codes = []
del codes[:]
r = []
yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
db(db.answers.modified_on < yesterday).delete()
"""Avoid an empty table"""
user = db(db.posts.author== auth.user_id).select(db.posts.id, 
db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
if user.author if user else None == auth.user_id:
pass
else:
db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' Thank 
you for signing in with us. Blah blah blah.', author=auth.user_id, 
created_by=auth.user_id, modified_by=auth.user_id)
db.commit()
On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:
>
> Show your code, please

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c8e0ba24-bb0d-4329-a1ad-d183079dc55f%40googlegroups.com.


[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread Scott Hunter
What error did it give you?  Are you sure `details.email_address` is 
defined?

On Sunday, February 23, 2020 at 8:13:07 AM UTC-5, mostwanted wrote:
>
> I did try  it without the quotes & it still gave me an error!
>
> On Sunday, February 23, 2020 at 2:59:04 PM UTC+2, Scott Hunter wrote:
>>
>> Did you try removing the quotes around the address?
>>
>> - Scott
>>
>>
>>
>> On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:
>>>
>>> I've created an emailing form in my application but have substituted 
>>> where the email goes with a reference that contains the email, the problem 
>>> is that now the email is not being sent unless i write a proper explicit 
>>> email address. Whats the difference between writing an explicit email 
>>> address & using a variable that supposedly contains the email? I have to 
>>> use the referencing variable as I currently am because different registered 
>>> users get to log in & send emails, its not just one user. How can I solve 
>>> this problem???
>>>
>>> *CODE*
>>> def contact_us():
>>> details=db.hotel_profile(request.args(0, cast=int))
>>> form = SQLFORM.factory(
>>> Field('name', requires=IS_NOT_EMPTY()),
>>> Field('cell_number', requires=IS_NOT_EMPTY()),
>>> Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
>>> IS_NOT_EMPTY() ]),
>>> Field('subject', requires=IS_NOT_EMPTY()),
>>> Field('message', requires=IS_NOT_EMPTY(), type='text')
>>> )
>>> if form.process().accepted:
>>> *mail.send(to='details.email_address', *
>>>   #subject='contact request from %(your_name)s 
>>> %(email)s'  % form.vars,
>>>   subject=form.vars.subject,
>>>   message = '%(message)s \nName: %(name)s \nEmail 
>>> Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
>>> response.flash = T('Thank you, your form was submitted')
>>> #redirect(URL('index'))
>>> return dict(form=form)
>>>
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/50d062b2-974d-4da5-b92f-581128489088%40googlegroups.com.


[web2py] LOAD in py4web

2020-02-23 Thread RHC
HI,

I am beginning to experiment with py4web, I like the sound of it and I am 
looking to convert a web2py project to py4web to see how they compare.

It appears that the LOAD (helper?) that was available in web2py templates 
is not available in py4web. I was using this to populate part of a web 
page, I liked the way you had the option to use LOAD to call a separate URL 
(within the same app) and insert the result into your page before returning 
the page to the client.

What is the reason for the absence of LOAD in py4web? is there a 
recommended alternative method of achieving the same effect? I have used a 
mixture of ajax=True and ajax=False options for this feature.

Thanks,

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b2481e63-3a6f-4206-b1ca-7adc62487fa9%40googlegroups.com.


[web2py] web2py upgrade from 2.16.1

2020-02-23 Thread Andrea Fae'
I 'm using web2py 2.16.1 stable on my computer and I used it with python 
version 2.7.
I programmed some sites with this RAD system.
So I want to upgrade to the latest 2.18.5 stable and Python 3. What can I 
do to do it?
What could be the implications on my projects made with 2.16 ant python 2?

If all works it's possible to change in the production environment on 
pyrhonanywhere the same? How?
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e9e7b09c-e421-4c07-aca9-e29f5db0b018%40googlegroups.com.


[web2py] py4web URL helper documentation missing?

2020-02-23 Thread RHC
HI,

Looking at the py4web documentation at 
http://py4web.com/_documentation/static/index.html#chapter-08 I see the 
following where I expected to find details of the URL helper.

URL

The URL helper is documented in [[Chapter 4 URL ../04#URL]]

I go to Chapter 4: 
http://py4web.com/_documentation/static/index.html#chapter-04


but the documentation isn't in there either. I needed to look it up as args 
is reported to be an unexpected keyword (web2py used args judging by some 
of my old code, but py4web uses vars instead it seems by looking at the 
py4web source code).


Regards,


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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f1bd171c-5825-459e-8fbf-6c484bf40858%40googlegroups.com.


[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread mostwanted
I am sure details.email_address is defined, I double checked.

I redefined my code & added the highlighted lines,  now everytime i send 
the email response flashes an error message. How can I get it to tell me 
the exact error??

def contact_us():
details=db.hotel_profile(request.args(0, cast=int))
form = SQLFORM.factory(
Field('name', requires=IS_NOT_EMPTY()),
Field('cell_number', requires=IS_NOT_EMPTY()),
Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
IS_NOT_EMPTY() ]),
Field('subject', requires=IS_NOT_EMPTY()),
Field('message', requires=IS_NOT_EMPTY(), type='text')
)

*sent = False*
if form.process().accepted:
*sent = mail.send(to='details.email_address', *
  #subject='contact request from %(your_name)s %(email)s' 
 % form.vars,
  subject=form.vars.subject,
  message = '%(message)s \nName: %(name)s \nEmail Address: 
%(email)s \nCell Number: %(cell_number)s' % form.vars)

response.flash = T('Thank you, your form was submitted')

*if not sent:*
*response.flash = 'Error sending message, please use email.'   
 *
return dict(form=form)

Regards;


On Sunday, February 23, 2020 at 8:03:04 PM UTC+2, Scott Hunter wrote:
>
> What error did it give you?  Are you sure `details.email_address` is 
> defined?
>
> On Sunday, February 23, 2020 at 8:13:07 AM UTC-5, mostwanted wrote:
>>
>> I did try  it without the quotes & it still gave me an error!
>>
>> On Sunday, February 23, 2020 at 2:59:04 PM UTC+2, Scott Hunter wrote:
>>>
>>> Did you try removing the quotes around the address?
>>>
>>> - Scott
>>>
>>>
>>>
>>> On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:

 I've created an emailing form in my application but have substituted 
 where the email goes with a reference that contains the email, the problem 
 is that now the email is not being sent unless i write a proper explicit 
 email address. Whats the difference between writing an explicit email 
 address & using a variable that supposedly contains the email? I have to 
 use the referencing variable as I currently am because different 
 registered 
 users get to log in & send emails, its not just one user. How can I solve 
 this problem???

 *CODE*
 def contact_us():
 details=db.hotel_profile(request.args(0, cast=int))
 form = SQLFORM.factory(
 Field('name', requires=IS_NOT_EMPTY()),
 Field('cell_number', requires=IS_NOT_EMPTY()),
 Field('email', requires =[ IS_EMAIL(error_message='invalid email!'
 ), IS_NOT_EMPTY() ]),
 Field('subject', requires=IS_NOT_EMPTY()),
 Field('message', requires=IS_NOT_EMPTY(), type='text')
 )
 if form.process().accepted:
 *mail.send(to='details.email_address', *
   #subject='contact request from %(your_name)s 
 %(email)s'  % form.vars,
   subject=form.vars.subject,
   message = '%(message)s \nName: %(name)s \nEmail 
 Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
 response.flash = T('Thank you, your form was submitted')
 #redirect(URL('index'))
 return dict(form=form)


 Regards;

 Mostwanted

>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d76e2a08-a44b-4328-b1a1-c1ba13af53a1%40googlegroups.com.


[web2py] PY4WEB request.vars error

2020-02-23 Thread Maurice Waka
New issue with py4web.

Whats the new code for request.vars??

I get this error:


Traceback (most recent call last):
 File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 
1397, in __getattr__
 var = self.environ['bottle.request.ext.%s'%name]
KeyError: 'bottle.request.ext.vars'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/home/maurice/py4web/py4web/core.py", line 551, in wrapper
 ret = func(*func_args, **func_kwargs)
 File "/home/maurice/py4web/py4web/core.py", line 512, in wrapper
 ret = func(*args, **kwargs)
 File "apps/_scaffolds/controllers.py", line 86, in index
 if request.vars:
 File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 
1400, in __getattr__
 raise AttributeError('Attribute %r not defined.' % name)
AttributeError: Attribute 'vars' not defined.


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1bb010ad-fb3a-41bb-ad02-105d4bdce51d%40googlegroups.com.


[web2py] Re: p4web auth issues

2020-02-23 Thread Val K
`auth` in py4web is no the same as in web2py
to get user-record you should
...
def index():
user = auth.get_user()



On Sunday, February 23, 2020 at 8:47:46 PM UTC+3, Maurice Waka wrote:
>
>
> import os
> import datetime as dt
> from datetime import datetime, timedelta, date 
> from .common import db, session, T, cache, auth, logger, authenticated, 
> unauthenticated
> from py4web import action, request, DAL, Field, Session, Cache, user_in, 
> abort, redirect, URL, Field
> from py4web.utils.auth import Auth
> from py4web import action, request, abort, redirect, URL, Field
> from py4web.utils.form import Form, FormStyleBulma
> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
> from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET, 
> IS_IN_DB, IS_EMAIL, IS_MATCH
> from yatl.helpers import INPUT, H1, HTML, BODY, A
> from pydal.validators import *
>
> db.define_table('answers',
> Field('author', 'reference auth_user', 
> default=auth.user_id, readable=False, writable=False),
> Field('userId','reference 
> auth_user',unique=True,readable=False,writable=False),
> Field('quest', 'text', requires=IS_NOT_EMPTY(),),
> auth.signature
> )
> db.define_table('posts',
> Field('author', 'reference auth_user', 
> default=auth.user_id, writable=False, readable=False),
> Field("message", 'text', requires=IS_NOT_EMPTY(), 
> notnull=False),
> auth.signature
> )
>
> @authenticated()
> def index():
> codes = []
> del codes[:]
> r = []
> yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
> db(db.answers.modified_on < yesterday).delete()
> """Avoid an empty table"""
> user = db(db.posts.author== auth.user_id).select(db.posts.id, 
> db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
> if user.author if user else None == auth.user_id:
> pass
> else:
> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' 
> Thank you for signing in with us. Blah blah blah.', author=auth.user_id, 
> created_by=auth.user_id, modified_by=auth.user_id)
> db.commit()
> On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:
>>
>> Show your code, please
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/19c4dd56-ffc3-40bb-9067-e5525ffafcf7%40googlegroups.com.


[web2py] Re: PY4WEB request.vars error

2020-02-23 Thread Val K
p4web `request` is bottle request, see 
https://bottlepy.org/docs/dev/api.html#bottle.Request 

On Monday, February 24, 2020 at 12:30:29 AM UTC+3, Maurice Waka wrote:
>
> New issue with py4web.
>
> Whats the new code for request.vars??
>
> I get this error:
>
>
> Traceback (most recent call last):
>  File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 
> 1397, in __getattr__
>  var = self.environ['bottle.request.ext.%s'%name]
> KeyError: 'bottle.request.ext.vars'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>  File "/home/maurice/py4web/py4web/core.py", line 551, in wrapper
>  ret = func(*func_args, **func_kwargs)
>  File "/home/maurice/py4web/py4web/core.py", line 512, in wrapper
>  ret = func(*args, **kwargs)
>  File "apps/_scaffolds/controllers.py", line 86, in index
>  if request.vars:
>  File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 
> 1400, in __getattr__
>  raise AttributeError('Attribute %r not defined.' % name)
> AttributeError: Attribute 'vars' not defined.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/25c3bff2-88e4-441d-8d61-557dde2f832d%40googlegroups.com.


[web2py] Re: py4web URL helper documentation missing?

2020-02-23 Thread Val K
Yes, there is no keyword argument `args`, you can just:
args = [...]
URL('foo_controller', *args, vars = dict(...) ) 



On Sunday, February 23, 2020 at 11:37:08 PM UTC+3, RHC wrote:
>
> HI,
>
> Looking at the py4web documentation at 
> http://py4web.com/_documentation/static/index.html#chapter-08 I see the 
> following where I expected to find details of the URL helper.
>
> URL
>
> The URL helper is documented in [[Chapter 4 URL ../04#URL]]
>
> I go to Chapter 4: 
> http://py4web.com/_documentation/static/index.html#chapter-04
>
>
> but the documentation isn't in there either. I needed to look it up as 
> args is reported to be an unexpected keyword (web2py used args judging by 
> some of my old code, but py4web uses vars instead it seems by looking at 
> the py4web source code).
>
>
> Regards,
>
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9266ca5c-2ae7-4161-a901-fb6635e88039%40googlegroups.com.


[web2py] Re: LOAD in py4web

2020-02-23 Thread Val K
for server side you can
@action("foo")
@action.uses("foo.html")
def foo():
return dict(...)

@action("bar")
@action.uses("bar.html")
def bar():
return dict(foo_content = foo())

# bar.html
[[=XML(foo_content)]]


for the client side, I suppose, you have to do it by yourself using pure js 
or some lib (JQuery, axios, Vue.js ... )



On Sunday, February 23, 2020 at 9:18:51 PM UTC+3, RHC wrote:
>
> HI,
>
> I am beginning to experiment with py4web, I like the sound of it and I am 
> looking to convert a web2py project to py4web to see how they compare.
>
> It appears that the LOAD (helper?) that was available in web2py templates 
> is not available in py4web. I was using this to populate part of a web 
> page, I liked the way you had the option to use LOAD to call a separate URL 
> (within the same app) and insert the result into your page before returning 
> the page to the client.
>
> What is the reason for the absence of LOAD in py4web? is there a 
> recommended alternative method of achieving the same effect? I have used a 
> mixture of ajax=True and ajax=False options for this feature.
>
> Thanks,
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/47d4dc6b-caa6-439a-bd1f-4913af352d63%40googlegroups.com.


Re: [web2py] Re: LOAD in py4web

2020-02-23 Thread Carlos Cesar Caballero
Or maybe using something like https://github.com/MoOx/pjax

El dom., 23 de febrero de 2020 7:02 p. m., Val K 
escribió:

> for server side you can
> @action("foo")
> @action.uses("foo.html")
> def foo():
> return dict(...)
>
> @action("bar")
> @action.uses("bar.html")
> def bar():
> return dict(foo_content = foo())
>
> # bar.html
> [[=XML(foo_content)]]
>
>
> for the client side, I suppose, you have to do it by yourself using pure
> js or some lib (JQuery, axios, Vue.js ... )
>
>
>
> On Sunday, February 23, 2020 at 9:18:51 PM UTC+3, RHC wrote:
>>
>> HI,
>>
>> I am beginning to experiment with py4web, I like the sound of it and I am
>> looking to convert a web2py project to py4web to see how they compare.
>>
>> It appears that the LOAD (helper?) that was available in web2py templates
>> is not available in py4web. I was using this to populate part of a web
>> page, I liked the way you had the option to use LOAD to call a separate URL
>> (within the same app) and insert the result into your page before returning
>> the page to the client.
>>
>> What is the reason for the absence of LOAD in py4web? is there a
>> recommended alternative method of achieving the same effect? I have used a
>> mixture of ajax=True and ajax=False options for this feature.
>>
>> Thanks,
>>
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/47d4dc6b-caa6-439a-bd1f-4913af352d63%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAKHqNp4%3DyOj-ZRLD0W7z0wZMS%2BTqtmXHEzVNQ-Nnukcg4CsW4A%40mail.gmail.com.


[web2py] Re: Error importing csv file in python3.6

2020-02-23 Thread Dan Carroll
It Works! YESSS!!!

Worked in my code. Now to fix the import csv function in appadmin. Using 
version 2.18.5 of web2py with python 3.7.0 on pythonanywhere.


On Friday, April 26, 2019 at 1:56:39 AM UTC-4, 
nbac...@bancointernacional.cl wrote:
>
> I had a similar issue.
> I solve it doing this:
>
> f = request.vars.csvfile.file
> import io
> file = io.TextIOWrapper(f, encoding='utf-8')
>
> El lunes, 11 de febrero de 2019, 14:34:18 (UTC-3), Maurice Waka escribió:
>>
>> I shifted to web2py/python3. In python2.7 I was able to upload csv files 
>> but using the same code below I get an error.
>> For example:
>> def import_csv():
>> form = FORM(INPUT(_type = 'file', _name = 'csv_file'),
>>  INPUT(_type = 'submit', _value = T('Import')))
>> return dict(form=form)
>> @mobilize
>> @auth.requires_login()
>> def index1():
>> if request.vars.csvfile != None:
>> # set values
>> table = db[request.vars.table]
>> file = request.vars.csvfile.file
>> # import csv file
>> table.import_from_csv_file(file)
>> # update who imported
>> query = db.food_data.protein==""
>> db(query).update(protein="")
>> response.flash = 'Data uploaded'
>> return dict()
>>
>> The error is this
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>>
>> Traceback (most recent call last):
>>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File 
>> "/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/default.py"
>>  
>> ,
>>  line 479, in 
>>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/home/mauricewaka/web2py/gluon/contrib/user_agent_parser.py", line 
>> 695, in __call__
>> return self.func()
>>   File "/home/mauricewaka/web2py/gluon/tools.py", line 3867, in f
>> return action(*a, **b)
>>   File 
>> "/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/default.py"
>>  
>> ,
>>  line 329, in index1
>> table.import_from_csv_file(file)
>>   File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 980, in import_from_csv_file
>> for lineno, line in enumerate(reader):
>> _csv.Error: iterator should return strings, not bytes (did you open the file 
>> in text mode?)
>>
>> How can I solve this
>>
>>
> CONFIDENCIALIDAD La información contenida en este mensaje y/o en los 
> archivos adjuntos es de carácter confidencial o privilegiada y está 
> destinada al uso exclusivo del emisor y/o de la persona o entidad a quien 
> va dirigida. Si usted no es el destinatario, cualquier almacenamiento, 
> divulgación, distribución o copia de esta información está estrictamente 
> prohibido y sancionado por la ley. Si recibió este mensaje por error, por 
> favor infórmenos inmediatamente respondiendo este mismo mensaje y borre 
> éste y todos los archivos adjuntos. Gracias. 
>
> CONFIDENTIAL NOTE The information transmitted in this message and/or 
> attachments is confidential and/or privileged and is intented only for use 
> of the person or entity to whom it is addressed. If you are not the 
> intended recipient, any retention, dissemination, distribution or copy of 
> this information is strictly prohibited and sanctioned by law. If you 
> received this messagge in error, please reply us this same message and 
> delete this message and all attachments. 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1ce5270b-be43-4aba-ac99-9a2609eb4bbd%40googlegroups.com.


[web2py] Re: Error importing csv file in python3.6

2020-02-23 Thread Dan Carroll
This works in your own code using import_from_csv_file as well as in 
appadmin, all for python 3.


On Friday, April 26, 2019 at 1:56:39 AM UTC-4, 
nbac...@bancointernacional.cl wrote:
>
> I had a similar issue.
> I solve it doing this:
>
> f = request.vars.csvfile.file
> import io
> file = io.TextIOWrapper(f, encoding='utf-8')
>
> El lunes, 11 de febrero de 2019, 14:34:18 (UTC-3), Maurice Waka escribió:
>>
>> I shifted to web2py/python3. In python2.7 I was able to upload csv files 
>> but using the same code below I get an error.
>> For example:
>> def import_csv():
>> form = FORM(INPUT(_type = 'file', _name = 'csv_file'),
>>  INPUT(_type = 'submit', _value = T('Import')))
>> return dict(form=form)
>> @mobilize
>> @auth.requires_login()
>> def index1():
>> if request.vars.csvfile != None:
>> # set values
>> table = db[request.vars.table]
>> file = request.vars.csvfile.file
>> # import csv file
>> table.import_from_csv_file(file)
>> # update who imported
>> query = db.food_data.protein==""
>> db(query).update(protein="")
>> response.flash = 'Data uploaded'
>> return dict()
>>
>> The error is this
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>>
>> Traceback (most recent call last):
>>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File 
>> "/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/default.py"
>>  
>> ,
>>  line 479, in 
>>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/home/mauricewaka/web2py/gluon/contrib/user_agent_parser.py", line 
>> 695, in __call__
>> return self.func()
>>   File "/home/mauricewaka/web2py/gluon/tools.py", line 3867, in f
>> return action(*a, **b)
>>   File 
>> "/home/mauricewaka/web2py/applications/Hestque_Wellness/controllers/default.py"
>>  
>> ,
>>  line 329, in index1
>> table.import_from_csv_file(file)
>>   File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 980, in import_from_csv_file
>> for lineno, line in enumerate(reader):
>> _csv.Error: iterator should return strings, not bytes (did you open the file 
>> in text mode?)
>>
>> How can I solve this
>>
>>
> CONFIDENCIALIDAD La información contenida en este mensaje y/o en los 
> archivos adjuntos es de carácter confidencial o privilegiada y está 
> destinada al uso exclusivo del emisor y/o de la persona o entidad a quien 
> va dirigida. Si usted no es el destinatario, cualquier almacenamiento, 
> divulgación, distribución o copia de esta información está estrictamente 
> prohibido y sancionado por la ley. Si recibió este mensaje por error, por 
> favor infórmenos inmediatamente respondiendo este mismo mensaje y borre 
> éste y todos los archivos adjuntos. Gracias. 
>
> CONFIDENTIAL NOTE The information transmitted in this message and/or 
> attachments is confidential and/or privileged and is intented only for use 
> of the person or entity to whom it is addressed. If you are not the 
> intended recipient, any retention, dissemination, distribution or copy of 
> this information is strictly prohibited and sanctioned by law. If you 
> received this messagge in error, please reply us this same message and 
> delete this message and all attachments. 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b911d05f-cb8f-483f-a72f-6eeaf2443399%40googlegroups.com.


Re: [web2py] Re: p4web auth issues

2020-02-23 Thread Lovedie JC
Thanks.
Before you replied I had tried :
user = auth.get.user()[first_name]

With an error.. 'first_name' is not defined
Regards

On Mon, Feb 24, 2020, 02:02 Val K  wrote:

> `auth` in py4web is no the same as in web2py
> to get user-record you should
> ...
> def index():
> user = auth.get_user()
>
>
>
> On Sunday, February 23, 2020 at 8:47:46 PM UTC+3, Maurice Waka wrote:
>>
>>
>> import os
>> import datetime as dt
>> from datetime import datetime, timedelta, date
>> from .common import db, session, T, cache, auth, logger, authenticated,
>> unauthenticated
>> from py4web import action, request, DAL, Field, Session, Cache, user_in,
>> abort, redirect, URL, Field
>> from py4web.utils.auth import Auth
>> from py4web import action, request, abort, redirect, URL, Field
>> from py4web.utils.form import Form, FormStyleBulma
>> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>> from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET,
>> IS_IN_DB, IS_EMAIL, IS_MATCH
>> from yatl.helpers import INPUT, H1, HTML, BODY, A
>> from pydal.validators import *
>>
>> db.define_table('answers',
>> Field('author', 'reference auth_user',
>> default=auth.user_id, readable=False, writable=False),
>> Field('userId','reference
>> auth_user',unique=True,readable=False,writable=False),
>> Field('quest', 'text', requires=IS_NOT_EMPTY(),),
>> auth.signature
>> )
>> db.define_table('posts',
>> Field('author', 'reference auth_user',
>> default=auth.user_id, writable=False, readable=False),
>> Field("message", 'text', requires=IS_NOT_EMPTY(),
>> notnull=False),
>> auth.signature
>> )
>>
>> @authenticated()
>> def index():
>> codes = []
>> del codes[:]
>> r = []
>> yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
>> db(db.answers.modified_on < yesterday).delete()
>> """Avoid an empty table"""
>> user = db(db.posts.author== auth.user_id).select(db.posts.id,
>> db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
>> if user.author if user else None == auth.user_id:
>> pass
>> else:
>> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+'
>> Thank you for signing in with us. Blah blah blah.', author=auth.user_id,
>> created_by=auth.user_id, modified_by=auth.user_id)
>> db.commit()
>> On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:
>>>
>>> Show your code, please
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/19c4dd56-ffc3-40bb-9067-e5525ffafcf7%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAAcHJF-wyMTHVVL66rLWYKYiKZ_mjBCh88WhRtUnC_38rJ0Cug%40mail.gmail.com.


Re: [web2py] Re: p4web auth issues

2020-02-23 Thread Scott Hunter
user = auth.get.user()['first_name']

On Sunday, February 23, 2020 at 9:23:06 PM UTC-5, Lovedie JC wrote:
>
> Thanks.
> Before you replied I had tried :
> user = auth.get.user()[first_name]
>
> With an error.. 'first_name' is not defined
> Regards 
>
> On Mon, Feb 24, 2020, 02:02 Val K > wrote:
>
>> `auth` in py4web is no the same as in web2py
>> to get user-record you should
>> ...
>> def index():
>> user = auth.get_user()
>>
>>
>>
>> On Sunday, February 23, 2020 at 8:47:46 PM UTC+3, Maurice Waka wrote:
>>>
>>>
>>> import os
>>> import datetime as dt
>>> from datetime import datetime, timedelta, date 
>>> from .common import db, session, T, cache, auth, logger, authenticated, 
>>> unauthenticated
>>> from py4web import action, request, DAL, Field, Session, Cache, user_in, 
>>> abort, redirect, URL, Field
>>> from py4web.utils.auth import Auth
>>> from py4web import action, request, abort, redirect, URL, Field
>>> from py4web.utils.form import Form, FormStyleBulma
>>> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>>> from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET, 
>>> IS_IN_DB, IS_EMAIL, IS_MATCH
>>> from yatl.helpers import INPUT, H1, HTML, BODY, A
>>> from pydal.validators import *
>>>
>>> db.define_table('answers',
>>> Field('author', 'reference auth_user', 
>>> default=auth.user_id, readable=False, writable=False),
>>> Field('userId','reference 
>>> auth_user',unique=True,readable=False,writable=False),
>>> Field('quest', 'text', requires=IS_NOT_EMPTY(),),
>>> auth.signature
>>> )
>>> db.define_table('posts',
>>> Field('author', 'reference auth_user', 
>>> default=auth.user_id, writable=False, readable=False),
>>> Field("message", 'text', requires=IS_NOT_EMPTY(), 
>>> notnull=False),
>>> auth.signature
>>> )
>>>
>>> @authenticated()
>>> def index():
>>> codes = []
>>> del codes[:]
>>> r = []
>>> yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
>>> db(db.answers.modified_on < yesterday).delete()
>>> """Avoid an empty table"""
>>> user = db(db.posts.author== auth.user_id).select(db.posts.id, 
>>> db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
>>> if user.author if user else None == auth.user_id:
>>> pass
>>> else:
>>> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' 
>>> Thank you for signing in with us. Blah blah blah.', author=auth.user_id, 
>>> created_by=auth.user_id, modified_by=auth.user_id)
>>> db.commit()
>>> On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:

 Show your code, please
>>>
>>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/19c4dd56-ffc3-40bb-9067-e5525ffafcf7%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/25dfd7d0-f876-4e97-a3ba-ff06a1415cba%40googlegroups.com.


Re: [web2py] Re: p4web auth issues

2020-02-23 Thread Maurice Waka
Thanks a lot.
Regards

On Mon, Feb 24, 2020, 06:14 Scott Hunter  wrote:

> user = auth.get.user()['first_name']
>
> On Sunday, February 23, 2020 at 9:23:06 PM UTC-5, Lovedie JC wrote:
>>
>> Thanks.
>> Before you replied I had tried :
>> user = auth.get.user()[first_name]
>>
>> With an error.. 'first_name' is not defined
>> Regards
>>
>> On Mon, Feb 24, 2020, 02:02 Val K  wrote:
>>
>>> `auth` in py4web is no the same as in web2py
>>> to get user-record you should
>>> ...
>>> def index():
>>> user = auth.get_user()
>>>
>>>
>>>
>>> On Sunday, February 23, 2020 at 8:47:46 PM UTC+3, Maurice Waka wrote:


 import os
 import datetime as dt
 from datetime import datetime, timedelta, date
 from .common import db, session, T, cache, auth, logger, authenticated,
 unauthenticated
 from py4web import action, request, DAL, Field, Session, Cache,
 user_in, abort, redirect, URL, Field
 from py4web.utils.auth import Auth
 from py4web import action, request, abort, redirect, URL, Field
 from py4web.utils.form import Form, FormStyleBulma
 from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
 from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET,
 IS_IN_DB, IS_EMAIL, IS_MATCH
 from yatl.helpers import INPUT, H1, HTML, BODY, A
 from pydal.validators import *

 db.define_table('answers',
 Field('author', 'reference auth_user',
 default=auth.user_id, readable=False, writable=False),
 Field('userId','reference
 auth_user',unique=True,readable=False,writable=False),
 Field('quest', 'text', requires=IS_NOT_EMPTY(),),
 auth.signature
 )
 db.define_table('posts',
 Field('author', 'reference auth_user',
 default=auth.user_id, writable=False, readable=False),
 Field("message", 'text', requires=IS_NOT_EMPTY(),
 notnull=False),
 auth.signature
 )

 @authenticated()
 def index():
 codes = []
 del codes[:]
 r = []
 yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
 db(db.answers.modified_on < yesterday).delete()
 """Avoid an empty table"""
 user = db(db.posts.author== auth.user_id).select(db.posts.id,
 db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
 if user.author if user else None == auth.user_id:
 pass
 else:
 db.posts.insert(message="Welcome "+auth_user.first_name+'.'+'
 Thank you for signing in with us. Blah blah blah.', author=auth.user_id,
 created_by=auth.user_id, modified_by=auth.user_id)
 db.commit()
 On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:
>
> Show your code, please

 --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/19c4dd56-ffc3-40bb-9067-e5525ffafcf7%40googlegroups.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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/_x-OLtei8XE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/25dfd7d0-f876-4e97-a3ba-ff06a1415cba%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CALkNK57KSLmog1RkO4m9cBqg7_jGhqWLejpA8hU1kP-mf_Yeng%40mail.gmail.com.


[web2py] Re: web2py upgrade from 2.16.1

2020-02-23 Thread Massimo Di Pierro
If you upgrade web2py to the latest and you continue to use python 2.7 
everything should work as expected. We do continue to promise python 2.7 
backward compatibility (and this is all that we promised).

If you chose to upgrade to python 3.7 than your app will probably no longer 
work. You will have to convert them from python 2.7 to 3.7. This is not 
web2py specific. We do not require that you do that. Yet the Python 
language developer have made the choice of no longer supporting python 2.7 
and therefore you should upgrade.

All we offer is, 1) if you port your apps, web2py will still work with 
them. 2) we offer py4web as a framework build specifically for python 3.7 
which supports a lot of the same APIs and is faster.

On Sunday, 23 February 2020 11:28:45 UTC-8, Andrea Fae' wrote:
>
> I 'm using web2py 2.16.1 stable on my computer and I used it with python 
> version 2.7.
> I programmed some sites with this RAD system.
> So I want to upgrade to the latest 2.18.5 stable and Python 3. What can I 
> do to do it?
> What could be the implications on my projects made with 2.16 ant python 2?
>
> If all works it's possible to change in the production environment on 
> pyrhonanywhere the same? How?
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c36102f9-b562-4a40-a4c2-5dacd83e9a44%40googlegroups.com.


[web2py] Re: LOAD in py4web

2020-02-23 Thread Massimo Di Pierro
We can add it in utils. But before we do. Do other peopl find it useful? Is 
that a pattern we should encourage vs, for example, vue.js?

On Sunday, 23 February 2020 10:18:51 UTC-8, RHC wrote:
>
> HI,
>
> I am beginning to experiment with py4web, I like the sound of it and I am 
> looking to convert a web2py project to py4web to see how they compare.
>
> It appears that the LOAD (helper?) that was available in web2py templates 
> is not available in py4web. I was using this to populate part of a web 
> page, I liked the way you had the option to use LOAD to call a separate URL 
> (within the same app) and insert the result into your page before returning 
> the page to the client.
>
> What is the reason for the absence of LOAD in py4web? is there a 
> recommended alternative method of achieving the same effect? I have used a 
> mixture of ajax=True and ajax=False options for this feature.
>
> Thanks,
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7cfaf6be-8be3-41dc-8745-ab59716f68af%40googlegroups.com.


[web2py] Re: unexpected end of stream - py4web

2020-02-23 Thread Edoardo Torrini
Hi,
I will attach you some part of code:

The client is written in c# and is implemented in Xamarin: 




[image: Exception - Xamarine.png] 





























The server is written in python using the py4web framework, I have 
implemented the scheduling with celery/redis:
This is the controller of my app:

[image: Controller - py4web.png] 
































this is the task of my app:

[image: task prd - py4web.png] 








































Thanks for your help.

Edoardo Torrini



Il giorno domenica 23 febbraio 2020 00:44:14 UTC+1, Massimo Di Pierro ha 
scritto:
>
> Can you show us some minimum code to rproduce?
>
> On Friday, 21 February 2020 20:38:08 UTC-8, Edoardo Torrini wrote:
>>
>> Hi 
>>
>> I create a project client/server compose by an application mobile 
>> (client) and a webservice (py4web).
>> the application create request to the webservice and the server reply.
>> I add a request scheduling using the celery and redis.
>> I follow pass for pass the guide on the official py4web site.
>>
>> the problem is that when I generete the get request from the app create 
>> an exception: "unexpected end of stream"
>> Someone know how to fix this issue?
>>
>> Thanks
>> Edoardo Torrini
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6a55c277-f454-4cd5-b2ed-c11033fb9347%40googlegroups.com.