[web2py] Re: How to put a variable in the A helper?

2019-01-02 Thread Stephan
Oh, I see. Thank you!

Am Dienstag, 1. Januar 2019 19:46:50 UTC+1 schrieb Massimo Di Pierro:
>
> This
>
> {{=A('Your File', 
> callback=URL('tracker',vars=dict(contents=contents.id.id,art='zip')), 
> _onclick="window.open('%s');") % (download_file)}} 
> 
>
> should be
>
> {{=A('Your File', 
> callback=URL('tracker',vars=dict(contents=contents.id.id,art='zip')), 
> _onclick="window.open('%s');" % download_file)}} 
> 
>
> and it should be in a view .htmlfile.
> It assumes download_file is in scope. therefore it is either defined in a 
> model file or it is passed from the controller to the view.
>
> On Sunday, 30 December 2018 13:48:23 UTC-8, Stephan wrote:
>>
>> Hi,
>> How do I put a variable in the 2a helper? %s does not seem to work within 
>> {{=A 
>>
>> // download_file = "https://www.something.zip";
>>
>> {{=A('Your File', 
>> callback=URL('tracker',vars=dict(contents=contents.id.id,art='zip')), 
>> _onclick="window.open('%s');") % (download_file)}} 
>> 
>>
>> Thanks for helping,
>> Stephan
>>
>

-- 
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: Modules Import Problem.

2019-01-02 Thread Alfonso Serra
Hi, im having a similar issue:

In modules, i have a utils.py module with a function called "first" that i 
cant import from another module.

The problem is that theres a utils.py module installed in the python 
standard library that obviously doesn not has that function and its being 
imported before my utils.py.

So the questions are:
- shall i modify sys.path so modules takes precedence over the python 
library?
- is there any drawback you can think of by doing so?
- where would it be a good place to do this?

I could rename the module to myutils.py and the problem goes away but still 
would like to load web2py modules first.

Thanks



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


[web2py] Male file upload optional_SQLFORM

2019-01-02 Thread Arindam Dasgupta
Hi Greetings for the new year!!

I recently ran into a problem. I need to make fileupload field in SQLFORM
optional How can I do that ?

My Model:

db.define_table('rates_frames',

Field('frame_size'  type='string' ),
Field('frame_id' , type='string'),
Field('frame_pic','upload',autodelete=True),
Field('unit_price',type='float')

)

My Controller:

form = SQLFORM(db. rates_frames  , submit_button=T('CLICK HERE TO MOVE ITEM
TO CART'))


Tnanks in advance,
Arindam

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


Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread 黄祥
same here test using conda
$ uname
Darwin

$ python -V
Python 3.7.1

$ git clone --recursive https://github.com/web2py/web2py.git
$ cd web2py
$ git checkout modular

$ python setup.py 
Traceback (most recent call last):
  File "setup.py", line 4, in 
from gluon.fileutils import tar, untar, read_file, write_file
  File "/Users/sugizo/Downloads/learn/web2py/gluon/__init__.py", line 35, in 

from .globals import current
  File "/Users/sugizo/Downloads/learn/web2py/gluon/globals.py", line 16, in 

from gluon._compat import pickle, StringIO, copyreg, Cookie, urlparse, 
PY2, iteritems, to_unicode, to_native, \
ImportError: cannot import name 'Cookie' from 'gluon._compat' (/Users/sugizo
/Downloads/learn/web2py/gluon/_compat.py)

$ python web2py.py
Traceback (most recent call last):
  File "web2py.py", line 21, in 
import gluon.widget
  File "/Users/sugizo/Downloads/learn/web2py/gluon/__init__.py", line 35, in 

from .globals import current
  File "/Users/sugizo/Downloads/learn/web2py/gluon/globals.py", line 16, in 

from gluon._compat import pickle, StringIO, copyreg, Cookie, urlparse, 
PY2, iteritems, to_unicode, to_native, \
ImportError: cannot import name 'Cookie' from 'gluon._compat' (/Users/sugizo
/Downloads/learn/web2py/gluon/_compat.py)

best regards,
stifan

-- 
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: Modules Import Problem.

2019-01-02 Thread Alfonso Serra
Hi, so far it looks like this works:

at the model 01_config.py

import sys
sys.path.insert(0, r"E:\webdev\web2py-mod.02\applications\myapp\modules")

then im able to import as:
from utils import myfunc

where utils.py is an application module at applications\myapp\modules

-- 
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: Male file upload optional_SQLFORM

2019-01-02 Thread 黄祥
not sure what do you mean with optional, there is fields in SQLFORM 
constructor
another way is using conditonal fields (show_if)

*ref:*
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields

best regards,
stifan

-- 
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] Happy New Year

2019-01-02 Thread davidjensen
Base web3py on the fastest possible web server (vibora?) Make utilities for 
nosql data store.

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


Re: [web2py] Re: broken inframe video on manual web page

2019-01-02 Thread Nico Zanferrari
Hi,

I've opened issue 2068  for
this.

nico

Il giorno mer 17 ott 2018 alle ore 01:21 Nico Zanferrari 
ha scritto:

> Well, it seems that Vimeo has dropped the hubnut feature on July, see
> https://vimeo.zendesk.com/hc/en-us/articles/360001359507-Flash-player-deprecation
> We should find an alternative (maybe the first video on the album?) or
> remove the frame.
>
> Nico
>
> Il giorno mar 16 ott 2018 alle ore 21:23 Marcelo Huerta <
> marcelo.hue...@gmail.com> ha scritto:
>
>>
>> El domingo, 14 de octubre de 2018, 12:00:30 (UTC-3), Nico Zanferrari
>> escribió:
>>>
>>> Hi,
>>> it seems that there is a missing reference on the online web2py manual
>>> at http://www.web2py.com/init/default/documentation .
>>> There is a missing video
>>> 
>>> pointing at vimeo - no more available ;-(
>>>
>>> Nico
>>>
>>
>> Verified - the whole set of videos from Massimo seem to be at Vimeo (you
>> can find them searching for "web2py video course 2013", but the caroussel
>> doesn't work anymore.
>> Maybe they changed the way links are handled?
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


[web2py] Re: @auth.requires_signature() vs @auth.requires_login()

2019-01-02 Thread Leonel Câmara
Yes it makes perfect sense.

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


Re: [web2py] Re: Male file upload optional_SQLFORM

2019-01-02 Thread Arindam Dasgupta
Thanks Steve!! That was a lot of help for me and I solved my issue with
that.

BR//Arindam

On Wed, Jan 2, 2019 at 5:00 PM 黄祥  wrote:

> not sure what do you mean with optional, there is fields in SQLFORM
> constructor
> another way is using conditonal fields (show_if)
>
> *ref:*
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread Carlos Cesar Caballero Díaz

Guys, I think you need to include the "modular" branch of pydal too:

cd gluon/packages/dal/
git checkout modular

Greetings.


El 2/1/19 a las 4:32 a.m., 黄祥 escribió:

same here test using conda
|
$ uname
Darwin

$ python -V
Python3.7.1

$ git clone --recursive https://github.com/web2py/web2py.git
$ cd web2py
$ git checkout modular

$ python setup.py
Traceback(most recent call last):
File"setup.py",line 4,in
fromgluon.fileutils importtar,untar,read_file,write_file
File"/Users/sugizo/Downloads/learn/web2py/gluon/__init__.py",line 
35,in

from.globals importcurrent
File"/Users/sugizo/Downloads/learn/web2py/gluon/globals.py",line 
16,in
fromgluon._compat 
importpickle,StringIO,copyreg,Cookie,urlparse,PY2,iteritems,to_unicode,to_native,\
ImportError:cannot importname 
'Cookie'from'gluon._compat'(/Users/sugizo/Downloads/learn/web2py/gluon/_compat.py)


$ python web2py.py
Traceback(most recent call last):
File"web2py.py",line 21,in
importgluon.widget
File"/Users/sugizo/Downloads/learn/web2py/gluon/__init__.py",line 
35,in

from.globals importcurrent
File"/Users/sugizo/Downloads/learn/web2py/gluon/globals.py",line 
16,in
fromgluon._compat 
importpickle,StringIO,copyreg,Cookie,urlparse,PY2,iteritems,to_unicode,to_native,\
ImportError:cannot importname 
'Cookie'from'gluon._compat'(/Users/sugizo/Downloads/learn/web2py/gluon/_compat.py)

|

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

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQL NOT IN issue(belong)

2019-01-02 Thread Yann Dulondel
Hi All 
Happy new year 2019.

I have an issue with SQL NOT IN
I tried to get a heater pad list(dropdown) in a form.
The heater must be related to user depot and not been used.
If they are used the heater id is set up in table articles

Queryheat=db((db.heatpad.id_depot==db.auth_user.id_depot)&(db.auth_user.id==
auth.user.id))&db(~db.heatpad.id.belongs(db.articles.heatpad))

I always get an exception memory error
I have tried with 
Queryheat=db((db.heatpad.id_depot==db.auth_user.id_depot)&(db.auth_user.id==
auth.user.id)&db(~db.heatpad.id.belongs(db.articles.heatpad).select(db.
heatpad.id)))
Queryheat=db((db.heatpad.id_depot==db.auth_user.id_depot)&(db.auth_user.id==
auth.user.id)&(~db.heatpad.id.belongs(db.articles.heatpad).select(db.heatpad
.id)))


def show_flexi():
request.title=T("Braid Logistics Europe")
flexi_id=request.args(0, cast=int)
type_article=request.args(1, cast=int)
records = db.articles(flexi_id)
db.articles.cod_ref.writable=False
db.articles.id_stk_article.readable=db.articles.id_stk_article.writable=
False
db.articles.id.readable=False
db.articles.isintegrated.readable=db.articles.isintegrated.writable=
False
depotrecord=db(db.depot.id==auth.user.id_depot).select(db.depot.
useheatpad)
Row=depotrecord[0]
if Row['useheatpad']==True:
myFields=['cod_ref','conteneur','dossier','date_sortie','bulk_id',
'detruit','heatpad']
Queryheat=db((db.heatpad.id_depot==db.auth_user.id_depot)&(db.
auth_user.id==auth.user.id))&db(~db.heatpad.id.belongs(db.articles.heatpad))
db.articles.heatpad.requires=IS_IN_DB(Queryheat,db.heatpad.id,
'%(cod_ref)s')
else:
 myFields=['cod_ref','conteneur','dossier','date_sortie','bulk_id',
'detruit']
QueryLang=db((db.depot.id==db.auth_user.id_depot)&(db.type_bulkhead.
id_language==db.depot.id_lang)&(db.auth_user.id==auth.user.id))
db.articles.bulk_id.requires=IS_IN_DB(QueryLang,db.type_bulkhead.id,
'%(name)s')
#labels={'cod_ref':T('Flexi Number'),'conteneur':T('Conteneur 
Number'),'dossier':T('Braid reference'),'date_sortie':T('Fitting 
date'),'bulk_id':T('Bulkhead'),'detruit':T('Destroyed')}
flexi=SQLFORM(db.articles
  ,record=records
  #,labels=labels
 ,fields=myFields)
 #,searchable=False)


flexi.add_button(T('Back'), URL(show_flexlist,args=[type_article],
user_signature=True))
if flexi.process(onvalidation=flexivalidation).accepted:
response.flash = T('form accepted')

#redirect(URL(show_flexlist,args=[type_article],user_signature=True))
elif flexi.errors:
   response.flash = T('Form has errors')


return(dict(message=flexi_id,flexi=flexi))
Any idea where i'm wrong ?
Yann


-- 
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] modular web2py - need help

2019-01-02 Thread Carlos Cesar Caballero Díaz
I like a LOT the idea, my initial tests seems to work ok in Python 3.6.7 
on Ubuntu except the test_web ones are failing.


Tell me please, that one of the new year resolution is to have web2py in 
pypi :) That's something I would love to help make a reality.


This are my wishes:

1- pypi

2- The ability to:

pip install web2py
cd /home/myuser
git clone http://github.com/myuser/myapp.git
cd myapp
web2py run

And start my app. Something like this will make distributing web2py apps 
a lot easier (even using pip)


3- An advanced welcome app template, including .gitignores, tests, and 
environment configurations for development and production.


4- A more flexible grid:
There will be awesome if we could pass to the grid the template for 
rendering forms, or rendering buttons, cells etc... and define the logic 
for ordering fields (including virtual ones)


5- A CLI for applications, maybe using @cli decorators in controllers 
and maybe running them like "web2py --cli app/controller/function 
--param1=value1 --param2=value2"


6- A router that balances ease of use and power, maybe something in the 
middle of the two we have right now (I like the Yii2 framework routes 
style).


7- A more friendly error tickets for views (there can be difficult to 
find an error in a large view file), and maybe for reading them outside 
web2py (right now is really difficult to read errors accessing directly 
to the ticket files).


8- Some kind of "Modules system" that could make a lot easier the code 
reutilization.


With some guidance, I can use some hours/week and maybe include another 
dev for make this kind of features a reality. Even thougt I like the 
"web3py" idea, and I think that this kind of effort should be redirected 
to the new framework.


Greetings.


El 1/1/19 a las 7:04 p.m., Massimo Di Pierro escribió:

Based on my new years resolution:

- I posted a new web2py branch called modular.
- I moved template.py into its own folder planning to make its own package
- I refactored validators.py and scheduler.py and moved them into 
pydal (also branch modula)


Thoughts?
Can you help testing that nothing broke in web2py?

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

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: error exporting data (CSV) using smartgrid

2019-01-02 Thread Armando Hernandez
i found a workaround 

https://github.com/web2py/web2py/issues/1542

had to comment out this line:

https://github.com/web2py/web2py/blob/cef31f127796c638753297235f4e886f6a9e5410/gluon/sqlhtml.py#L2668

now my smartgrid's export to CSV work again!!!

El domingo, 23 de diciembre de 2018, 22:29:50 (UTC-6), Armando Hernandez 
escribió:
>
> Hello,
>
> i have an error when i try to export smartgrid data, smart grid displays 
> fine, but when i try to export data (click on the Export: [CSV] button) i 
> have the following error:
>
>  (1064, u'You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near \'."record_id", 
> "doc"."object_name", "doc"."email_address", "doc"."deliverytime", \' at 
> line 1')
>
> i have logged the sql query that fails in mysql and this is it:
>
> SELECT "doc"."record_id", "doc"."object_name", "doc"."email_address", 
> "doc"."deliverytime", "doc"."status", "doc"."accepted_on", 
> "doc"."delivered_on", "doc"."failed_on", "doc"."opened_on", 
> "doc"."clicked_on" FROM `doc` WHERE ((`doc`.`id` IS NOT NULL) AND 
> (`doc`.`campaign` = 20)) ORDER BY `doc`.`id`
>   
> i have manually replaced the double quotes (") with the backtick (`)  : 
> `doc`.`record_id` ... and then the query runs fine in mysql console.
>
> i don't know which function is creating this query with double quotes 
> instead of the backtick, export to CSV  used to work in older web2py 
> versions,  what do you recommend?
>
>
> Thanks 
>
> Greetings from Mexico!! :)
>
>

-- 
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] ajax controller loses formatting?

2019-01-02 Thread Vlad
I am sure I am missing something very basic here, but... googling didn't 
help...

When I have a contoller which I use in ajax calls, it all works just 
perfect except that the view loses the formatting (for example, it does 
keep the links and bullets - yet loses bootstrap formatting of everything). 
I don't understand why this happens and how to fix it. After all the view 
extends layout.html which does include everything, so why would it make a 
difference if html code is direct on the page or embedded via ajax? 

For example: the following 2 controllers via ajax produce exactly same 
non-formatted html:

def test1():
return XML("Home\
   #M1M2M3")

def test2():
return XML("Home\
   M1M2M3")

In fact, even without ajax, when I allow these controllers to go through 
default views (i.e. without having a dedicated view) - this is exactly what 
happens too, but here I sort of understand it - while in a case of ajax I 
don't, because ajax is embedded into real view html and should really 
pickup all the appropriate formatting which works well on the rest the 
page. 

What am I missing? How do I fix this?

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


[web2py] Happy New Year

2019-01-02 Thread Val K
So it will not be a flask but the box of bottles?

-- 
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: ajax controller loses formatting?

2019-01-02 Thread Anthony
In order for an associated view to be executed, you must return a 
dictionary. If you return a string or HTML helper, it will be returned 
directly to the browser with no view being executed.

Anthony

On Wednesday, January 2, 2019 at 3:14:50 PM UTC-5, Vlad wrote:
>
> I am sure I am missing something very basic here, but... googling didn't 
> help...
>
> When I have a contoller which I use in ajax calls, it all works just 
> perfect except that the view loses the formatting (for example, it does 
> keep the links and bullets - yet loses bootstrap formatting of everything). 
> I don't understand why this happens and how to fix it. After all the view 
> extends layout.html which does include everything, so why would it make a 
> difference if html code is direct on the page or embedded via ajax? 
>
> For example: the following 2 controllers via ajax produce exactly same 
> non-formatted html:
>
> def test1():
> return XML(" href='#'>Home\
>#M1M2 href='#'>M3")
> 
> def test2():
> return XML("Home\
>M1M2 href='#'>M3")
>
> In fact, even without ajax, when I allow these controllers to go through 
> default views (i.e. without having a dedicated view) - this is exactly what 
> happens too, but here I sort of understand it - while in a case of ajax I 
> don't, because ajax is embedded into real view html and should really 
> pickup all the appropriate formatting which works well on the rest the 
> page. 
>
> What am I missing? How do I fix this?
>
>

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


Re: [web2py] Re: ajax controller loses formatting?

2019-01-02 Thread Eliezer (Vlad) Tseytkin
Got it,
I knew I missed something basic :)

Thank you!!

On Wed, Jan 2, 2019, 7:22 PM Anthony  In order for an associated view to be executed, you must return a
> dictionary. If you return a string or HTML helper, it will be returned
> directly to the browser with no view being executed.
>
> Anthony
>
> On Wednesday, January 2, 2019 at 3:14:50 PM UTC-5, Vlad wrote:
>>
>> I am sure I am missing something very basic here, but... googling didn't
>> help...
>>
>> When I have a contoller which I use in ajax calls, it all works just
>> perfect except that the view loses the formatting (for example, it does
>> keep the links and bullets - yet loses bootstrap formatting of everything).
>> I don't understand why this happens and how to fix it. After all the view
>> extends layout.html which does include everything, so why would it make a
>> difference if html code is direct on the page or embedded via ajax?
>>
>> For example: the following 2 controllers via ajax produce exactly same
>> non-formatted html:
>>
>> def test1():
>> return XML("> href='#'>Home\
>>#M1M2> href='#'>M3")
>>
>> def test2():
>> return XML("Home\
>>M1M2> href='#'>M3")
>>
>> In fact, even without ajax, when I allow these controllers to go through
>> default views (i.e. without having a dedicated view) - this is exactly what
>> happens too, but here I sort of understand it - while in a case of ajax I
>> don't, because ajax is embedded into real view html and should really
>> pickup all the appropriate formatting which works well on the rest the
>> page.
>>
>> What am I missing? How do I fix this?
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread 黄祥
thx carlos, here is the steps i took
git clone --recursive https://github.com/web2py/web2py.git
cd web2py/gluon/packages/dal/
git checkout modular

$ python -V
Python 3.7.1
$ python ../../../setup.py
Traceback (most recent call last):
  File "../../../setup.py", line 85, in 
start()
  File "../../../setup.py", line 32, in start
version=read_file("VERSION").split()[1],
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 112, 
in read_file
f = open_file(filename, mode)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 104, 
in open_file
f = open(filename, mode, encoding="utf8")
FileNotFoundError: [Errno 2] No such file or directory: 'VERSION'
$ python ../../../web2py.py
$ open http://localhost:8000
$ open http://localhost:8000/admin/default/site

on http://localhost:8000/admin/default/site
*Version*
2.17.2-stable+timestamp.2018.10.06.11.34.06
(Running on Rocket 1.2.6, Python 3.7.1)

*suggestion*
why the upgrade now to version 2.17.2 is active, just a suggestion think 
the button for upgrade now should be disable if the version is same or same 
like behaviour in previous version : 
the button for upgrade is shown (Check for upgrades)
see below for test in python 2.7

$ python -V
Python 2.7.15 :: Anaconda, Inc.
$ python ../../../setup.py
/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/site-packages/
psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be 
renamed from release 2.8; in order to keep installing from binary please use 
"pip 
install psycopg2-binary" instead. For details see: .
  """)
Traceback (most recent call last):
  File "../../../setup.py", line 85, in 
start()
  File "../../../setup.py", line 32, in start
version=read_file("VERSION").split()[1],
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 112, 
in read_file
f = open_file(filename, mode)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 102, 
in open_file
f = open(filename, mode)
IOError: [Errno 2] No such file or directory: 'VERSION'
$ python ../../../web2py.py
$ open http://localhost:8000/admin/default/site
$ open http://localhost:8000
Traceback (most recent call last):
  File "/Users/sugizo/Downloads/learn/web2py/gluon/restricted.py", line 
219, in restricted
exec(ccode, environment)
  File "/Users/sugizo/Downloads/learn/web2py/applications/welcome/models/db.
py", line 95, in 
auth.define_tables(username=False, signature=False)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/tools.py", line 2091, in 
define_tables
super(Auth, self).define_tables(username, signature, migrate, 
fake_migrate)._table_signature_list
  File "/Users/sugizo/Downloads/learn/web2py/gluon/authapi.py", line 350, 
in define_tables
format='%(first_name)s %(last_name)s (%(id)s)'))
  File "/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/base.
py", line 590, in define_table
table = self.lazy_define_table(tablename, *fields, **kwargs)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/base.
py", line 624, in lazy_define_table
polymodel=polymodel)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/
adapters/base.py", line 798, in create_table
return self.migrator.create_table(*args, **kwargs)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/
migrator.py", line 296, in create_table
sql_fields_old = pickle.load(tfile)
  File "/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 1384, in load
return Unpickler(file).load()
  File "/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 864, in load
dispatch[key](self)
  File "/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 892, in load_proto
raise ValueError, "unsupported pickle protocol: %d" % proto
ValueError: unsupported pickle protocol: 3

using python 2.7 can run admin but not for welcome app
*Version*
2.17.2-stable+timestamp.2018.10.06.11.34.06
(Running on Rocket 1.2.6, Python 2.7.15)
the button for upgrade is shown (Check for upgrades)

best regards,
stifan

-- 
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] Happy New Year

2019-01-02 Thread Carlos Cesar Caballero Díaz

Happy new year!!

I have answered this in other thread because for some reason I have 
missed this one, and many of my wishes match yours 
https://groups.google.com/d/msg/web2py/BskHaFZkVEI/sudO0jdsFgAJ


First a question (mostly for curiosity). Why using Bottle instead (for 
example) Flask or werkzeug or one of the new async microframeworks? I 
assume because bottle is really small and we can include it without 
dependencies, and less verbose than werkzeug, but I have never used it, 
so I have no idea.


We can look in weppy most of the features that I really would like to 
have in web2py/web3py, it is in my opinion a great mix of flask and 
web2py styles. One of the things that I most like is the pydal based 
ORM. I know that there are a lot of people that like to work directly 
with the DAL, but in my opinion a ORM helps when we need to use 
inheritance and reuse code, and eases a lot the code reading in complex 
models. I really like the concept of "fat models and thin controllers", 
but my models looks really weird right now in web2py when I need to 
declare virtual fields or methods with complex logic.


I think that Weppy migrations are really useful in deployments and 
CI/CD, mostly when we need to make complex changes in database or 
update  old versions of our applications, because is easy to define an 
exact behavior of migrations and data.


Now some comments about your wishes:


4) the scheduler were part of pydal
I am not sure about this, of course you know the web2py API a lot better 
than me, and this have a reason, but I see the scheduler and the DAL as 
two completely different things, with different responsibilities, so I 
don't see why the scheduler should be part of pydal, instead of a 
standalone module.

6) we could remove every filesystem IO (errors, sessions, uploads)
But there should be an easy way for users to handle uploads, because is 
a common task.
8) auth logic were simpler and not tied to the current 
cookie/session/form logic.
I know that auth logic is a PITA, but still a lot of users use it. Even 
when use 3rd party services, is common to use some kind of authorization 
mechanism, so, I think that the framework should, at least, build some 
basic logic and an interface for extend or completely replace with 3rd 
party modules or custom auth logic.

9) SQLFORM and Grid were JS libraries that use Ajax for communication
That's good, but grid should be flexible enough, in my opinion, the main 
issue with the grid right now, is that customization is very limited or 
complex.
Then web2py -> web3py would be a thin layer using bottle and the above 
libs.


I think that there is a niche among Python web frameworks right now, and 
web2py -> web3py can fill it. There are a lot of microframeworks which 
are good, and fast, but need a lot of code and 3rd party integrations 
for building an application, there are others like django that include a 
lot of things, but still needs a lot of coding for building things like 
grids and forms or even a more classic app structure (that's why there 
are people making money with code generators), and there is web2py, 
which needs really little code for building applications, but is not 
"pythonic" or "flexible" enough fortake off between the developers. So 
in my opinion there is space for a framework which makes the developer 
life easier, and be "pythonic" and flexible, something like Yii2 or 
Laravel in the PHP world.


So, I think that, for really make a boost among python web developers, 
web2py -> web3py should aim to offer most of the features that web2py 
have right now, but with the flexibility that it lacks:


- It should be pip installable (and this is a must).

- Apps should be completely independents of the framework in the 
filesystem (no framework with applications folder, applications 
importing the framework instead).


- The framework should contain some pip compatible 
modules/component/plugin system which could extend the framework and be 
extended by the framework apps.


- There should be a recommended and documented way to write application 
tests.


- All framework components (or at least the public API) should be able 
to extended or replace.


Greetings.

PS: We should not drop off the current components. Really, is an awesome 
feature!! We should improve them.





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

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p

Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread Carlos Cesar Caballero Díaz

Hi, this is working for me:

git clone --recursive https://github.com/web2py/web2py.git
git checkout modular
cd web2py/gluon/packages/dal/
git checkout modular
cd ../../../


Greetings.


El 2/1/19 a las 9:24 p.m., 黄祥 escribió:

thx carlos, here is the steps i took
|
git clone --recursive https://github.com/web2py/web2py.git
cd web2py/gluon/packages/dal/
git checkout modular
|

|
$ python -V
Python3.7.1
$ python ../../../setup.py
Traceback(most recent call last):
File"../../../setup.py",line 85,in
    start()
File"../../../setup.py",line 32,instart
    version=read_file("VERSION").split()[1],
File"/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py",line 
112,inread_file

    f =open_file(filename,mode)
File"/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py",line 
104,inopen_file

    f =open(filename,mode,encoding="utf8")
FileNotFoundError:[Errno2]Nosuch file ordirectory:'VERSION'
$ python ../../../web2py.py
$ open http://localhost:8000
|$ open http://localhost:8000/admin/default/site

on http://localhost:8000/admin/default/site
*Version*
2.17.2-stable+timestamp.2018.10.06.11.34.06
(Running on Rocket 1.2.6, Python 3.7.1)

*suggestion*
why the upgrade now to version 2.17.2 is active, just a suggestion 
think the button for upgrade now should be disable if the version is 
same or same like behaviour in previous version :

the button for upgrade is shown (Check for upgrades)
see below for test in python 2.7

|
$ python -V
Python2.7.15::Anaconda,Inc.
$ python ../../../setup.py
/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/site-packages/psycopg2/__init__.py:144:UserWarning:Thepsycopg2 
wheel packagewill be renamed fromrelease 2.8;inorder to keep 
installing frombinary please use"pip install 
psycopg2-binary"instead.Fordetails 
see:.

""")
Traceback (most recent call last):
  File "../../../setup.py", line 85, in 
    start()
  File "../../../setup.py", line 32, in start
    version=read_file("VERSION").split()[1],
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 
112, in read_file

    f = open_file(filename, mode)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/fileutils.py", line 
102, in open_file

    f = open(filename, mode)
IOError: [Errno 2] No such file or directory: 'VERSION'
$ python ../../../web2py.py
$ open http://localhost:8000/admin/default/site
$ open http://localhost:8000
Traceback (most recent call last):
  File "/Users/sugizo/Downloads/learn/web2py/gluon/restricted.py", 
line 219, in restricted

    exec(ccode, environment)
  File 
"/Users/sugizo/Downloads/learn/web2py/applications/welcome/models/db.py", 
line 95, in 

    auth.define_tables(username=False, signature=False)
  File "/Users/sugizo/Downloads/learn/web2py/gluon/tools.py", line 
2091, in define_tables
    super(Auth, self).define_tables(username, signature, migrate, 
fake_migrate)._table_signature_list
  File "/Users/sugizo/Downloads/learn/web2py/gluon/authapi.py", line 
350, in define_tables

    format='%(first_name)s %(last_name)s (%(id)s)'))
  File 
"/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/base.py", 
line 590, in define_table

    table = self.lazy_define_table(tablename, *fields, **kwargs)
  File 
"/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/base.py", 
line 624, in lazy_define_table

    polymodel=polymodel)
  File 
"/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 798, in create_table

    return self.migrator.create_table(*args, **kwargs)
  File 
"/Users/sugizo/Downloads/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 296, in create_table

    sql_fields_old = pickle.load(tfile)
  File 
"/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 1384, in load

    return Unpickler(file).load()
  File 
"/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 864, in load

    dispatch[key](self)
  File 
"/Users/sugizo/miniconda3/envs/python2_prod/lib/python2.7/pickle.py", 
line 892, in load_proto

    raise ValueError, "unsupported pickle protocol:%d" % proto
ValueError: unsupported pickle protocol: 3
|

using python 2.7 can run admin but not for welcome app
*Version*
2.17.2-stable+timestamp.2018.10.06.11.34.06
(Running on Rocket 1.2.6, Python 2.7.15)
the button for upgrade is shown (Check for upgrades)

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

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book 

Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread 黄祥
yes, you r right, previous error before is due to the lack of step i took 
- git checkout must run twice in web2py folder and web2py/gluon/packages/dal
- execute python (setup.py) must be in web2py folder can't be from another 
path e.g. web2py/gluon/packages/dal then python ../../../setup.py will 
produce an error

git clone --recursive https://github.com/web2py/web2py.git
cd web2py
git checkout modular
cd gluon/packages/dal/
git checkout modular
cd ../../../
python setup.py
python web2py.py

thx n best regards,
stifan

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


Re: [web2py] Re: modular web2py - need help

2019-01-02 Thread sandeep patel
@Carlos Cesar Caballero,
I have taken the same steps as you suggested but I am getting the
same error.


Robodia@DESKTOP-E4IOU2U MINGW64 /d/TestingWeb3py/web2py/gluon/packages/dal
(modular)
$ python ../../../setup.py
Traceback (most recent call last):
  File "../../../setup.py", line 4, in 
from gluon.fileutils import tar, untar, read_file, write_file
  File "D:\TestingWeb3py\web2py\gluon\__init__.py", line 35, in 
from .globals import current
  File "D:\TestingWeb3py\web2py\gluon\globals.py", line 16, in 
from gluon._compat import pickle, StringIO, copyreg, Cookie, urlparse,
PY2,iteritems, to_unicode, to_native, \
ImportError: cannot import name 'Cookie'

Thanks
SP




On Thu, Jan 3, 2019 at 8:54 AM 黄祥  wrote:

> yes, you r right, previous error before is due to the lack of step i took
> - git checkout must run twice in web2py folder and
> web2py/gluon/packages/dal
> - execute python (setup.py) must be in web2py folder can't be from another
> path e.g. web2py/gluon/packages/dal then python ../../../setup.py will
> produce an error
>
> git clone --recursive https://github.com/web2py/web2py.git
> cd web2py
> git checkout modular
> cd gluon/packages/dal/
> git checkout modular
> cd ../../../
> python setup.py
> python web2py.py
>
> thx n best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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