[web2py] routes.py to app/controller/function/1/2/3

2021-11-01 Thread 'Annet' via web2py-users

I am developing a network application in web2py which consists of vertices 
and edges. Every vertex has a site which is dynamicalIy created within the 
init application. I added a domain and subdomains for my own domain to 
routes.py

routers = dict(

# base router
BASE = dict(
domains = {
'domain.com' : 'init',
'www.domain.com' : 'init',
'ldc.domain.com' : 'admin',
'my.domain.com' : 'controlpanel',
}
),
)


Someone asked me if he could point his domain to his site within the init 
application. I wonder whether that is possible. It would mean that for 
example I have to add thess domains to web2py's routes.py 

'otherdomain.com': 'init/default/router/6' 
'www.otherdomain.com: 'init/default/router/6' 

where 'init' is the application, 'default' is the controller, 'router' is 
the function and '6' is the vertex ID, the router would then sets the args 
and redirects the request to 'init/main/index/6/1/5/24'which renders the 
site.

Is this possible?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/97851586-764f-46fd-b59b-0c2517b9698cn%40googlegroups.com.


[web2py] Services

2021-10-29 Thread 'Annet' via web2py-users
I built a calendar application in web2py 2.20.4, the application has a 
calendar.py controller with functions event_list(), timetable(), 
coursetable() etc. The data is stored in a PostgreSQL database.

What I want is to make the data in the database available to for instance a 
user's WP web site.

I am going through chapter 10 Services of the web2py book, but what's 
described there: 
http://web2py.com/books/default/chapter/29/10/services#Remote-procedure-calls 
seems to be no longer done in db.py and default.py

I wonder what is the best way to implement this kind of service in web2py 
2.20.4. Thanks in advance for your replies.

KInd regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c698e9ec-6e31-43bc-8dbd-d3b6eefa946dn%40googlegroups.com.


[web2py] form.custom.widget.image breaks in case of form.errors

2021-05-14 Thread 'Annet' via web2py-users
I have another problem with form.custom:

When I browse and select an image and submit the form, if the
form contains an error, the form empties the image field. So
the user has to browse for the image again

I don't know in which version of web2py this error was introduced,
but is very annoying and confusing behaviour.

Is there a fix for this problem?


Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1a4adbfb-bda8-402f-9224-a05744ab8bdcn%40googlegroups.com.


[web2py] form.custom.widget.image does not show preview

2021-05-14 Thread 'Annet' via web2py-users
I have a view with the following code:


{{=form.custom.widget.image}}
 

The problem is that in the update form the image does not
display, which is very confusing to the user.

is there a way to fix this issue?


Kind regards,

Annet


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4257a859-dc22-4b63-b5cb-25334c0e15fan%40googlegroups.com.


[web2py] Unable to handle upload

2021-04-26 Thread 'Annet' via web2py-users
In my database model I have a parent table 'thg_thing' and a child table 
'thg_book'


Furthermore I have a function book_form which contains the following code:

form = SQLFORM(db.thg_book, row, deletable=False, upload=URL('default', 
'download'), showid=False, buttons=buttons)
if hasattr(request.vars.image, 'filename'):
form.vars.imagefilename = request.vars.image.filename

if form.validate():
if row:
row.update_record(**db.thg_book._filter_fields(form.vars))
if form.vars.image__delete:
file = row.image
os.remove(os.path.join(UPLOADSDIR, 'vertex%s' % vertexid, 
file))
row.update_record(imagefilename=None, image=None, 
width=None, height=None)

form.vars.thingid = db.thg_thing.insert(name=form.vars.h1selector)
db.thg_book.insert(**db.thg_book._filter_fields(form.vars))


Now when I submit the form, I get the following error:

db.thg_book.insert(**db.thg_book._filter_fields(form.vars))

raise RuntimeError("Unable to handle upload")
RuntimeError: Unable to handle upload


I don't understand why I het this error, is it because I use form.validate()
instead of if form.process().accepted:

Kind regards,

Annet



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/255dd20c-cc86-49ff-8828-39f2c47b7cecn%40googlegroups.com.


[web2py] data-w2p_remote

2021-01-21 Thread 'Annet' via web2py-users

I have a site in which I have a layout.html view with a header and
a footer, the main content is loaded into this div:



The problem is that when I click on a link on /init/home/index/ the content 
of
/init/home/index/ is shown a fraction of a second before the requested page
is loaded.

Any other apge loads fine it is just the /init/home/index/ page that has 
this problem.

I find this annoying and wonder why this happens and if there is a way to
prevent this from happening.

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7d871205-63ba-4fdc-9532-d8ca8083607dn%40googlegroups.com.


[web2py] Re: Selecting payment method

2020-12-23 Thread 'Annet' via web2py-users
I am not sure I fully understand your question, but doesn't SQLFORM.widgets.
radio.widget
on the pay_with solve your issue?

Best,

Annet

Op dinsdag 22 december 2020 om 17:25:57 UTC+1 schreef mauri...@gmail.com:

> I worked on a way to pay through various methods. It involves a user 
> selecting the appropriate method he/she likes or wants to use.
>
> This is the code:
> #Controller
>
> form = SQLFORM(Pending, formstyle="divs", submit_button='Subscribe'),
> if form.process().accepted:
> session.pending = form.vars
> redirect(URL('e_pay', form.vars.pay_with, ))
>
> form_one = SQLFORM(Subscription_one, formstyle="divs", 
> submit_button='Subscribe')
> if form_one.process().accepted:
> session.pending_one = form_one.vars
> redirect(URL('e_pay', form_one.vars.pay_with, ))
>
> #db.py
> one_month = timedelta(days=365/12)
> Subscription_one = db.define_table('subscription_one',
>Field('user_id', 'reference auth_user'),
>Field('Subscription_type','text', default = 
> 'One Month', represent = lambda value, row: 
> DIV(str(value),_style="color:#38D9D6; text-align: center;")),#Only modified 
> by Admin
>Field('Amount','double', default= 3.49, 
> represent = lambda value, row: DIV('$' + str(value) + '/month', 
> _style='text-align: center; color: red; font-size: 30px;')),#Only modified 
> by Admin
>   
>  Field('pay_with',requires=IS_IN_SET((['paypal','stripe',])),default='None'),
>Field('confirmed', 'boolean', 
> default=False),
>Field('start_date', 'date', 
> default=request.now),
>Field('renew_date', 'date', 
> default=request.now+one_month),)
> three_month = timedelta(days=365/4)
> Subscription_three = db.define_table('subscription_three',
>Field('user_id', 'reference auth_user'),
>Field('Subscription_type','text', default = 
> 'Three Months', represent = lambda value, row: 
> DIV(str(value),_style="color:#38D9D6; text-align: center;")),#Only modified 
> by Admin
>Field('Amount','double', default= 3.29, 
> represent = lambda value, row: DIV('$' + str(value) + '/month', 
> _style='text-align: center; color: red; font-size: 30px;')),#Only modified 
> by Adminn
>   
>  Field('pay_with',requires=IS_IN_SET((['paypal','stripe',])),default='None'),
>Field('confirmed', 'boolean', 
> default=False),
>Field('start_date', 'date', 
> default=request.now),
>Field('renew_date', 'date', 
> default=request.now+three_month),)
>
> The problem is that the user when selecting an option, 'paypal' and 
> decides against it and selects 'stripe', the options are still 'active' and 
> not deselected.So on clicking submit, both might be posted.
> How can I prevent both selections at the same time?
> I also need to align the buttons to the center or left but 
> _select='align-items:center' is not working.
> Kind 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/1947faff-cc28-456b-83a4-11d06ffe3464n%40googlegroups.com.


[web2py] Digitally sign URLs

2020-12-08 Thread 'Annet' via web2py-users
In the control panel I built I use URL(..., user_signature=True) and 
@auth.requires_signature() to secure the urls.

I the init application I built I have various links to a particular 
function with different 
combinations of args and vars. I want to limit access to that function so 
only the 
explicitly generated links will work i.e. prevent users from generating 
their own combinations of args and vars. 

Is it possible to digitally sign the allowed URLs and check the signature 
in the action to prevent any other URLs from working, without visitors 
being logged in?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7eb9e6e0-92bd-4316-b209-d7bbe039d6cdn%40googlegroups.com.


[web2py] sessions2trash.py

2020-12-08 Thread 'Annet' via web2py-users

I used to host my web2py application at Webfaction, there I scheduled
a cron job to run the sessions2trash.py script. In the end this no
longer worked.

Now I host my web2py application at Opalstack, and wonder how I
schedule a task to run sessions2trash.py to clean up my applications.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5967ae18-8fa9-41d4-8a1b-0c9fc76357ecn%40googlegroups.com.


[web2py] Re: How to customize email settings.

2020-12-04 Thread 'Annet' via web2py-users
Maybe auth.messages is what you're looking for:

auth.messages.retrieve_username = 'Your user name: %(username)s'
auth.messages.retrieve_username_subject = 'Username retrieval'
auth.messages.reset_password = 'Click or copy/paste the following link 
https://'+request.env.http_host+URL('default', 'user', 
args='reset_password')+'?key=%(key)s to the address bar of your browser. 
Use the form to set a new password'
auth.messages.reset_password_subject = 'Password reset: '


Kind regards,

Annet
Op woensdag 2 december 2020 om 17:17:56 UTC+1 schreef lbjc...@gmail.com:

> I recently successfully used the configured email settings as follows:
>
> mail = auth.settings.mailer
> mail.settings.server = 'smtp.gmail.com:587'
> mail.settings.sender = 'user...@gmail.com'
> auth.settings.registration_requires_verification = True
>
> I noted that the email arrived with the sender name in lower caps and 
> using the email names (e.g. if user...@gmail.com the name appears as 
> username and not user name).
> I would like it to appear like: 'User Name' and not 'username'.
> Kind 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/6107ca96-e645-4070-be83-48aebd59eef4n%40googlegroups.com.


[web2py] Re: In case of form.errors browse for image again

2020-11-11 Thread 'Annet' via web2py-users
Related to the issue above. I have the following form:

form = SQLFORM.factory(table, db.prm_generic, upload=URL('default', 
'download'), buttons=buttons)
...
if form.validate():
if request.args(0) == 'landingpages':
if row:
row.update_record(**db.prm_page._filter_fields(form.vars))

sub.update_record(**db.prm_generic._filter_fields(form.vars))
else:
form.vars.pageid = 
db.prm_page.insert(**db.prm_page._filter_fields(form.vars))

db.prm_generic.insert(**db.prm_generic._filter_fields(form.vars))

When I prepopulate the form, the form does not contain the file link and it 
does not display
the image. It just contains the browse button.

When I submit the form, without adding an image I get the following error:


Ticket ID 

127.0.0.1.2020-11-11.18-02-47.b218631d-6dc1-42b1-af58-3f68e9641716
 Unable to handle upload Version web2py™ 
Version 2.20.4-stable+timestamp.2020.05.03.05.18.50 Traceback 

The upload field is in 
sub.update_record(**db.prm_generic._filter_fields(form.vars))

Why doesn't web2py handle this properly?

KInd regards,

Annet


Op woensdag 11 november 2020 om 17:04:00 UTC+1 schreef Annet:

> When I create a form based on a table that has a field of type upload
> to upload an image, I have a problem when one of the other fields
> in the table doesn't validate. e.g. a field of type text contains too
> may characters.
>
> This form.errors resets the upload field, so I have to browse for
> the image again, every time one of the other fields doesn't
> validate.
>
> I haven't noticed this behaviour in version 2.14 of web2py, I
> am experiencing this behaviour in web2py 2.20.
>
> I hope there's an easy fix, for this is very annoying.
>
>
> Kind regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d93e626d-fc74-4fc8-8d9f-8cff6d4d5e3an%40googlegroups.com.


[web2py] In case of form.errors browse for image again

2020-11-11 Thread 'Annet' via web2py-users
When I create a form based on a table that has a field of type upload
to upload an image, I have a problem when one of the other fields
in the table doesn't validate. e.g. a field of type text contains too
may characters.

This form.errors resets the upload field, so I have to browse for
the image again, every time one of the other fields doesn't
validate.

I haven't noticed this behaviour in version 2.14 of web2py, I
am experiencing this behaviour in web2py 2.20.

I hope there's an easy fix, for this is very annoying.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1ec8cc7c-c49e-476a-854f-09761b1da667n%40googlegroups.com.


[web2py] Re: Upload images to folder outside web2py

2020-11-09 Thread 'Annet' via web2py-users
Thanks for the link.

I had a look at Gael's post, my problem isn't related to that one.

However, reading Gael's post I realised that bewteen versions
I introduced conditional models. Since the download function
is in the default controller and the uploadfolder is set in the
model I needed to add the respective model files to response.models_to_run

So, Gael's post indirectly helped me solve the issue.

Kind regards,

Annet

Op zaterdag 7 november 2020 om 23:45:08 UTC+1 schreef snide...@gmail.com:

>
>
> On Monday, November 2, 2020 at 7:35:45 AM UTC-8, Annet wrote:
>>
>> I forgot to say, uploading an image works, if the folder isn't
>> there it is being created, otherwise the image is uploaded
>> to the folder.
>>
>> Best,
>>
>> Annet
>>
>>
> Is this related to slashes being dropped, as in Gael's question?
> https://groups.google.com/d/msg/web2py/b5mApXO-9Io/FICcx2JlBgAJ>
>
> /dps
>
>  
>
>> Op maandag 2 november 2020 om 16:17:48 UTC+1 schreef Annet:
>>
>>>
>>> To upload images to separate folders outside web2py I set the upload 
>>> folder with the model definition:
>>>
>>> UPLOADSDIR = '/home/me/apps/static/'
>>>
>>> db.define_table('mytable',
>>> Field('image', 'upload', autodelete=True, uploadfolder=os.path.join(
>>> UPLOADSDIR, 'vertexID%s' % session.vertexID),
>>> ...)
>>>
>>>
>>> I use the standard download function:
>>>
>>> def download():
>>> return response.download(request, db)
>>>
>>>
>>> The form:
>>>
>>> form = SQLFORM(table, row, deletable=True, upload=URL('default', 
>>> 'download'), showid=False, buttons=buttons)
>>> if hasattr(request.vars.image, 'filename'):
>>> form.vars.imagefilename = request.vars.image.filename
>>>
>>>
>>> and to process the form:
>>>
>>> if form.process().accepted:
>>> if row and form.vars.image__delete:
>>> file = row.image
>>> os.remove(os.path.join(UPLOADSDIR, 'vertex%s' % 
>>> session.back_end_vertexid, file))
>>>
>>>
>>> In web2py 2.17.2 this all worked without problem, however, after 
>>> upgrading to
>>> web2py 2.20 it no longer works. The image doesn't show in the form, it's 
>>> marked
>>> with a broken link icon, and when I click the file link I get a page not 
>>> found error.
>>> Also when I upload a new image, the old one isn't being deleted, so the 
>>> images pile
>>> up in the folder.
>>>
>>> I hope someone knows how to solve this issue.
>>>
>>>
>>> Kind regards,
>>>
>>> Annet
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f8034520-5ac0-4413-b692-51f6eb1a9de3n%40googlegroups.com.


[web2py] Re: Upload images to folder outside web2py

2020-11-02 Thread 'Annet' via web2py-users
I forgot to say, uploading an image works, if the folder isn't
there it is being created, otherwise the image is uploaded
to the folder.

Best,

Annet

Op maandag 2 november 2020 om 16:17:48 UTC+1 schreef Annet:

>
> To upload images to separate folders outside web2py I set the upload 
> folder with the model definition:
>
> UPLOADSDIR = '/home/me/apps/static/'
>
> db.define_table('mytable',
> Field('image', 'upload', autodelete=True, uploadfolder=os.path.join(
> UPLOADSDIR, 'vertexID%s' % session.vertexID),
> ...)
>
>
> I use the standard download function:
>
> def download():
> return response.download(request, db)
>
>
> The form:
>
> form = SQLFORM(table, row, deletable=True, upload=URL('default', 
> 'download'), showid=False, buttons=buttons)
> if hasattr(request.vars.image, 'filename'):
> form.vars.imagefilename = request.vars.image.filename
>
>
> and to process the form:
>
> if form.process().accepted:
> if row and form.vars.image__delete:
> file = row.image
> os.remove(os.path.join(UPLOADSDIR, 'vertex%s' % 
> session.back_end_vertexid, file))
>
>
> In web2py 2.17.2 this all worked without problem, however, after upgrading 
> to
> web2py 2.20 it no longer works. The image doesn't show in the form, it's 
> marked
> with a broken link icon, and when I click the file link I get a page not 
> found error.
> Also when I upload a new image, the old one isn't being deleted, so the 
> images pile
> up in the folder.
>
> I hope someone knows how to solve this issue.
>
>
> Kind regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cfcae028-a4fb-46ca-91b5-49abbc30a21en%40googlegroups.com.


[web2py] Upload images to folder outside web2py

2020-11-02 Thread 'Annet' via web2py-users

To upload images to separate folders outside web2py I set the upload folder 
with the model definition:

UPLOADSDIR = '/home/me/apps/static/'

db.define_table('mytable',
Field('image', 'upload', autodelete=True, uploadfolder=os.path.join(
UPLOADSDIR, 'vertexID%s' % session.vertexID),
...)


I use the standard download function:

def download():
return response.download(request, db)


The form:

form = SQLFORM(table, row, deletable=True, upload=URL('default', 
'download'), showid=False, buttons=buttons)
if hasattr(request.vars.image, 'filename'):
form.vars.imagefilename = request.vars.image.filename


and to process the form:

if form.process().accepted:
if row and form.vars.image__delete:
file = row.image
os.remove(os.path.join(UPLOADSDIR, 'vertex%s' % 
session.back_end_vertexid, file))


In web2py 2.17.2 this all worked without problem, however, after upgrading 
to
web2py 2.20 it no longer works. The image doesn't show in the form, it's 
marked
with a broken link icon, and when I click the file link I get a page not 
found error.
Also when I upload a new image, the old one isn't being deleted, so the 
images pile
up in the folder.

I hope someone knows how to solve this issue.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/21d8da30-28f0-4a10-9550-ad8cd84d5f3dn%40googlegroups.com.


[web2py] Re: Opalstack for ex-webfaction users or people looking for a Web2Py Web Hosting (Tutorial for Python 3 or 2.7)

2020-10-20 Thread 'Annet' via web2py-users
Hi,

Jose, is right, I had the same problem: I did not go to my app directory 
prior to activating the virtualenv.
No need to switch databases.

Personally I prefer Opalstack's control panel over Webfaction's control 
panel. It's simpler and more powerful.

Best,

Annet
Op dinsdag 20 oktober 2020 om 10:17:37 UTC+2 schreef Jose C:

> On Tuesday, 20 October 2020 at 08:50:13 UTC+1 gaelpri...@gmail.com wrote:
>
>> Thank you Carlos, I'll start this migration as soon as my Opalstack 
>> account will be a provisioned.
>> I've a doubt about the DBs. Opalstack offers MariaDB and PostgreSQL.
>> It seems that it's not so easy to use PostgreSQL.
>> https://groups.google.com/g/web2py/c/bc_8dg-XHpY/m/ci8A2RzzAwAJ
>> I can switch my PostgreSQL DBs to MySQL, but in the connection string 
>> with MariaDB I have to use the standard MySQL one?
>> mysql://username:password@localhost/test?set_encoding=utf8mb4 
>>
>
> Hi Gael,
> There's really no difference to the way it worked on webfaction.  That 
> link above was a version issue with the psycopg2 library and Antonio shared 
> a way to install the latest psycopg2 version (as did I, using 
> psycopg2-binary package).
>
> I wouldn't change databases.
>
> HTH,
>
> Jose
>
>

-- 
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/f3784dda-664b-4ec1-a319-ea3d4441e2f5n%40googlegroups.com.


[web2py] Re: routes.py and root_static

2020-10-19 Thread 'Annet' via web2py-users
Hi Jose,

Thanks for your reply.

One more thing. I've got routes.py in web2py's root folder, as you can see 
I've got
three applications, do I place the robots.txt file in all three 
application's static
folder?


Kind regards,

Annet

Op vrijdag 16 oktober 2020 om 12:39:18 UTC+2 schreef Jose C:

>
>> BASE = dict(
>> domains = { },
>> root_static = ['favicon.ico', 'robots.txt'],
>> ),
>> )
>>
>> would this be correct?
>>
>> Should robots.txt go into the /applications/init/static/
>>
>
> Yep, any files served at the root of your site (e.g.  
> https://mydomain.com/robots.txt)  go in the /static directory of your app 
> and then you specify them in the root_static list as you've done.  
> Reminder, you need to restart your app each time you change anything in 
> routes.py for the new changes to take effect.
>
> Jose
>
>
>

-- 
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/4fd0f8fc-c591-4dee-a4ad-40a9e82ad4f7n%40googlegroups.com.


[web2py] routes.py and root_static

2020-10-14 Thread 'Annet' via web2py-users
I have the following lines of code in routes.py

routers = dict(

# base router
BASE = dict(
domains = {
'domain.com' : 'init',
'www.domain.com' : 'init',
'ldc.domain.com' : 'admin',
'my.domain.com' : 'controlpanel',
}
),
)

I want to add root_static = ['favicon.ico', 'robots.txt'], to routers but I 
am not sure
about the syntax and where to put the robots.txt file.

BASE = dict(
domains = { },
root_static = ['favicon.ico', 'robots.txt'],
),
)

would this be correct?

Should robots.txt go into the /applications/init/static/


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2f75ccc0-d59a-40b9-9a43-9550b9b6503bn%40googlegroups.com.


[web2py] Share sessions

2020-10-13 Thread 'Annet' via web2py-users
In the model files of my applications I have these lines of code
because I want to share the session, so menus etc. reflect the
correct state and users need not login twice

# share the session cookie among all subdomains under the main domain

response.cookies[response.session_id_name]['domain'] = '.leonexus.nl'

# If you want two or more applications to share sessions, set masterapp 
# to the name of the master application.

session.connect(request, response, masterapp="controlpanel")



I wonder whether I need both lines of code or just one of them, and whether
there is a specific order to place them in.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/57ec480c-042d-4679-93ee-4460b633fbdan%40googlegroups.com.


[web2py] Re: web2py hosting

2020-10-13 Thread 'Annet' via web2py-users
Hi Jose,

You're right no regrets at all. Just like you I very much appreciate their 
willingness to
help you solve the problems you run into when deploying your applications.

Annet



Op dinsdag 13 oktober 2020 om 08:51:21 UTC+2 schreef Jose C:

> Hi Annet,  
>
> Just FYI, I'm going on 18 months now with Opalstack and couldn´t be 
> happier.  Running multiple web2py (and other) apps on servers in US and EU, 
> hosted email, etc. with the same access and levels of control I'd had on 
> WF.  And most importantly, always the same incredible customer focus and 
> willingness to help that originally made WF famous, that is, until their 
> encounter with the Borg/GD  ;)
>
> I doubt you'll have any regrets,
>
> Jose
>
>
>
>
> On Saturday, 10 October 2020 at 17:07:20 UTC+1 Annet wrote:
>
>> Hi Antonio,
>>
>> I came across your post, and thought I'd share my experience with 
>> Opalstack.
>>
>> I am a web developer not a server administrator, I hosted at Webfaction 
>> because their
>> support people were very patient and helpful. After joining forces with 
>> GD support no
>> longer stands out from the crowd.
>>
>> Last week I signed up with Opalstack, https://www.opalstack.com/ and I 
>> am glad I did, 
>> great support and a simple but powerful control panel. One of the former 
>> WF support 
>> people wrote a web2py install script which got me up and running in no 
>> time.
>>
>> Hope this was helpful,
>>
>> Annet V.
>>
>> Op vrijdag 22 mei 2020 om 09:45:12 UTC+2 schreef Ramos:
>>
>>> I´m a webfaction long time user and from another post here i got worried 
>>> about the godaddy acquisition.Eventually webfaction may die in a short term 
>>> period.
>>>
>>> Can you recommend a good alternative? 
>>> Can you share your experience?
>>>
>>> Opalstack
>>> pythonanywhere
>>>
>>> others ?
>>>
>>> regards
>>> António
>>>
>>

-- 
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/349b3852-ff30-4416-b2c1-ff1466736f9bn%40googlegroups.com.


[web2py] Re: web2py hosting

2020-10-10 Thread 'Annet' via web2py-users
Hi Antonio,

I came across your post, and thought I'd share my experience with Opalstack.

I am a web developer not a server administrator, I hosted at Webfaction 
because their
support people were very patient and helpful. After joining forces with GD 
support no
longer stands out from the crowd.

Last week I signed up with Opalstack, https://www.opalstack.com/ and I am 
glad I did, 
great support and a simple but powerful control panel. One of the former WF 
support 
people wrote a web2py install script which got me up and running in no time.

Hope this was helpful,

Annet V.

Op vrijdag 22 mei 2020 om 09:45:12 UTC+2 schreef Ramos:

> I´m a webfaction long time user and from another post here i got worried 
> about the godaddy acquisition.Eventually webfaction may die in a short term 
> period.
>
> Can you recommend a good alternative? 
> Can you share your experience?
>
> Opalstack
> pythonanywhere
>
> others ?
>
> regards
> António
>

-- 
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/0b120377-0237-48cb-a6e1-0204a4c13735n%40googlegroups.com.


[web2py] Re: How to automatically reset or hide drop down menus in navbar

2020-10-01 Thread 'Annet' via web2py-users
http://web2py.com/book
 
uses a script named web2py_bootstrap.js

// this code improves bootstrap menus and adds dropdown support
jQuery(function(){
  jQuery('.nav>li>a').each(function(){
if(jQuery(this).parent().find('ul').length)
  
jQuery(this).attr({'class':'dropdown-toggle','data-toggle':'dropdown'}).append('');
  });
  jQuery('.nav li li').each(function(){
if(jQuery(this).find('ul').length)
  jQuery(this).addClass('dropdown-submenu');
  });
  function adjust_height_of_collapsed_nav() {
var cn = jQuery('div.collapse');
if (cn.get(0)) {
var cnh = cn.get(0).style.height;
if (cnh>'0px'){
cn.css('height','auto');
}
}
  }
  function hoverMenu(){
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
adjust_height_of_collapsed_nav();
mi = jQuery(this).addClass('open');
mi.children('.dropdown-menu').stop(true, 
true).delay(200).fadeIn(400);
}, function(){
mi = jQuery(this);
mi.children('.dropdown-menu').stop(true, 
true).delay(200).fadeOut(function(){mi.removeClass('open')});
});
  }
  hoverMenu(); // first page load
  jQuery(window).resize(hoverMenu); // on resize event
  jQuery('ul.nav li.dropdown 
a').click(function(){window.location=jQuery(this).attr('href');});
});


I think this adds the support you're looking for.


Annet

Op donderdag 1 oktober 2020 om 07:42:22 UTC+2 schreef Octavio:

> I'd like to make the dropdown menus included in the navbar (response.menu 
> in models/menu.py) at the top of each page either disappear when no longer 
> hovered over or timeout where the menu goes away after n seconds after no 
> longer hovered over.. Currently, by default, mine drop when I click on them 
> and stay dropped until I click somewhere else on the page or on an item in 
> the menu.
>
> For example, the book (http://web2py.com/book) has the Books dropdown 
> menu which drops on hover and then goes away immediately after you stop 
> hovering over it. 
>
> How can I do this?
>
> TY for the 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/38c2cac2-b0a7-49de-bd08-3b2ba6c4b4c2n%40googlegroups.com.


[web2py] Re: Setting a default value for a reference field

2020-09-19 Thread 'Annet' via web2py-users
I wonder why the IS_IN_DB() validator doesn't suit your needs.

I have a field day:

Field('day', 'reference cal_day', default=None, required=True, 
requires=IS_IN_DB(db, 'cal_day.id', '%(id)s %(name)s',  zero='Select a day'), 
ondelete='RESTRICT', notnull=True, label='Day *'),

Doesn't zero = '*Whats your place of operations?'* do what you want?


Annet
Op vrijdag 18 september 2020 om 12:41:11 UTC+2 schreef mostwanted:

>
> Is there a way to create a placeholder for a reference field?
> e.g:
> {{
> *Field('place', 'reference locations', label=SPAN('Place of operations'), 
> widget=lambda field, value: SQLFORM.widgets.reference.widget(field, value, 
> _placeholder="Whats your place of operations?"))*
> }}
>
> 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/3d69119b-4205-4400-bcba-687881a08fe0n%40googlegroups.com.


[web2py] Re: formatting a field in SQLTABLE

2020-08-24 Thread 'Annet' via web2py-users
Maybe use the represent attribute in the field constructor

db.table.field.represent = lambda val, row: function())

and use:

locale.format('%10.2f', val, grouping=True)


Best,

Annet
Op maandag 24 augustus 2020 om 07:43:15 UTC+2 schreef Vlad:

> I've got the rows to be displayed in a table:
>
> rows = db(query).select(db.orders.total.sum().with_alias('Total'), 
> ...)
>
> and using 
>
>  SQLTABLE(rows)
>
> to show the data. 
>
> How can I format this total.sum() in the SQLTABLE? More specifically, this 
> total is the total amount in cents, and I need to display it in dollars, 
> i.e. divide by 100 and append with '$'. 
>
> It's easy to do it if using TABLE and iterating over rows, but SQLTABLE is 
> pretty convenient to use, so I'd like to stick with it. 
>
> Is there a way to customize the fields like this in SQLTABLE ?
>
>
>
>
>

-- 
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/73a81e2c-4392-4cbd-880b-85d334bee95bn%40googlegroups.com.


[web2py] Re: Nested menu item

2020-08-18 Thread 'Annet' via web2py-users
Hi,

I've got a two level menu, however, calling 

{{=MENU(response.app_menu)}}

doesn't render a Bootstrap 4 menu like your resulting html code. It
renders something pretty ugly:


  



  Our network
  Networks we joined
 
   
  
 


Do you have any idea how to solve this issue?

Kind regards,

Annet

Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:

> Missing something basic, but seems to me that the following code should 
> result in nested menu:
>
> response.menu = [['One', False, 'link1',
>   [
> ['Two', False, None,
>['Three', False, 'link3']
> ]
>   ]
>  ]
> ]
>
> "One" menu items contains "two", as it should, but "two" comes out to be a 
> simple menu item, not containing "three" in it. What's missing?? How do I 
> make nested sub-menu items? 
>
> Here is the resulting html, where "three" sub-item is not even present: 
>
> 
>  
> One
>  
>   Two
>  
> 
>
>
>
>
>

-- 
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/a268c377-cf99-4260-a337-6590eb9a271en%40googlegroups.com.


[web2py] Re: modules: NameError("name 'reload' is not defined",)

2020-08-17 Thread 'Annet' via web2py-users
I reported the same problem some time ago.

When I edit a module and save it I get this nameError. Since I am
importing the modules into other applications I have to restart web2py
everytime I edit a module.

Further more the module are no longer compiled on first use, which
I also find very annoying.

Annet

Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:

> same error, though with a lot more than 3 lines
>
> On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com 
> wrote:
>
>>
>> I have an issue saving my modues with the last version of web2py.
>> Is there something I do wrong?
>>
>> Context: Ubuntu 18.04 / web2py version 2.20.4 / python 3.6.9
>>
>> How to reproduce this issue (a bug??) with a simple example:
>>
>> In the applications examples, create a module (for instance empty.py)
>>
>> Then open it, 
>> => url: 
>> 127.0.0.1:8000/admin/default/edit/examples/modules/empty.py?id=modules__empty__py
>> The file contains 3 lines:
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> from gluon import *
>>
>> do not change anything and save it (ctrl + S)...
>>
>> => Since the last version, I get the following message:
>>
>>  Impossible de recharger le module car:
>>  NameError("name 'reload' is not defined",)
>>
>> Thanks for any advise...
>>
>

-- 
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/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%40googlegroups.com.


[web2py] Re: What happened to OptionsWidget

2020-08-13 Thread 'Annet' via web2py-users
Hi,

Thanks for your reply. I didn't alter anything in the code,
however, I moved the widget to another module, in
which I forgot to import sqlhtml.py

You reply pointed me in that direction.

Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5995f660-7703-4b10-be8d-f43d0acf8679o%40googlegroups.com.


[web2py] What happened to OptionsWidget

2020-08-11 Thread 'Annet' via web2py-users
I coded a custom radio widget:

def inlineRadioOptions(field, value, **attributes):
   ...

attr = OptionsWidget._attributes(field, {}, **attributes)
attr['_class'] = attr.get('_class', 'web2py_radiowidget')

   ...

return TAG[''](*opts, **attr)

After upgrading to web2py 20.x this no longer works.
I get an error on;

OptionsWidget

I guess the OptionsWidget has been replaced, the problem is
I cannot figure out by what.

I hope one of you knows,


Best,

Annet 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1246b368-3d2e-4b49-9e8a-eb82cbcacabco%40googlegroups.com.


[web2py] Re: How do I prevent going back to previous page after user is logged out?

2020-07-31 Thread 'Annet' via web2py-users
What about the following?

auth.settings.login_onaccept = lambda form: __on_login()
auth.settings.logout_onlogout = lambda user: __on_logout()


def __on_login():
# whatever you want to do
return None


def __on_logout():
# whatever you want to do
return None

To solve your problem use the request object to redirect


HTH,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e80c749a-cc2e-496f-89bd-7de4c0f1ef2fo%40googlegroups.com.


[web2py] Re: Autocomplete JSON output format.

2020-07-28 Thread 'Annet' via web2py-users
Hi Jose,

Thanks for you reply.

Following your suggestion, and making one adjustment:

return dict(suggestions=json.dumps(countries))

the controller/function jsonsource/name_autocomplete now returns a correct 
list:

["first_option", "second_option", "third_option"]


In layout.html before the closing body selector I've got:


$(document).ready(function() {
  $(function() {$("#dummy_table_name").autocomplete({serviceUrl: 
"{{=URL('jsonsource', 'name_autocomplete')}}", minChars: 2});});
});



When typing some name in the auto complete field I get the following error:

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 
of the JSON data
jQuery 6
d
currentRequest
c
fireWith
l
o


When I use a local look up like this:


$(document).ready(function() {
  var suggestions =  ["first_option", "second_option", "third_option"]
  $(function() {$("#dummy_table_name").autocomplete({lookup: suggestions, 
minChars: 2});});
});


the autocomplete works, however, I need the ajax lookup, I hope you can 
help me
solve this one last issue.


Kind regards,

Annet


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b772bf5e-4c8f-416c-95b1-aeb737f34ae2o%40googlegroups.com.


[web2py] Autocomplete JSON output format.

2020-07-26 Thread 'Annet' via web2py-users
I've got this rows object as the source of an autocomplete function:

rows = db(query).select(db.vtx_vertex.name, left=left, distinct=True, 
orderby=db.vtx_vertex.name).as_list()
result = [r['name'] for r in rows]
return response.json(result)


This is the autocomplete I'd like to use::
https://www.devbridge.com/sourcery/components/jquery-autocomplete/#


It returns this:

0:"first option"
1:"second option"
2:"third option"

What I need it to return is this:

"suggestions": [
{ "value": "United Arab Emirates", "data": "AE" },
{ "value": "United Kingdom",   "data": "UK" },
{ "value": "United States","data": "US" }
]


Or this:

"suggestions": ["United Arab Emirates", "United Kingdom", "United States"]


Anyone using this js or knowing how to format the json output correctly?



Kind regards,

Annet




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/727bb0a3-b683-4b90-a6c2-eccaf4372b9co%40googlegroups.com.


[web2py] Re: Having a user belong to 2 groups with different priviledges

2020-06-18 Thread 'Annet' via web2py-users
I am not sure I completely understand what you want, but what about groups
Region 1, Region 2, HR and Admin.

User 1 has membership Region1 and HR
User 2 has membership Region2 and HR

In your code you could have

if auth.has_membesrhip(Region1) and auth.has_membesrhip(HR)
   tasks ...
elif auth.has_membesrhip(Region2) and auth.has_membesrhip(HR)
   task ...

Maybe this points you in the direction of a solution



Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6b0fb446-6a01-4367-ba3b-994392c84177o%40googlegroups.com.


[web2py] Re: invalid literal for long() with base 10: when linking 2 tables

2020-06-14 Thread 'Annet' via web2py-users
Hi,

I think you'd better reference your store_registration table once by id in 
the temperature table.

Field('store_registration_id', 'reference store_registration', writable=
False),

In that way you comply with the rule of single_point-of_definition. The way 
you define your temperatures
table, when a user updates his contact_number it has to cascade to the 
temperatures table.

What you want can be achieved by 'reference store_registration' you could 
remove the reference and
replace it with an IS_IN_DB() validator for instance for Cell_No:

IS_IN_DB(db, 'store_registration.contact_number', '%(contact_number)s')

and then write your own ON UPDATE CACADE functions


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0b0dd14b-9e77-4df2-8ce0-58a00baf0c79o%40googlegroups.com.


[web2py] Re: Bootstrap 4 and MENU helper problem

2020-06-11 Thread 'Annet' via web2py-users
Hi Val,

Thanks for your reply.

I'll do as you suggest.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2a0e644d-3fd1-4aed-8cb8-bf67baa37e4ao%40googlegroups.com.


[web2py] datatable_list = request.controller in ['network', 'calendar'] True or False

2020-06-02 Thread 'Annet' via web2py-users
In web2py 2.14 and python 2.7 the following line of code

datatable_list = request.controller in ['network', 'calendar'] or 
request.function in ['search_group', 'search_supplier']

enabled me to do the following in an view:

{{if datatable_list:}}
DO SOMETHING
{{pass}}

In web2py 2.19 and python 3.7 this no longer works, does anyone know what
the alternative syntax is?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4ef4972d-4c76-48cb-ada9-3f14599f7df4%40googlegroups.com.


[web2py] Re: Bootstrap 4 and MENU helper problem

2020-06-02 Thread 'Annet' via web2py-users
I got a bit further solving this issue adjusting web2py-bootstrap4.js

$(function() {
$(".navbar-nav ul.dropdown-menu").each(function() {
  var toggle = jQuery(this).parent();
  if (toggle.parent().hasClass("navbar-nav")) {
toggle.attr("data-w2pmenulevel", "l0")
toggle.addClass("nav-item dropdown");
toggle.children("a")
  .addClass("nav-link dropdown-toggle")
  .append(' ')
  .attr("data-toggle", "dropdown");
var element = jQuery(this).children();
element.addClass("dropdown-item")
  } else {
toggle.addClass("dropdown-submenu").removeClass("dropdown");
  };
});
  });

These adjustments render the following menu:


> 
> 
> 
> 
> 
> 
> 
> 
> 
>


The issue left is the bit in red, I haven't been able to figure out how to 
add the
class to the A element.

Furthermore I don't understand why web2py reverses the order of the bit in 
orange,
no matter the order in which I write the code, I always get class="dropdown 
nav-item"
instead of class="nav-item dropdown"

I hope anyone can help me solve the last bit of this problem.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/07818cbf-aa5c-4c24-ab08-2bde763a7d72%40googlegroups.com.


[web2py] Bootstrap 4 and MENU helper problem

2020-05-29 Thread 'Annet' via web2py-users
In Bootstrap 4 the MENU helper no longer generates the Bootstrap navbar

{{=MENU(response.menu, _class='nav navbar-nav', ul_class='dropdown-menu', 
li_class='dropdown')}}

This worked in Bootstrap 3, in Bootstrap 4 it no longer works this is what 
web2py generates:











In Bootstrap 4 to work correctly web2py should generate this:












Is there a way to generate a Bootstrap 4 navbar in web2py 2.19.1 or is 
there a way to set the
right arguments in this line of code:

{{=MENU(response.menu, _class='nav navbar-nav', ul_class='dropdown-menu', 
li_class='dropdown')}}



Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3c9aa580-b7a9-4555-b2d8-85d72c754571%40googlegroups.com.


[web2py] Re: __pycache__

2020-05-24 Thread 'Annet' via web2py-users
Hi Jose,

Thanks for your reply, the link to the discussion on stackoverflow
was very helpful.

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/188172a2-1ea2-45d3-b35f-02fb196d0f62%40googlegroups.com.


[web2py] Re: CSS URL Helper

2020-05-24 Thread 'Annet' via web2py-users
When you store the css code in a view e.g. css.html and
include it in a view you can do:

background-image: url('{{=URL('static','images/headerback.jpg')}}');


An other option is the following:


  
  



Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9fb4f90e-f147-45f3-b1de-4cc3f9093f69%40googlegroups.com.


[web2py] Re: LOAD in web2py 2.14 and 2.19.1

2020-05-20 Thread 'Annet' via web2py-users
Hi Jim,

Thanks for your reply. I did what you advised me to do.
It's not a python 3.7 issue. I think it has something to do
with modules not being reloaded after they have been edited.

404 NOT FOUND

wasn't pointing in that direction.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ce81aa55-e605-4e3c-9e90-57bb205f7c33%40googlegroups.com.


[web2py] 2.19.1 cm-s-twilight

2020-05-19 Thread 'Annet' via web2py-users
I wonder whether it is possible to change the editor's
background colour and colour from cm-s-twilight to
a light background colour.

The dark background doesn't work well under certain
light conditions in the room I'm working in.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1ec4030b-4004-4386-b899-4faf73009cdd%40googlegroups.com.


[web2py] Re: Displaying images with their title in a for statement in an image slideshow

2020-05-19 Thread 'Annet' via web2py-users
Have a look at the html of the Bootstrap 4.5 carousel

https://getbootstrap.com/docs/4.5/components/carousel/

maybe that points you in the right direction.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/38e257d2-6d21-4a65-9618-6711fc6a11bd%40googlegroups.com.


[web2py] LOAD in web2py 2.14 and 2.19.1

2020-05-18 Thread 'Annet' via web2py-users
After upgrading to web2py 2.19.1 and switching to python 3.7 the
following no longer works.

I have a controller main with an index function that builds a
scaffold with header, content and footer.

The index function returns a variable:

content = LOAD('home', 'index', args=[vertexid, typeid, viewtypeid, 
groupid, plural],
 ajax=True, target='main-content', content='')


The view main/index.html extends layout.html and contains:

{{=content}}

The view home/index.load extends content/main.html which contains
{{include}} and a few includes like this one {{include 'content/hero'}}


This used to work well, in web2py 2.19 .1 it results in a 404 NOT FOUND 
error

404 NOT FOUND


Any ideas why this no longer works?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/80cd9fd9-7598--bd51-441dafcd5ae8%40googlegroups.com.


[web2py] __pycache__

2020-05-13 Thread 'Annet' via web2py-users
This morning I noticed a directory /init/__pycache__ containing the file
__init__.cpython-37.pyc

It caused web2py hanging on start up, after removing the directory
and the file web2py did start up.

I just wonder where the directory and the file came from. I don't
think I compiled the init application.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/62e054cc-e7b1-4fa4-94a2-bd8cbd0a94af%40googlegroups.com.


[web2py] Re: two web2py servers and sessions in redis

2020-05-08 Thread 'Annet' via web2py-users
I had a similar problem, Anthony explained to me that I should
share the session cookie among all subdomains under the
main domain:

response.cookies['session_id_A']['domain'] = '.example.com'


I hope this points you in the right direction to solve the issue.


Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8ccd4810-9290-44aa-b997-e234fc3afca3%40googlegroups.com.


[web2py] Re: Autocomplete widget filter values

2020-05-05 Thread 'Annet' via web2py-users
Hi Anthony,

I am rebuilding an application that uses the jQuery UI autocomplete widget.

In the view I have the following code:


$(function() {$("#no_table_name").autocomplete({source: "{{=URL('jquery', 
'name_autocomplete')}}", minLength: 2});});


name_autocomplete is a function in the jquery controller:

def name_autocomplete():
left = [db.app_settings.on(db.vtx_vertex.id==db.app_settings.vertexID)]
rows = db((db.vtx_vertex.name.contains(request.get_vars.term, 
case_sensitive=False)) &
  ((db.vtx_vertex.typeID.belongs(ORGANIZATIONID, IOTHINGID)) |
  ((db.vtx_vertex.typeID==PERSONID) & 
(db.app_settings.viewtypeID>ZEROID) &
   
(db.app_settings.openID==PUBLIC.select(db.vtx_vertex.name, left=left, 
distinct=True,
  
orderby=db.vtx_vertex.name).as_list()

result = [r['name'] for r in rows]
return response.json(result)


I'd like to use SQLFORM.widgets.autocomplete(request, db.vtx_vertex.name, 
limitby=(0,10), min_length=2, db=db(Filter))


I don't know how to code the filter to give me the same list of values.

Is it possible for Filter to call name_autocomplete() in the jquery 
controller.



Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4e85a328-c1de-46df-9b5c-632b865e4e83%40googlegroups.com.


[web2py] Menu no longer renders {{=MENU(response.menu)}}

2020-04-30 Thread 'Annet' via web2py-users
In web2py 2.14 I had the following code in menu.py

response.menu = [
(CAT(SPAN('Log in', _class="btn btn-primary")), False, 
URL('controlpanel', 'default', 'user', args='login', scheme=SECURESCHEME, 
host=CONTROLPANELDOMAIN)),
(CAT(SPAN('Open account', _class="btn btn-success")), False, 
URL('default', 'static', args='account'))]

and in the view:


{{=MENU(response.menu)}}



In web2py 2.19 this code no longer renders the menu


  {{=MENU(response.menu)}}


is being rendered as:


 


What's wrong with my reponse.menu code that causes it to o longer
render?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bef476ef-cd80-4f11-8a0f-005dd27ca718%40googlegroups.com.


[web2py] Re: Server error when accessing admin

2020-04-30 Thread 'Annet' via web2py-users
Hi Ian,

I do have a copy of the script, it's a bit old, but I'll attach
it anyway, maybe it's of help.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/07767cc2-5691-4c76-b310-bd409b735ea2%40googlegroups.com.
#!/bin/env python2.7

"""
Web2py install/uninstall script for WebFaction using the latest stable source
code from http://www.web2py.com/examples/static/web2py_src.zip.

This installs web2py for Python 2.7, served via Nginx 1.8.0 and uWSGI 2.0.10.

The web2py files are found in ~/webapps//web2py.

IMPORTANT: Remember to set the Admin password in the extra_info field.

Caveats
---

* Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. Instead, it must be mounted to the website root,
e.g. http://domain.com/

* For the administrative interface to work, the web2py app must be mounted to and
accessed through an HTTPS-enabled site. You would usually mount the app to two
websites - HTTPS-disabled one for normal access, and HTTPS-enabled one for admin
logins.

"autostart": not applicable
"extra info": Password for administrative interface
"""

import sys
import xmlrpclib

def hash_password(plaintext):
"""Standardized method for hashing password"""
from hashlib import md5
return md5(plaintext).hexdigest()

def create(server, session_id, account, username, app_name, autostart, extra_info, password):
# Create application.
app = server.create_app(session_id, app_name, 'custom_app_with_port')
appname = app['name']
port = app['port']

# install Nginx
cmd = """
mkdir -p {bin,nginx,src,tmp,lib/python2.7}
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://nginx.org/download/nginx-1.8.0.tar.gz'
tar -xzf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure \
  --prefix=/home/%(username)s/webapps/%(appname)s/nginx \
  --error-log-path=/home/%(username)s/logs/user/error_%(appname)s.log \
  --http-log-path=/home/%(username)s/logs/user/access_%(appname)s.log \
  > /dev/null
make > /dev/null
make install > /dev/null
""" % locals()
server.system(session_id, cmd)

# install uwsgi
cmd = """
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://projects.unbit.it/downloads/uwsgi-2.0.10.tar.gz'
tar -xzf uwsgi-2.0.10.tar.gz
cd uwsgi-2.0.10
python2.7 uwsgiconfig.py --build > /dev/null
mv ./uwsgi /home/%(username)s/webapps/%(appname)s/bin
ln -s /home/%(username)s/webapps/%(appname)s/nginx/sbin/nginx /home/%(username)s/webapps/%(appname)s/bin

mkdir -p /home/%(username)s/webapps/%(appname)s/nginx/tmp/nginx/client

cat << EOF > /home/%(username)s/webapps/%(appname)s/nginx/conf/nginx.conf
worker_processes  1;

events {
worker_connections  1024;
}

http {
access_log  /home/%(username)s/logs/user/access_%(appname)s.log combined;
error_log   /home/%(username)s/logs/user/error_%(appname)s.log  crit;

include mime.types;
sendfile on;

server {
listen 127.0.0.1:%(port)d;

location / {
include uwsgi_params;
uwsgi_pass unix:///home/%(username)s/webapps/%(appname)s/uwsgi.sock;
}
}
}
EOF
""" % locals()
server.system(session_id, cmd)

# install web2py
cmd = """
cd /home/%(username)s/webapps/%(appname)s/src
wget -q 'http://www.web2py.com/examples/static/web2py_src.zip'
cd ..
unzip -qq src/web2py_src.zip
cp ./web2py/handlers/./wsgihandler.py ./web2py/
""" % locals()
server.system(session_id, cmd)

# create paramaters_80.py
assert extra_info
server.system(session_id, "echo 'password=\"%s\"' > web2py/parameters_80.py" % hash_password(extra_info))

# make the start, stop, and restart scripts
cmd = """
cat << EOF > /home/%(username)s/webapps/%(appname)s/bin/start
#!/bin/bash

# Start uwsgi
/home/%(username)s/webapps/%(appname)s/bin/uwsgi \\
  --uwsgi-socket "/home/%(username)s/webapps/%(appname)s/uwsgi.sock" \\
  --master \\
  --workers 1 \\
  --max-requests 1 \\
  --harakiri 60 \\
  --daemonize /home/%(username)s/logs/user/uwsgi_%(appname)s.log \\
  --pidfile /home/%(username)s/webapps/%(appname)s/uwsgi.pid \\
  --vacuum \\
  --chdir /home/%(username)s/webapps/%(appname)s \\
  --python-path /home/%(username)s/webapps/%(appname)s/lib/python2.7 \\
  --wsgi-file /home/%(username)s/webapps/%(appname)s/web2py/wsgihandler.py \\

# Start nginx
/home/%(username)s/webapps/%(appname)s/bin/nginx
EOF

cat << EOF > /home/%(username)s/webapps/%(appname)s/bin/stop

[web2py] Re: Server error when accessing admin

2020-04-30 Thread 'Annet' via web2py-users
Why didn't you use the web2py install/unstall script that webfaction 
provides?
It installs web2py served via nginx and uWSGI.

The script mentions 2 caveats:

Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. Instead, it must be mounted to the
website root, e.g. http://domain.com/

For the administrative interface to work, the web2py app must be
mounted to and accessed through an HTTPS-enabled site. You would
usually mount the app to two websites - HTTPS-disabled one for
normal access, and HTTPS-enabled one for admin logins


Kind regards,

Annet


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/759adea9-76fd-4ec9-b223-19b82e1d1d9d%40googlegroups.com.


[web2py] Re: How to customize "Invalid function/someview" ?

2020-04-30 Thread 'Annet' via web2py-users
I think routes_onerror = [] in routes.py is whar you're
looking for:

routes_onerror = [
   ,(r'*/404', r'/handler/default/on_404_error')
   ,(r'*/*', r'/handler/default/onerror')
]

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0c7cfbd8-9a1f-4f07-ae3e-b23c9731a038%40googlegroups.com.


[web2py] Re: Mac Catalina 10.15.4 - Cannot run web2py binary

2020-04-21 Thread 'Annet' via web2py-users
Hi Jon,

When I first ran web2py using python 2.7 on Mac OS X Catalina I got this 
error message:

DEPRECATION WARNING: The system version of Tk is deprecated and may be 
removed in a future release. Please don't rely on it. Set 
TK_SILENCE_DEPRECATION=1 to suppress this warning.
please visit:
http://127.0.0.1:8000/
starting browser...

And after about a minute web2py quit with this message:

Illegal instruction: 4


There are a lot of people on the internet who face this problem, but sofar
I have read no solution. I suspect it has something to do with Mac OS X
Catalina no longer supporting 32 bit?

I do know how to administrate my Mac, but when I am working as a web
developer I do not want to be distracted by the OS I am running ;-)
Hence I started using Homebrew. If you need the commands to get
web2py2 and python 3 working from source on Catalina, please let
me know. I'll post them.

Kind regards

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ce72e26d-769c-42de-a5c2-d9efcf244386%40googlegroups.com.


[web2py] Re: Mac Catalina 10.15.4 - Cannot run web2py binary

2020-04-21 Thread 'Annet' via web2py-users
I switched to web2py source code long ago, after buying a new mac mini with
Mac OS X Catalina I decided to switch to homebrew en pyenv, there are some
caveats but if you've sorted these out, it all works well.

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/90be0f94-cb80-43d0-a24f-50cc50f7cc8f%40googlegroups.com.


[web2py] Re: Getting an error that ends in "No driver of supported ones %s is available" % str(self.drivers) RuntimeError: No driver of supported ones ('psycopg2',) is available

2020-04-19 Thread 'Annet' via web2py-users
I had the same problem when installing web2py 2.19.1 on Mac OS X Catalina.

I eventually solved the problem running the following code:

Annets-Mini:~ me$ export PATH=/usr/local/Cellar/postgresql/12.1/bin/:$PATH
Annets-Mini:~ me$ export LDFLAGS="-L/usr/local/opt/readline/lib"
Annets-Mini:~ me$ export CPPFLAGS="-I/usr/local/opt/readline/include"
Annets-Mini:~ me$ export 
PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
Annets-Mini:~ me$ export 
LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
Annets-Mini:~ me$ pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4
Annets-Mini:~ me$

Your using Linux but maybe this information points you in
the right direction.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1246ad80-9788-499d-b9fc-68667766d176%40googlegroups.com.


[web2py] {{block head}}{{end}}

2020-04-18 Thread 'Annet' via web2py-users
What is the use of:

{{block head}}{{end}}

{{block page_js}}{{end page_js}}

In layout.html

I expected something like this:


{{block head}}
  all head elements here
{{end}}


But I obviously didn't get it :-(


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3eac4222-161e-45fc-86d3-c565c53bebbb%40googlegroups.com.


[web2py] auth.settings.extra_fields and on_define

2020-04-11 Thread 'Annet' via web2py-users
Is it possible to add the keyword argument on_define to
auth.settings.extra_fields['auth_user']


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e185a463-614b-4a79-9954-ccc64ea59ad3%40googlegroups.com.


[web2py] Re: web2py 2.19.1 is OUT

2020-04-10 Thread 'Annet' via web2py-users
In this version of web2py I have the following lines of code in db.py

from gluon.contrib.appconfig import AppConfig

configuration = AppConfig(reload=True)

When I add code to a module file and save the file I get the following 
error:

nameError(“name ‘reload’ is not defined”)


Why do I get this error?

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/01226251-e391-4112-961b-715b1d59b267%40googlegroups.com.


[web2py] on_define and IS_IN_DB()

2020-04-10 Thread 'Annet' via web2py-users
I am not sure I understand the following paragraph in the book:

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#on_define

I have lazy_table = true and a 
Field('vertex_id', 'reference vertex', requires=IS_IN_DB(db, 
'vtx_vertex.id', '%(id)s'))

In the book it says:

The simple requires values could be added to the Field definitions and the 
table would still be lazy.
However, requires which take a Set object as the first argument, such as 
IS_IN_DB, will make a query like 

db.sometable.somefield == some_value

which would cause sometable to be defined early. This is the situation 
saved by on_define.

Does this mean that I should put IS_IN_DB() in the on_define keyword 
argument?

on_define = lambda table: 
[table.vertex_id.set_attributes(requires=IS_IN_DB(db, 'vtx_vertex.id', 
'%(id)s')]


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/12ced8d4-e5d8-44ec-8082-13338ef8f0c2%40googlegroups.com.


[web2py] configuration.take() or configuration.get() and pool_size = 0 error

2020-04-08 Thread 'Annet' via web2py-users
In the online verson of the book it says:

a_config_value = myconf.take('example_section.example_key', cast=int)


http://web2py.com/books/default/chapter/29/13/deployment-recipes#AppConfig-module


In the db.py file in web2py 2.19 it says:

migrate_enabled=configuration.get('db.migrate')


What call should I use take() or get()


Furthermore when I set pool_size = 0 in appconfig.ini and in db.py in db = 
DAL()
I set pool_size=configuration.take('db.pool_size') this result in an error 
ticket.
When I click the link to the error ticket I get another error ticket etc. 
It seems
this has something to do with code in the admin app, since that's where the
tickets are stored. I have not been able to locate the code, but it has to 
do
with a < operator comparing a str and int.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/102e94e4-1681-4499-8ed1-c64dde1828a0%40googlegroups.com.


[web2py] Rocket error

2020-03-18 Thread 'Annet' via web2py-users
In web2py 2.18.5 on Mac OS X Catalina I get the following error
in the terminal:

ERROR:Rocket.Errors.Thread-10:Traceback (most recent call last):

  File "/Users/me/web2py/gluon/rocket.py", line 1288, in run
self.run_app(conn)

  File "/Users/me/web2py/gluon/rocket.py", line 1781, in run_app
self.environ = environ = self.build_environ(sock_file, conn)

  File "/Users/me/web2py/gluon/rocket.py", line 1601, in build_environ
request = self.read_request_line(sock_file)

  File "/Users/me/web2py/gluon/rocket.py", line 1339, in read_request_line
d = sock_file.readline()

  File "/Users/me/.pyenv/versions/3.7.6/lib/python3.7/socket.py", line 589, 
in readinto
return self._sock.recv_into(b)

ConnectionResetError: [Errno 54] Connection reset by peer

ERROR:Rocket.Errors.Thread-10:Tried to send "500 Server Error" to client 
but received socket error


Is there a fix for this issue?

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d4cd605a-566a-4c2a-b124-f59f63ae39a3%40googlegroups.com.


[web2py] BUG response.cookies and sessions2trash.py

2020-02-27 Thread 'Annet' via web2py-users
I scheduled cron to regularly trash the session in my web2py applications. 
this worked well
until I added this line of code to a model.py file;

response.cookies[response.session_id_name]['domain'] = '.leonexus.nl'

My scripts log any errors at ~my/logs/user/sessions2trash.log.
That file is full of lines like:

Traceback (most recent call last):
  File "/home/my/webapps/web2py/web2py/gluon/restricted.py", line 227, in 
restricted
exec ccode in environment
  File "applications/init/models/00_init_db.py", line 6, in 
response.cookies[response.session_id_name]['domain'] = '.mydomain.com'
KeyError: None

I know in python a KeyError is raised when a dictionary is accessed but the 
key requested is not in it.
However, I have no idea why the line of code interferes with calling 
/scripts/sessions2trash.py

I am working with web2py 2.14.5 and python 2.7
Hope someone can help me solve the issue.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ca03bcf7-2e00-4aee-a645-8ea01fd90f3b%40googlegroups.com.


[web2py] Re: Setting a default reference value as that of a specific group the logging in user is a member of

2020-02-25 Thread 'Annet' via web2py-users
I don't understand the use of field 'groups' and function 'get_groups()

I think you should use web2py's built in auth_ functionality: drop field
'groups' in both tables, link users and groups (each hotel its own group)
in the auth_membership table, and use this table to create a list of options
for the drop-down.

I hope this points you in the right direction to solve your problem


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bd2e0505-00f8-4403-9e3d-f89372e2f027%40googlegroups.com.


[web2py] Mail in separate application

2020-02-19 Thread 'Annet' via web2py-users
I have three applications all of which have mail functionality. Since this
gives a lot of dupliacte code I thought of moving all mail functionality
to its own mail application.

I have one masterapp controlpanel with the following code;

if not request.env.remote_addr in ['127.0.0.1', 'localhost']:
response.cookies[response.session_id_name]['domain'] = ".mydomain.org"


to which the other apps connect:

session.connect(request, response, masterapp="controlpanel")


the other apps already use the following code to check if a user is logged 
in:

if 'auth' in globals() and auth.is_logged_in():


At the moment all apps have the following setting:

mail = auth.settings.mailer


Is it possible to only have this code in the controlpanel application and 
have
the other apps check;

if 'mail' in globals():

and then use 'mail' to send mail?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/69a482ba-d468-4c76-9562-e25bdf47fbcc%40googlegroups.com.


Re: [web2py] Raspberry pi cannot connect to postgreSQL

2020-02-06 Thread 'Annet' via web2py-users
Thank you both for your replies.

@Massimiliano

Are you sure the user is *posgres* and not *postgres*? :-D 
>

 
I've checked the connection string over and over again
and just did not spot the missing 't'

Thank you so much for your help!


Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/32637801-df9c-4f4d-8c10-3d816c30d0a6%40googlegroups.com.


[web2py] Raspberry pi cannot connect to postgreSQL

2020-02-06 Thread 'Annet' via web2py-users
I just installed psycopg2 to connect to my PostgreSQl database
on Raspberry Pi 4. When starting web2py I get the following error
ticket:


Traceback (most recent call last):
  File "/home/pi/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/pi/web2py/applications/init/models/00_init_db.py" 
, line 42, 
in 
ignore_field_case = myconf.get('db.ignore_field_case'))
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 174, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 473, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 446, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/base.py", line 60, in 
__call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
155, in __init__
self.reconnect()
  File "/home/pi/web2py/gluon/packages/dal/pydal/connection.py", line 104, in 
reconnect
self.connection = f()
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
152, in connector
return self.driver.connect(**driver_args)
  File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 126, 
in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: FATAL:  password authentication failed for user "posgres"
FATAL:  password authentication failed for user "posgres"



This is the connection string:

uri   = postgres://posgres:password@localhost:5432/database_name


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c677044e-7bc0-432b-a700-0af961ebfc82%40googlegroups.com.


[web2py] raspberry pi starting browser xdg-open issue and error ticket postgreSQL

2020-02-06 Thread 'Annet' via web2py-users
Since I am  not able to run web2py on mac os x Catalina I installed
PostgreSQL and web2py on a raspberry  pi 4.

When I start web2py using the built in server I get the following error:

Database drivers available: sqlite3, imaplib, pymysql, pg8000
please visit:
http://127.0.0.1:8000/
starting browser...
/usr/bin/xdg-open: 801: /usr/bin/xdg-open: : Permission denied


Furthermore I get an error ticket:


Traceback (most recent call last):
  File "/home/pi/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/pi/web2py/applications/init/models/00_init_db.py" 
, line 42, 
in 
ignore_field_case = myconf.get('db.ignore_field_case'))
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 174, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 473, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/pi/web2py/gluon/packages/dal/pydal/base.py", line 446, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/base.py", line 60, in 
__call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
155, in __init__
self.reconnect()
  File "/home/pi/web2py/gluon/packages/dal/pydal/connection.py", line 104, in 
reconnect
self.connection = f()
  File "/home/pi/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
152, in connector
return self.driver.connect(**driver_args)
  File "/home/pi/web2py/gluon/contrib/pg8000/__init__.py", line 336, in connect
user, host, unix_sock, port, database, password, ssl)
  File "/home/pi/web2py/gluon/contrib/pg8000/core.py", line 1282, in __init__
raise self.error
ProgrammingError: ('FATAL', '28P01', 'password authentication failed for user 
"posgres"')




I hope you can help me solve the issues

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/22e54b64-2191-4c56-b4c0-7db505f19ed8%40googlegroups.com.


[web2py] No driver of supported ones ('psycopg2',) is available

2020-01-20 Thread 'Annet' via web2py-users
Last week I upgraded my development environment from Mac OS X Mavericks - 
Python 2.7 - Web2py 2.14.5 to
Mac OS X Catalina - Python 2.7 - Web2py 2.18.5, since then I have the 
following issue:


 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"/web2py/gluon/packages/dal/pydal/base.py", line 457, in __init__ 
self._adapter = adapter(**kwargs) File 
"/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 27, in 
__call__ return AdapterMeta.__call__(cls, *args, **kwargs) File 
"/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 39, in 
__call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File 
"/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 54, in 
__init__ driver_args, adapter_args, do_connect, after_connection) File 
"/web2py/gluon/packages/dal/pydal/adapters/base.py", line 369, in __init__ 
super(SQLAdapter, self).__init__(*args, **kwargs) File 
"/web2py/gluon/packages/dal/pydal/adapters/base.py", line 50, in __init__ 
self.find_driver() File 
"/web2py/gluon/packages/dal/pydal/adapters/base.py", line 101, in 
find_driver str(self.drivers)) RuntimeError: No driver of supported ones 
('psycopg2',) is available 


I have psycopg2 installed in the python directory 
/Library/Python/2.7/site-packages/ that is not where web2py expects it to 
be, is there a way to solve this issue?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cd4dd9e1-c31e-4f7f-818c-230a838d16dc%40googlegroups.com.


[web2py] Database drivers available does not show psycopg2

2019-12-20 Thread 'Annet' via web2py-users
On Mac OS X Catalina with psycopg2 installed in the 
/Python/2.7/site-packages web2py does not find
the psycopg2 driver:

Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000

It did on lower versions of Mac OS X, is there a way to solve this issue?


Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/05b1983e-e8dd-4598-82d3-d5dbda4df3b9%40googlegroups.com.


[web2py] Re: Is it possible to load older web2py binaries for Mac?

2019-12-19 Thread 'Annet' via web2py-users
Hi Jarrod,

I also have an issue after upgrading to Mac OS X Catalina see this post for 
Massimo's answer:

https://groups.google.com/forum/?fromgroups=#!topic/web2py/431xgrgLkn0


Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f66a0cda-54d2-46d3-801b-8407e2003412%40googlegroups.com.


[web2py] Re: Illegal instruction 4

2019-12-06 Thread 'Annet' via web2py-users
Hi Leonel,

Thanks for your reply.

I am already running Web2py from source and I am using PostgreSQL 12.
Seems like more people are having the same problem both on Windows
and Mac. so far I haven't read a plausible solution.

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/63086d9a-ee7b-4c23-b82c-a24befc02f8b%40googlegroups.com.


[web2py] Illegal instruction 4

2019-12-05 Thread 'Annet' via web2py-users
Last week I upgraded my development environment from Mac OS X Mavericks - 
Python 2.7 - Web2py 2.14.5 to
Mac OS X Catalina - Python 2.7 - Web2py 2.14.5, since then I have the 
following issue:

Created by Massimo Di Pierro, Copyright 2007-2019
Version 2.14.5-stable+timestamp.2016.04.14.03.26.16
Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000
DEPRECATION WARNING: The system version of Tk is deprecated and may be 
removed in a future release. Please don't rely on it. Set 
TK_SILENCE_DEPRECATION=1 to suppress this warning.
please visit:
http://127.0.0.1:8000/
starting browser...
Illegal instruction: 4

It is nearly impossible to work with Web2py, when I start the server, after 
a few minutes Python quits with the Illegal Instruction 4 error.

Is there a way to fix this issue?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bd03c091-117a-44c0-ad0b-7c1e17c50065%40googlegroups.com.


[web2py] Re: Validator IS_NOT_IN_DB not working | web2py

2019-10-18 Thread 'Annet' via web2py-users
What about


form = SQLFORM()
if form.process(...).accepted



instead of

form = SQLFORM().process()
if form.accepted:


Best,
Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c2a66fcc-0068-4d92-ad5d-e64d93a1292c%40googlegroups.com.


[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-08 Thread 'Annet' via web2py-users
Hi Villas,

Will your solution still work when you change the value of role in the 
auth_membership table? In your mygroupdict you define the role values 
again, so that there is no single point of definition.

I may be wrong but isn't that something to keep in mind when using your 
solution? 


Best Annet 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4008cc05-be03-40aa-bc6b-7038612bf327%40googlegroups.com.


[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-07 Thread 'Annet' via web2py-users
Use IS_IN_DB()

   ids = [1,3,5]
>


db.auth_membership.group_id.requires = 
IS_IN_DB(db(db.auth_group.id.belongs(ids)), 'auth_group.id', '%(role)s')


Best,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e4f903f6-e10f-4368-96ba-0f69919a4fd7%40googlegroups.com.


[web2py] Re: Can't connect to MySQL

2019-09-10 Thread 'Annet' via web2py-users
According to the book the connection string for MySql is:

mysql://username:password@localhost/test?set_encoding=utf8mb4

Maybe adding the TCP port solves the issue:

mysql://username:password@localhost:13306/test?set_encoding=utf8mb4


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c65717e1-9bb3-4aee-820a-684bc3319964%40googlegroups.com.


[web2py] Re: Custom form errors style

2019-08-23 Thread 'Annet' via web2py-users
 To diasble it:

if form.accepts(..., hideerror=False):


to restyle it, restyle:

.error


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b476d921-e78d-4d96-9962-b6601bc6791a%40googlegroups.com.


[web2py] Re: How to stopped redirection to user/login.html

2019-08-21 Thread 'Annet' via web2py-users
What about:

auth.settings.on_failed_authentication = lambda url: redirect(url)


That is what the book says changing the default behaviour.


Kind regards,

Annet



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/20281f00-71cc-403d-8e92-fdcac1d8f574%40googlegroups.com.


[web2py] Re: web3py -> py4web

2019-08-21 Thread 'Annet' via web2py-users


> python3 setup.py install
>

I installed py4web from source:

git clone https://github.com/web2py/py4web.gitcd py4web
python3 -m pip install -r requirements.txt
python3 setup.py install


Running the last statement gives the following errors:

byte-compiling 
build/bdist.macosx-10.9-x86_64/egg/py4web/utils/auth_plugins/saml2_plugin.py 
to saml2_plugin.cpython-37.pyc
  File 
"build/bdist.macosx-10.9-x86_64/egg/py4web/utils/auth_plugins/saml2_plugin.py", 
line 105
session.saml_outstanding_queries = {req_id: request.url}
   ^
SyntaxError: invalid syntax

and

Extracting py4web-0.1.20190818.2-py3.7.egg to 
/usr/local/lib/python3.7/site-packages
  File 
"/usr/local/lib/python3.7/site-packages/py4web-0.1.20190818.2-py3.7.egg/py4web/utils/auth_plugins/saml2_plugin.py",
 
line 105
session.saml_outstanding_queries = {req_id: request.url}
   ^
SyntaxError: invalid syntax



I starting py4web 

py4web-start apps


fails with the following error:

FileNotFoundError: [Errno 2] No such file or directory: 
'/Users/me/py4web/apps/__init__.py'


How do I resolve these issues?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/aadf48f0-de1d-4c88-ad1c-aaabdf76d1b9%40googlegroups.com.


[web2py] default/user/profile 404 NOT FOUND

2019-07-04 Thread 'Annet' via web2py-users
All of a sudden this  link 
http://127.0.0.1:8000/controlpanel/default/user/profile
no longer works, instead of returning the form it returns a 404 NOT FOUND.

I didn't change anything in the user function, so I have no idea why this 
happens.


Kind regards,

Annet

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


[web2py] Re: sqlform grid to show a field entirely, without cutting off the text

2019-06-18 Thread 'Annet' via web2py-users

I think Anthony answered this question in this post:

https://groups.google.com/forum/?fromgroups=#!topic/web2py/okMVqyQPKV8

hope he did ;-)


Regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0cc6a014-eea9-450f-b00b-e8255876ce14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: intercepting login & logout events

2019-06-18 Thread 'Annet' via web2py-users
Web2py has auth.settings I used them to solve your problem


auth.settings.login_onaccept = lambda form: __on_login()
auth.settings.logout_onlogout = lambda user: __on_logout()

and then in the functions the task you want to perform, in my case 
some set up things and messages, something like:


def __on_login():
# set up code

# messages
if auth.user.first_name:
name = auth.user.first_name + ' '
elif auth.user.title:
name = auth.user.title + ' '
if auth.user.familyNamePreposition:
name += auth.user.familyNamePreposition + ' '
name += auth.user.last_name

session.messages_logged_out = 'You have successfully logged out, 
goodbye %s' %(name)
session.flash =  'You have successfully logged in, welcome %s' %(name)

return None


def __on_logout():
if session.forced_logout:
auth.messages.logged_out = session.forced_logged_out_message
else:
auth.messages.logged_out = session.messages_logged_out

return None


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4cb15666-ee77-41c9-b769-70324770b90e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: setting up pscycopg2

2019-06-13 Thread 'Annet' via web2py-users


> This isn't done as sudo?
>

With these lines I installed psycopg2 in my hosting environment, no sudo 
needed.
 

| The trick seems to letting web2py know it is installed in its local 
environment.

I installed psycopg2 in the site-packages folder of the python version I am 
using
same folder pip resides.


I am glad you solved the issue.


Kind regards,

Annet.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e3971c47-3eb0-4d8b-b504-009e72d5a3fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: setting up pscycopg2

2019-06-12 Thread 'Annet' via web2py-users
Hi Dave,

I work both on Mac OS X and Linux and have Postgres databases.


On Mac OS X I located the pg_config file and added its location to the 
.bash_profile file:

export PATH=/usr/local/bin:$PATH
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin

Then I got pip and installed psycopg2

lionserver:~ userx$ sudo python /Users/userx/Downloads/get-pip.py
lionserver:~ userx$ python -m pip install psycopg2


On Linux I ran the following code to install psycopg2

export PATH=/usr/pgsql-9.1/bin/:$PATH
mkdir -p ~/lib/python2.7
easy_install-2.7 psycopg2


As far as I know Web2py will always use psycopg2 instead of pg8000 if 
psycopg2 is installed.


I hope this helps you solve the issue.


Kind regards,

Annet


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9cb3aadc-51b6-4a3f-a185-c468369d9067%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Don't allow textarea to contain html tags

2019-04-23 Thread 'Annet' via web2py-users
My application has a contact form which is inserted into a database. I am 
using Google's CAPTCHA,
however, sometimes a contact form is being submitted with a malicious link. 
To prevent this from
happening I wonder wether it is possible to validate the textarea and only 
submit the form when it does
not contain any html tag or to strip the textarea of any html tags.


Kind regards,

Annet

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


[web2py] Re: CSS button alignment

2019-04-06 Thread 'Annet' via web2py-users
I think Bootstrap's float-right and float-left will solve this issue.

https://getbootstrap.com/docs/4.1/utilities/float/

-- 
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: session.connect()

2019-03-28 Thread 'Annet' via web2py-users
Hi Anthony,

Thanks for your reply.  

I added 

response.cookies['session_id_cms']['domain'] = '.yourdomain.com 

'

to a model file in the cms app. And in the init app I have

session.connect(request, response, masterapp="controlpanel")

The apps do share the session cookie both locally and in production:

response.session_id_name


returns session_id_cms

However, locally auth.is_logged_in() returns True but in production it
returns False and auth.user returns None.

I have no idea what causes the difference in behaviour. I hope you do.


Kind regards,

Annet

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


[web2py] session.connect()

2019-03-27 Thread 'Annet' via web2py-users
I have two applications one init and one cms. In init I have
a few functions for which the user needs to be logged in.
These functions only read from the database they do not
write to the database.

I thought I could use

session.connect(request, response, masterapp="cms")

to share the fact that a user is logged in with the init
application, on localhost it works however, in production
where init and cms have their own subdomain it does
not work.

Are there additional setting to get this to work in production?


Kind regards,

Annet

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


[web2py] IS_IN_SET instead of IS_IN_DB

2019-03-21 Thread 'Annet' via web2py-users
I needed a IS_IN_DB() validator based on joined tables with the id coming 
from one
table and the label coming from both tables, since I did not get this to 
work I tried:

table.labelIDs.requires = IS_EMPTY_OR(IS_IN_SET([(r.ntw_edge_label_set.id, 
'%s' %str(r.vtx_vertex.name + ' - ' +  r.ntw_edge_label_set.myLabel)) for r 
in rows], multiple=(0, 6), zero='Select a value'))

This works but in my opinion this is rather ugly:

'%s' %str(r.vtx_vertex.name + ' - ' +  r.ntw_edge_label_set.myLabel)) for r 
in rows

Is there a way to improve this code?


Kind regards,

Annet.

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


[web2py] auth.settings user_url

2019-02-26 Thread 'Annet' via web2py-users
I have one application that takes car of all the auth stuff. 
In the init application I have a couple of functions that require login,.

I added this line of code session.connect(request, response, 
masterapp="controlpanel") and 
decorated the functions with @auth.requires_login() and set
auth.settings.login_url = URL('controlpanel', 'default', 'user', 
args='login')

I removed def user(): from the init application.

Is there a setting to not just set the login_url but to set all urls, 
something like:

auth.settings.user_url = URL('controlpanel', 'default', 'user')


Kind regards,

Annet.

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


[web2py] Re: Issue between 2.14.5 and 2.17.2

2018-10-26 Thread 'Annet' via web2py-users
Thank you both for your replies.

Are you on the same filesystem/OS? Is it possible your OS sort order is now 
> different, so "_" sorts after the digits instead of before? Try changing 
> 0_imports.py to 00_imports.py.
>

I tried, but it did not solve the issue.

Like Carlos said I had add the import os statement to my own model file. 
This was not the case in web2py version 2.14.5 (I checked all my model 
files), so I guess something must have changed between 2.14.5 and 2.17.2.

Best,

Annet

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


[web2py] Issue between 2.14.5 and 2.17.2

2018-10-25 Thread 'Annet' via web2py-users
After upgrading from web2py 2.14.5 to 2.17.2 and editing a model file I got 
the following error:

Traceback (most recent call last):
  File "/Users/iannet/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File 
"/Users/iannet/web2py/applications/adminmodel/models/01_education_db.py", line 
19, in 
Field('image', type='upload', default=None, 
requires=IS_EMPTY_OR(IS_IMAGE(extensions=('gif', 'jpg', 'jpeg', 'png'), 
maxsize=(320, 518)), IS_LENGTH(128*1024)), autodelete=True, 
uploadfolder=os.path.join(UPLOADFOLDER, 'vertexID%s' % 
session.back_end_vertexID)),
NameError: name 'os' is not defined


What has changed between these versions that's causing this error? As far 
as I can see 0_imports .py still imports os


Kind regards,

Annet

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


[web2py] Re: Autocomplete widget match middle of word

2018-09-17 Thread 'Annet' via web2py-users
Hi Anders,

In the query use .contains()

Something lijke:

rows = db(db.table.field.contains(request.get_vars.term, 
case_sensitive=False)).select().as_list()


Best,

Annet

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


[web2py] Re: response menu

2018-07-22 Thread 'Annet' via web2py-users
Hi Stavros,

I think this'll solve your problem:

{{=MENU(response.menu, _class='web2py-menu', li_class='dropdown', 
ul_class='dropdown-menu')}}


Best,

Annet

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


[web2py] grouping and counting

2018-05-24 Thread 'Annet' via web2py-users
In a table definition I have the following field:

db.define_table('app_settings',
...
Field('viewtypeID', type='integer', requires=IS_IN_SET(viewtype_list)),
   ...
migrate = False)

This is the viewtype_list:

viewtype_list = [(1, 'zero'), (2, 'thing'), (3, 'client'), ..., (8, 'hub')]

I have two types of users, distinguished by their e-mail starting with 
'thing' or not.

What I want is to group the views by type and within a group by e-mail 
starting with 'thing' or not
and then count the number of views.

viewtype 1   r views of whichs thing users t none thing users
viewtype 2   x views of whichy thing usersz none thing users
etc.


This is the join:

join =  db.auth_user.on(db.app_settings.vertexID==db.auth_user.vertexID)


Kind regards,

Annet

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


[web2py] Re: raise HTTP(503, "")

2018-05-17 Thread 'Annet' via web2py-users
Hi Stifan,

Thanks for your helpful reply. Anthony's solution solves the issue.

Best,

Annet

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


[web2py] raise HTTP(503, "")

2018-05-15 Thread 'Annet' via web2py-users
I have the following line of code in 00_db.py

raise HTTP(503, "Maintenance")

Is it possible to replace the code between "" with a view name, as in
response.view = '503_handler.html'


Kind regards,

Annet

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


[web2py] Re: join and count()

2018-04-14 Thread 'Annet' via web2py-users
Hi Anthony,

Thanks for your reply.

Does this work:
>
> label_count = db.vtx_label.id.count()
> count = rowset.select(label_count, join=join).first()[label_count]
>
>
Yes, that works, but I don't understand why it works, could you please 
explain 
how your solution works? The table vtx_labels contains lots of labels, does
label_count count them all?


This is the working code:


labels = db(db.vtx_label.vertexID==vertexID)._select(db.vtx_label.label)

join = db.vtx_vertex.on((db.vtx_label.vertexID==db.vtx_vertex.id) & 
(db.vtx_vertex.typeID==IOTHINGID))

rowset = db((db.vtx_label.label.belongs(labels)) & 
(db.vtx_label.vertexID!=vertexID))

label_count = db.vtx_label.id.count()
count = rowset.select(label_count, join=join).first()[label_count]
rows = rowset.select(join=join)


Best,

Annet

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


[web2py] join and count()

2018-04-13 Thread 'Annet' via web2py-users
In a function I have the following query:


labels = db(db.vtx_label.vertexID==vertexID)._select(db.vtx_label.label)

join = db.vtx_vertex.on((db.vtx_label.vertexID==db.vtx_vertex.id) & 
(db.vtx_vertex.typeID==IOTHINGID))

rowset = db((db.vtx_label.label.belongs(labels)) & 
(db.vtx_label.vertexID!=vertexID))

count = rowset.count()
rows = rowset.select(join=join)


The problem is that the rowset needs the join to count right, is there a 
way to
solve this issue other then this:


labels = db(db.vtx_label.vertexID==vertexID)._select(db.vtx_label.label)

rowset = db((db.vtx_label.label.belongs(labels)) & 
(db.vtx_label.vertexID!=vertexID) &
 (db.vtx_label.vertexID==db.vtx_vertex.id) & 
(db.vtx_vertex.typeID==IOTHINGID))

count = rowset.count()
rows = rowset.select()

I'd like to keep the join separate from the where clause.


Best,

Annet

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


[web2py] Re: LOAD an routes_onerror

2018-03-16 Thread 'Annet' via web2py-users
Hi Anthony,

Thanks for your reply.


Have you tried redirect(..., client_side=True) in your error handler?
>


The error handler  error/default/index contains the following lines of code:


def index():
session.forget(response)

response.title = 'Leonexus - Error handler'

return dict()


I do not have a line redirect(..., client_side=True) in my code. Is it 
possible to add 
client_side = True to error_handler in routes.py

error_handler = dict(application='error',
 controller='default',
 function='index',
 client_side = True)


Kind regards,

Annet

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


[web2py] LOAD an routes_onerror

2018-03-06 Thread 'Annet' via web2py-users
In my application I have a view containing a header, main and footer 
component.
In the index function of a controller I have the following code:

maincomponent = LOAD('home', 'base', args=[vertexID, viewtypeID, groupID, 
plural],
 ajax=True, target='main-component', content='')

this loads the home page, all other pages are loaded in the main-component.

I have a separate application which handles errors. In routes.py I have the 
following
code:


routes_onerror = [
(r'init/*', r'/error/default/index')
   ,(r'*/404', r'/error/default/index')
   ,(r'*/*', r'/error/default/index')
]

# specify action in charge of error handling

error_handler = dict(application='error',
 controller='default',
 function='index')


The problem is that in case of an error the error_handler is being loaded 
into
the main-component. Which results in the menu in the header displaying
multiple dropdown carets and the menu items not being clickable anymore.

What is the best way to solve this issue?


Kind regards,

Annet

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


Re: [web2py] _href to URL()

2018-02-26 Thread 'Annet' via web2py-users
Hi Anthony,

Thanks for your reply and explanation, I changed my code
to the code you provided.


Kind regards,

Annet

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


  1   2   >