[web2py] Re: Scaffold Web2py Models and SQLForm.smartgrid

2019-05-21 Thread Massimo Di Pierro
This is very old. Not sure anybody is maintaining it and what the 
limitations are. It never got much love.

http://www.web2py.com/sqldesigner

It is on my web site so I must have the source code if you want it.

Massimo




On Sunday, 19 May 2019 11:07:54 UTC-7, Kevin Keller wrote:
>
> Hello, 
>
> has anyone written a scaffolder ideally web based, where a non technical 
> user can define tables and fields including relations 
> and the new app getes generated and put into the applications folder or by 
> creating a new controller with SQLFORM.smartgrid on the 
> tables defined by the user?
>
> I want to make it easy for non-technical users to add crud pages in web2py 
> easily. 
>
> I have worked with the admin wizard app and am looking at it now for some 
> inspiration, but 
> it is still too technical for a non technical user with terms like 
> "tables" and "auth_table" pre-defined etc and also needing to 
> know the field types by heart etc.
>
> I will probably just rewrite the wizard to be more user friendly and 
> expose it in my web2py app. 
>
> but if anyone has already done something similiar, please let me know. 
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bb8944e4-3f5c-462a-8cd0-ee11b13da8f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-21 Thread Massimo Di Pierro
delete everything in /tmp/web3py and restart it. This folder should really 
be created in the cwd not in /tmp/ I will change it.

On Monday, 20 May 2019 07:17:14 UTC-7, En Ware wrote:
>
> Getting error missing table , sqlite3.OperationalError: no such table: 
> web3py_error
>
> _dashboard won't load at all. 
>
> On Wednesday, May 15, 2019 at 9:51:40 AM UTC-5, En Ware wrote:
>>
>> Thank you very much for the explanation , it really helps. 
>>
>> On Wednesday, May 15, 2019 at 12:23:47 AM UTC-5, Massimo Di Pierro wrote:
>>>
>>> web2py uses:
>>>
>>> (all defined in web3py/core.py)
>>> [100% done] pydal for DB
>>> [100%] pluralize for T
>>> [100%] yatl for template and helpers
>>> [100%] tornado as default web server (when no --number_workers)
>>> [100%] gevent + gunicorn when --number_workers is specified
>>> [100%] bottle for routing, request, response, abort, and redirect (but 
>>> has its own decorator instead the bottle one)
>>> [100%] has its own new session object (support cookies, db, memcache, 
>>> redis, and user defined)
>>> [100%] has its own O(1) least recently used cache/memoize function (used 
>>> for example to cache templates in ram)
>>> [100%] web3py/form.py replaces SQLFORM
>>>
>>> [75%]  "_dashboard" instead of "admin" (same purpose)
>>> [75%] "_dashboard dbadmin" instad of appadmin (same purpose)
>>> [75%] "_scaffold" instead of welcome (same purpose)
>>> [75%] applications/_dashboard/components/mtable.* replaces 
>>> SQLFORM.smartgrid 
>>> [50%] applications/_scaffold/components/auth.*  + web3py/utils/auth.py 
>>> replace Auth + user.html
>>>
>>> It uses the concept of "Fixtures" which are like bottle plugins but can 
>>> have dependencies. DAL, Session, T, templates are fixtures. 
>>>
>>> For every action they must be declared as in:
>>>
>>> @action('index', method=['GET','POST'])
>>> @action.uses('my-template.html', mysession, T , mydb)
>>> def index():
>>>   return dict()
>>>
>>> It is important to declare them to avoid a shortcoming of web2py and 
>>> other frameworks, to avoid doing work when it is not necessary. So if an 
>>> action does not need session, there is no need to even try parse cookies, 
>>> hence you do not declare the fixture. 
>>>
>>> You can define aliases:
>>>
>>> myaction = action.uses('my-template.html', mysession, T , mydb)
>>>
>>> and then do
>>>
>>> @action('index', method=['GET','POST'])
>>> @myaction
>>> def index():
>>>   return dict()
>>>
>>> Unlike web2py the models.py, controllers.py and all the other files are 
>>> just regular files. You can call them what you like, and they are imported, 
>>> not executed. This means web3py is much faster and also you can use pylint 
>>> and code completion without tweaks. No custom_importer that can cause weird 
>>> behavior. This also means there will be some nu-expected behavior for 
>>> web2py users and needs to be documented. Every module in the applications 
>>> folder is an app. Apps does not need to expose any action, they can just be 
>>> a collection of modules, or static files, or templates. 
>>>
>>> _dashboard and _scaffold use vue.js and the grid (mtable) and auth are 
>>> vue component but you can use them even if the rest of your app does not 
>>> use vue. Components have their own html templates in vue and they can 
>>> easily be customized for different CSS. This requires a much longer 
>>> explanation and I will write it when it is finalized.
>>>
>>> We ditched the web2py Storage object. People like it but the profiler 
>>> showed Storage.__getitem__ is the single most called function in web2py and 
>>> causes loss in performance. In web3py we stick to regular python dict 
>>> objects.
>>>
>>> This is work in progress so things will change.
>>>
>>> Massimo
>>>
>>>
>>>
>>>
>>> On Tuesday, 14 May 2019 08:42:16 UTC-7, En Ware wrote:

 So I'm trying to figure out web3py libs and how everything works 
 together. Web3py uses bottle for request, routes, and response. Web3py 
 uses 
 DAL or PyDAL for database abstraction. 

 Is this still valid for Storage class ? 
 https://web2py.readthedocs.io/en/latest/_modules/gluon/storage.html , 
 I was looking up information on how "dict" was formed.

 On Tuesday, May 14, 2019 at 9:20:00 AM UTC-5, En Ware wrote:
>
> The editing is very fast and reloads on the fly. This is pretty 
> impressive. 
>
> On Tuesday, May 14, 2019 at 9:05:58 AM UTC-5, En Ware wrote:
>>
>> Ok very good, I created the directories and launched again and i can 
>> get to the _dashboard instance, thanks
>>
>> On Tuesday, May 14, 2019 at 8:58:44 AM UTC-5, 黄祥 wrote:
>>>
>>> pls try:
>>> *need an extra steps to make web3py start in latest commit (101)*
>>> git clone https://github.com/web2py/web3py
>>> cd web3py
>>> pip3 install -r requirements.txt
>>> mkdir applications/_dashboard/translations
>>> mkdir applications/_scaffold/databases
>>> mkdir applications/toys/databases

[web2py] Post SQLing

2019-05-21 Thread Dave S
I've got my AWS linux system ticking along nicely with my heavy table under 
PostGres [1], but I still have uploads, Auth, and Scheduler under sqlite.  
I'd like to move them to PostGres, so I'm double checking that I'm using 
the appropriate steps to get there:

1. Create uploads table by copying the define_table() call from db (the 
database from the sqlite URI) to dby (the database from the PostGres URI)
e.g,
db.define_table('uploadf', ...)
gets copied to
dby.define_table('uploadf', ...)

For the table I already used, there was an issue with migration giving the 
correct resulting table files  until I changed the table name from "tname" 
to "tname_y" (the error message has been scarred over).  I hadn't seen this 
when making a backup sqlite database (called 'dbx'), I didn't need to name 
the backup "tname_x".  [2]
Should I expect to need this dodge in moving uploads?

2.  Do the usual export as CSV from the old table.

3.  Import the CSV in the new table.

(That's essentially the steps I used for the heavy table)

Auth and Scheduler have the define_tables() on the inside, so all I need to 
do is?

1.  Change the instantiation from
auth = Auth(db)
scheduler = Scheduler(db, migrate=False)
to
auth = Auth(dby)
scheduler = Scheduler(dby, migrate=True)
(and then migrate=False soon after)

2 and 3 as for uploads?

[1] Aside from my issues with switching from pg8000 to psycopg2.
[2]  Before bringing in PostGres, I tried adding a table to db for saving 
some test results longer term than uwsgi lets me keep log messages.  The 
"table already exists" errors kept piling up even after I turned off 
migrates, until I noticed the new table didn't have a UUID in its name.  I 
"fixed" this by copying the UUID from another table name and renaming the 
new .table file.  But I have another .table file with no UUID that works 
fine.  This is 2.15.4, though, so could be something fixed since then.

Thanks for the help.

/dps


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


[web2py] Return Storage as json causes 'NoneType' object is not callable

2019-05-21 Thread Val K
Hello!
I use windows binaries (2.18.5-stable+timestamp.2019.04.08.04.22.03)
 and get  *'NoneType' object is not callable* when call this simple 
function:

from gluon.tools import Storage

@service.json
def echo():
return Storage(a=1)  # return dict(a=1) - works fine

5048.
5049.
5050.
5051.
5052.
5053.
5054.
5055.
5056.
5057.

args = request.args
d = dict(request.vars)
if args and args[0] in self.json_procedures:
s = self.call_service_function(self.json_procedures[args[0]], 
*args[1:], **d)
if hasattr(s, 'as_list'):
s = s.as_list()# - the problem is here
return response.json(s)
self.error()

class JsonRpcException(Exception):


Is that the windows-bin only issue?


-- 
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/d5f5777b-ae87-48de-9350-0df1633d91c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Eliezer (Vlad) Tseytkin
Aaahhh got it
Thank you very much!!

On Tue, May 21, 2019, 7:14 PM Junior Phanter  wrote:

> # controller return javascript(Jquery) to eval
> def echo:
> import json
> return "$('#target').html(%s)" %(json.dumps(DIV("Hello",
> STRONG("world"), "Escape this?").xml()))
>
> #view
> 
> get from echo
> 
> $("#your_button").on("click", function(){
> url_ajax = "{{=URL("your_controler", "echo")}}"
> ajax(url_ajax, [], ":eval"))
> })
> 
>
>
>
>
> Em ter, 21 de mai de 2019 às 19:43, Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com> escreveu:
>
>> I am very familiar with controllers/views/helpers the way you just
>> specified, but it doesn't help me because here is my context:
>> I am using ajax function from JavaScript, as a response to a certain
>> event on the page. This ajax is called with :eval option which allows me to
>> construct actual JavaScript string to be executed (the one that in my
>> example represented by result+=...); the reason I can't use a regular JS
>> ajax call which replaces html element is because I specifically need to
>> update multiple targets, so :eval is my only option). I can't use regular
>> {{...}} embeds either, because I can't reload the page - need to update
>> multiple html elements on the fly, in ajax mode.
>> That's why my only option seems to be constructing JavaScript which
>> executes the necessary updates on the page as a sequel to JavaScript
>> ajax(:eval) call. This is exactly how I ended up constructing JavaScript in
>> my controller function and the need to mix in some web2py objects in it.
>>
>> On Tue, May 21, 2019, 6:24 PM villas  wrote:
>>
>>> Not sure what you are trying to do, work in the controller or view, or
>>> why you are trying to append with JS.
>>>
>>> Maybe you could learn to use the web2py helpers...
>>> e.g. controller
>>> def example():
>>> cart = db(db.cart).select().as_list()
>>> mydiv = DIV(cart, _id='Debug_Discount' )
>>> return dict(mydiv=mydiv)
>>>
>>> view  example.html
>>> {{=mydiv}}
>>>
>>> OR
>>> e.g. controller
>>> def example():
>>> cart = db(db.cart).select()
>>> mydiv = DIV(_id='Debug_Discount' )
>>> return dict(mydiv=mydiv, rows=rows)
>>>
>>> view  example.html
>>> {{=mydiv}}
>>> 
>>> 
>>> {{ =ASSIGNJS(cart) }}
>>> $('#Debug_Discount').html(cart);
>>> 
>>>
>>> Not sure whether any of the above will work or help,  but just
>>> experiment until you learn how best to mix it all together.
>>>
>>>
>>>
>>> On Tuesday, 21 May 2019 17:40:59 UTC+1, Vlad wrote:

 ALMOST :)

 result += ASSIGNJS(cart=cart)
 result += "$('#Debug_Discount').append(''+cart+'');"

 this comes out as [object Object]

 But generated Javascript (as far as the object's content is concerned)
 seems right - I think I am missing the final touch, some javascript trick
 that would print it fully.

 Here is actual Javascript generated:

 $('#Debug_Discount').append('');
 var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1,
 "price": 3000, "imported": null, "is_active": true, "created_on":
 "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17
 15:47:52", "modified_by": 1}];
 $('#Debug_Discount').append(''+cart+'');.

 Good ideas on final touch?

 On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>
> Maybe this:  ASSIGNJS
>
> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>
>
>
> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>>
>> I am calling ajax function with :eval and setting up some javascript
>> [from the controller] to be executed [as per :eval option js is executed 
>> in
>> the end], something like this:
>>
>> result = "$('#DebugID').append('"
>> result += "CONTENT"
>> result += "');"
>> return result
>>
>> Now, this works, and it displays CONTENT at the right place.
>>
>> But here is a catch: instead of "CONTENT" I want it to display an
>> object, for example Rows object which is returned by db.select.
>> In other words, whatever comes out when {{=rows}} is specified in
>> html view, I want to send via javascript.
>>
>> Obviously, the following 2 options are grossly incorrect and don't
>> work, for obvious reasons:
>>result += XML(rows)
>>result += "={{rows}}"
>>
>> So, how do I make the stuff display properly as passed over vial
>> javascript?
>>
>>
> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> 

Re: [web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Junior Phanter
# controller return javascript(Jquery) to eval
def echo:
import json
return "$('#target').html(%s)" %(json.dumps(DIV("Hello",
STRONG("world"), "Escape this?").xml()))

#view

get from echo

$("#your_button").on("click", function(){
url_ajax = "{{=URL("your_controler", "echo")}}"
ajax(url_ajax, [], ":eval"))
})





Em ter, 21 de mai de 2019 às 19:43, Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> escreveu:

> I am very familiar with controllers/views/helpers the way you just
> specified, but it doesn't help me because here is my context:
> I am using ajax function from JavaScript, as a response to a certain event
> on the page. This ajax is called with :eval option which allows me to
> construct actual JavaScript string to be executed (the one that in my
> example represented by result+=...); the reason I can't use a regular JS
> ajax call which replaces html element is because I specifically need to
> update multiple targets, so :eval is my only option). I can't use regular
> {{...}} embeds either, because I can't reload the page - need to update
> multiple html elements on the fly, in ajax mode.
> That's why my only option seems to be constructing JavaScript which
> executes the necessary updates on the page as a sequel to JavaScript
> ajax(:eval) call. This is exactly how I ended up constructing JavaScript in
> my controller function and the need to mix in some web2py objects in it.
>
> On Tue, May 21, 2019, 6:24 PM villas  wrote:
>
>> Not sure what you are trying to do, work in the controller or view, or
>> why you are trying to append with JS.
>>
>> Maybe you could learn to use the web2py helpers...
>> e.g. controller
>> def example():
>> cart = db(db.cart).select().as_list()
>> mydiv = DIV(cart, _id='Debug_Discount' )
>> return dict(mydiv=mydiv)
>>
>> view  example.html
>> {{=mydiv}}
>>
>> OR
>> e.g. controller
>> def example():
>> cart = db(db.cart).select()
>> mydiv = DIV(_id='Debug_Discount' )
>> return dict(mydiv=mydiv, rows=rows)
>>
>> view  example.html
>> {{=mydiv}}
>> 
>> 
>> {{ =ASSIGNJS(cart) }}
>> $('#Debug_Discount').html(cart);
>> 
>>
>> Not sure whether any of the above will work or help,  but just experiment
>> until you learn how best to mix it all together.
>>
>>
>>
>> On Tuesday, 21 May 2019 17:40:59 UTC+1, Vlad wrote:
>>>
>>> ALMOST :)
>>>
>>> result += ASSIGNJS(cart=cart)
>>> result += "$('#Debug_Discount').append(''+cart+'');"
>>>
>>> this comes out as [object Object]
>>>
>>> But generated Javascript (as far as the object's content is concerned)
>>> seems right - I think I am missing the final touch, some javascript trick
>>> that would print it fully.
>>>
>>> Here is actual Javascript generated:
>>>
>>> $('#Debug_Discount').append('');
>>> var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1,
>>> "price": 3000, "imported": null, "is_active": true, "created_on":
>>> "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17
>>> 15:47:52", "modified_by": 1}];
>>> $('#Debug_Discount').append(''+cart+'');.
>>>
>>> Good ideas on final touch?
>>>
>>> On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:

 Maybe this:  ASSIGNJS

 http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS



 On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>
> I am calling ajax function with :eval and setting up some javascript
> [from the controller] to be executed [as per :eval option js is executed 
> in
> the end], something like this:
>
> result = "$('#DebugID').append('"
> result += "CONTENT"
> result += "');"
> return result
>
> Now, this works, and it displays CONTENT at the right place.
>
> But here is a catch: instead of "CONTENT" I want it to display an
> object, for example Rows object which is returned by db.select.
> In other words, whatever comes out when {{=rows}} is specified in html
> view, I want to send via javascript.
>
> Obviously, the following 2 options are grossly incorrect and don't
> work, for obvious reasons:
>result += XML(rows)
>result += "={{rows}}"
>
> So, how do I make the stuff display properly as passed over vial
> javascript?
>
>
 --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/oGAP28q6c_Q/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> 

Re: [web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Eliezer (Vlad) Tseytkin
I am very familiar with controllers/views/helpers the way you just
specified, but it doesn't help me because here is my context:
I am using ajax function from JavaScript, as a response to a certain event
on the page. This ajax is called with :eval option which allows me to
construct actual JavaScript string to be executed (the one that in my
example represented by result+=...); the reason I can't use a regular JS
ajax call which replaces html element is because I specifically need to
update multiple targets, so :eval is my only option). I can't use regular
{{...}} embeds either, because I can't reload the page - need to update
multiple html elements on the fly, in ajax mode.
That's why my only option seems to be constructing JavaScript which
executes the necessary updates on the page as a sequel to JavaScript
ajax(:eval) call. This is exactly how I ended up constructing JavaScript in
my controller function and the need to mix in some web2py objects in it.

On Tue, May 21, 2019, 6:24 PM villas  wrote:

> Not sure what you are trying to do, work in the controller or view, or why
> you are trying to append with JS.
>
> Maybe you could learn to use the web2py helpers...
> e.g. controller
> def example():
> cart = db(db.cart).select().as_list()
> mydiv = DIV(cart, _id='Debug_Discount' )
> return dict(mydiv=mydiv)
>
> view  example.html
> {{=mydiv}}
>
> OR
> e.g. controller
> def example():
> cart = db(db.cart).select()
> mydiv = DIV(_id='Debug_Discount' )
> return dict(mydiv=mydiv, rows=rows)
>
> view  example.html
> {{=mydiv}}
> 
> 
> {{ =ASSIGNJS(cart) }}
> $('#Debug_Discount').html(cart);
> 
>
> Not sure whether any of the above will work or help,  but just experiment
> until you learn how best to mix it all together.
>
>
>
> On Tuesday, 21 May 2019 17:40:59 UTC+1, Vlad wrote:
>>
>> ALMOST :)
>>
>> result += ASSIGNJS(cart=cart)
>> result += "$('#Debug_Discount').append(''+cart+'');"
>>
>> this comes out as [object Object]
>>
>> But generated Javascript (as far as the object's content is concerned)
>> seems right - I think I am missing the final touch, some javascript trick
>> that would print it fully.
>>
>> Here is actual Javascript generated:
>>
>> $('#Debug_Discount').append('');
>> var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1,
>> "price": 3000, "imported": null, "is_active": true, "created_on":
>> "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17
>> 15:47:52", "modified_by": 1}];
>> $('#Debug_Discount').append(''+cart+'');.
>>
>> Good ideas on final touch?
>>
>> On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>>>
>>> Maybe this:  ASSIGNJS
>>>
>>> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>>>
>>>
>>>
>>> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:

 I am calling ajax function with :eval and setting up some javascript
 [from the controller] to be executed [as per :eval option js is executed in
 the end], something like this:

 result = "$('#DebugID').append('"
 result += "CONTENT"
 result += "');"
 return result

 Now, this works, and it displays CONTENT at the right place.

 But here is a catch: instead of "CONTENT" I want it to display an
 object, for example Rows object which is returned by db.select.
 In other words, whatever comes out when {{=rows}} is specified in html
 view, I want to send via javascript.

 Obviously, the following 2 options are grossly incorrect and don't
 work, for obvious reasons:
result += XML(rows)
result += "={{rows}}"

 So, how do I make the stuff display properly as passed over vial
 javascript?


>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/oGAP28q6c_Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/c5abcf26-bfd9-4461-baea-2f62ea695d61%40googlegroups.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 

Re: [web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Eliezer (Vlad) Tseytkin
Could you please clarify:

You mentioned {{=json.dumps()}} which looks like code executed in Python.
But in "result+=" I am constructing an expression which is actually
executed in JavaScript. Did you mistype or I'm missing something?

On Tue, May 21, 2019, 5:59 PM Junior Phanter  wrote:

> resultado + = {{=json.dumps(DIV().xml())}}
>
> Em ter, 21 de mai de 2019 às 13:41, Vlad 
> escreveu:
>
>> ALMOST :)
>>
>> result += ASSIGNJS(cart=cart)
>> result += "$('#Debug_Discount').append(''+cart+'');"
>>
>> this comes out as [object Object]
>>
>> But generated Javascript (as far as the object's content is concerned)
>> seems right - I think I am missing the final touch, some javascript trick
>> that would print it fully.
>>
>> Here is actual Javascript generated:
>>
>> $('#Debug_Discount').append('');
>> var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1,
>> "price": 3000, "imported": null, "is_active": true, "created_on":
>> "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17
>> 15:47:52", "modified_by": 1}];
>> $('#Debug_Discount').append(''+cart+'');.
>>
>> Good ideas on final touch?
>>
>> On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>>>
>>> Maybe this:  ASSIGNJS
>>>
>>> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>>>
>>>
>>>
>>> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:

 I am calling ajax function with :eval and setting up some javascript
 [from the controller] to be executed [as per :eval option js is executed in
 the end], something like this:

 result = "$('#DebugID').append('"
 result += "CONTENT"
 result += "');"
 return result

 Now, this works, and it displays CONTENT at the right place.

 But here is a catch: instead of "CONTENT" I want it to display an
 object, for example Rows object which is returned by db.select.
 In other words, whatever comes out when {{=rows}} is specified in html
 view, I want to send via javascript.

 Obviously, the following 2 options are grossly incorrect and don't
 work, for obvious reasons:
result += XML(rows)
result += "={{rows}}"

 So, how do I make the stuff display properly as passed over vial
 javascript?


>>> --
>> 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/e69e8fd8-8a75-4d00-8c65-3b299ee6e80c%40googlegroups.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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/oGAP28q6c_Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAFoqysjxno08Yu6bUY9CK46tMP8ZBvDPUXrdOcYH0qPWDz%3DZvg%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCBTPLm3n1jELAP9o9uheivpaBNJER_-KykjjochhcGzaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread villas
Not sure what you are trying to do, work in the controller or view, or why 
you are trying to append with JS.

Maybe you could learn to use the web2py helpers...
e.g. controller
def example():
cart = db(db.cart).select().as_list()
mydiv = DIV(cart, _id='Debug_Discount' )
return dict(mydiv=mydiv)

view  example.html
{{=mydiv}}

OR
e.g. controller
def example():
cart = db(db.cart).select()
mydiv = DIV(_id='Debug_Discount' )
return dict(mydiv=mydiv, rows=rows)

view  example.html
{{=mydiv}}


{{ =ASSIGNJS(cart) }}
$('#Debug_Discount').html(cart);


Not sure whether any of the above will work or help,  but just experiment 
until you learn how best to mix it all together. 



On Tuesday, 21 May 2019 17:40:59 UTC+1, Vlad wrote:
>
> ALMOST :)
>
> result += ASSIGNJS(cart=cart)
> result += "$('#Debug_Discount').append(''+cart+'');"
>
> this comes out as [object Object]
>
> But generated Javascript (as far as the object's content is concerned) 
> seems right - I think I am missing the final touch, some javascript trick 
> that would print it fully.
>
> Here is actual Javascript generated:
>
> $('#Debug_Discount').append('');
> var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1, 
> "price": 3000, "imported": null, "is_active": true, "created_on": 
> "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17 
> 15:47:52", "modified_by": 1}];
> $('#Debug_Discount').append(''+cart+'');. 
>
> Good ideas on final touch? 
>
> On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>>
>> Maybe this:  ASSIGNJS
>>
>> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>>
>>
>>
>> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>>>
>>> I am calling ajax function with :eval and setting up some javascript 
>>> [from the controller] to be executed [as per :eval option js is executed in 
>>> the end], something like this: 
>>>
>>> result = "$('#DebugID').append('"
>>> result += "CONTENT"
>>> result += "');"
>>> return result
>>>
>>> Now, this works, and it displays CONTENT at the right place. 
>>>
>>> But here is a catch: instead of "CONTENT" I want it to display an 
>>> object, for example Rows object which is returned by db.select. 
>>> In other words, whatever comes out when {{=rows}} is specified in html 
>>> view, I want to send via javascript. 
>>>
>>> Obviously, the following 2 options are grossly incorrect and don't work, 
>>> for obvious reasons:  
>>>result += XML(rows)
>>>result += "={{rows}}"
>>>
>>> So, how do I make the stuff display properly as passed over vial 
>>> javascript? 
>>>  
>>>
>>

-- 
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/c5abcf26-bfd9-4461-baea-2f62ea695d61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Junior Phanter
 resultado + = {{=json.dumps(DIV().xml())}}

Em ter, 21 de mai de 2019 às 13:41, Vlad  escreveu:

> ALMOST :)
>
> result += ASSIGNJS(cart=cart)
> result += "$('#Debug_Discount').append(''+cart+'');"
>
> this comes out as [object Object]
>
> But generated Javascript (as far as the object's content is concerned)
> seems right - I think I am missing the final touch, some javascript trick
> that would print it fully.
>
> Here is actual Javascript generated:
>
> $('#Debug_Discount').append('');
> var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1,
> "price": 3000, "imported": null, "is_active": true, "created_on":
> "2019-05-17 15:47:52", "created_by": 1, "modified_on": "2019-05-17
> 15:47:52", "modified_by": 1}];
> $('#Debug_Discount').append(''+cart+'');.
>
> Good ideas on final touch?
>
> On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>>
>> Maybe this:  ASSIGNJS
>>
>> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>>
>>
>>
>> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>>>
>>> I am calling ajax function with :eval and setting up some javascript
>>> [from the controller] to be executed [as per :eval option js is executed in
>>> the end], something like this:
>>>
>>> result = "$('#DebugID').append('"
>>> result += "CONTENT"
>>> result += "');"
>>> return result
>>>
>>> Now, this works, and it displays CONTENT at the right place.
>>>
>>> But here is a catch: instead of "CONTENT" I want it to display an
>>> object, for example Rows object which is returned by db.select.
>>> In other words, whatever comes out when {{=rows}} is specified in html
>>> view, I want to send via javascript.
>>>
>>> Obviously, the following 2 options are grossly incorrect and don't work,
>>> for obvious reasons:
>>>result += XML(rows)
>>>result += "={{rows}}"
>>>
>>> So, how do I make the stuff display properly as passed over vial
>>> javascript?
>>>
>>>
>> --
> 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/e69e8fd8-8a75-4d00-8c65-3b299ee6e80c%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAFoqysjxno08Yu6bUY9CK46tMP8ZBvDPUXrdOcYH0qPWDz%3DZvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Rows class constructor question

2019-05-21 Thread Eliezer (Vlad) Tseytkin
Got it,
Thank you very much!

On Tue, May 21, 2019, 2:09 PM Leonel Câmara  wrote:

> It basically has to do with python namespaces. You did not import Rows
> into your current namespace. The definition is there in the context where
> the select rows were created but in your namespace you could have another
> Rows definition that is quite different or none at all. Web2py imports a
> lot of stuff automatically so I can see how that can create confusion when
> something isn't automatically available but that's just the way regular
> python works.
>
>
> https://code.tutsplus.com/tutorials/what-are-python-namespaces-and-why-are-they-needed--cms-28598
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/C31RurYvstc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/4155af72-1560-4c72-8567-1481329b6e4a%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCBnVEh%2BonWcFKVaMLrXjwG87KmuxZAgkpd1oYOnGH7C7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread Leonel Câmara
It basically has to do with python namespaces. You did not import Rows into 
your current namespace. The definition is there in the context where the 
select rows were created but in your namespace you could have another Rows 
definition that is quite different or none at all. Web2py imports a lot of 
stuff automatically so I can see how that can create confusion when 
something isn't automatically available but that's just the way regular 
python works.

https://code.tutsplus.com/tutorials/what-are-python-namespaces-and-why-are-they-needed--cms-28598

-- 
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/4155af72-1560-4c72-8567-1481329b6e4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread Vlad
Yeah, I am just trying to understand why it doesn't work without explicit 
import. Missing basics here:
if rows=db.select() works and rows is known to be an instance of the class 
Rows, and Rows is recognized as a class and can be used to some extent 
(obviously, I am using it already, in rows=db.select() and beyond, without 
importing explicitly), what does it mean then that I can't use it? I mean, 
it's either visible or invisible. If it's already visible as a specific 
class, without being imported, why are its methods still invisible and 
require explicit import statement? I am suspecting that I am missing 
something very basic about namespaces. Earlier Leonel explained it, but I 
didn't understand the explanation. 

On Tuesday, May 21, 2019 at 11:52:23 AM UTC-4, villas wrote:
>
> rows = pydal.objects.Rows()
>
>
> On Tuesday, 21 May 2019 04:14:45 UTC+1, Vlad wrote:
>>
>> I must be missing something very basic here... 
>>
>> Want to create an empty Rows object, and then to append to it sets of 
>> rows from various sql queries with the same structure of the result sets. 
>>
>> The first line in the code (in a controller) is
>>  rows = Rows()
>> with an intention of creating an empty Rows object. 
>>
>> This gives an error:  name 'Rows' is not defined
>>
>> Why is that? Why can't I create an empty Rows object? 
>>
>>
>>
>>

-- 
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/8101cfd8-6754-44f2-9345-f89c076b6936%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread Vlad
ALMOST :)

result += ASSIGNJS(cart=cart)
result += "$('#Debug_Discount').append(''+cart+'');"

this comes out as [object Object]

But generated Javascript (as far as the object's content is concerned) 
seems right - I think I am missing the final touch, some javascript trick 
that would print it fully.

Here is actual Javascript generated:

$('#Debug_Discount').append('');
var cart = [{"id": 125, "cart": 40, "product": 161, "quantity": 1, "price": 
3000, "imported": null, "is_active": true, "created_on": "2019-05-17 
15:47:52", "created_by": 1, "modified_on": "2019-05-17 15:47:52", 
"modified_by": 1}];
$('#Debug_Discount').append(''+cart+'');. 

Good ideas on final touch? 

On Tuesday, May 21, 2019 at 11:34:54 AM UTC-4, villas wrote:
>
> Maybe this:  ASSIGNJS
>
> http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS
>
>
>
> On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>>
>> I am calling ajax function with :eval and setting up some javascript 
>> [from the controller] to be executed [as per :eval option js is executed in 
>> the end], something like this: 
>>
>> result = "$('#DebugID').append('"
>> result += "CONTENT"
>> result += "');"
>> return result
>>
>> Now, this works, and it displays CONTENT at the right place. 
>>
>> But here is a catch: instead of "CONTENT" I want it to display an object, 
>> for example Rows object which is returned by db.select. 
>> In other words, whatever comes out when {{=rows}} is specified in html 
>> view, I want to send via javascript. 
>>
>> Obviously, the following 2 options are grossly incorrect and don't work, 
>> for obvious reasons:  
>>result += XML(rows)
>>result += "={{rows}}"
>>
>> So, how do I make the stuff display properly as passed over vial 
>> javascript? 
>>  
>>
>

-- 
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/e69e8fd8-8a75-4d00-8c65-3b299ee6e80c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: authentication variables in url when login is incorrect

2019-05-21 Thread Fred Nikolayevich
Ok I think I found it:

In gluon/tools.py in the Auth.login() method the line 2643 has been changed 
from

redirect(self.url(args=request.args, vars=request.*get_vars*
),client_side=settings.client_side)

to

redirect(self.url(args=request.args, vars=request.*vars*
),client_side=settings.client_side)

Does anyone know why this was changed?

-- 
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/b6c882e7-98d3-4d12-b8d2-e92e17635db3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread villas
rows = pydal.objects.Rows()


On Tuesday, 21 May 2019 04:14:45 UTC+1, Vlad wrote:
>
> I must be missing something very basic here... 
>
> Want to create an empty Rows object, and then to append to it sets of rows 
> from various sql queries with the same structure of the result sets. 
>
> The first line in the code (in a controller) is
>  rows = Rows()
> with an intention of creating an empty Rows object. 
>
> This gives an error:  name 'Rows' is not defined
>
> Why is that? Why can't I create an empty Rows object? 
>
>
>
>

-- 
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/0be8456d-3d39-4929-98e1-0751a4bb7c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] authentication variables in url when login is incorrect

2019-05-21 Thread Fred Nikolayevich
Hi,

I have a problem with the ldap auth since I upgraded my application from 
web2py 2.14.6 on Python 2.7 to the current web2py 2.18.5 on Python 3.7.

In the old version when I logged in with incorrect credentials it would 
reload the login page:

http://localhost/app/default/user/login?_next=%2Fapp%2Fdefault%2Findex#

on the new version the login form's variables are displayed in the url

http://localhost/app/default/user/login?_formkey=33179672-fd5f-49c3-86c7-d5ebf7ca375c&_formname=login&_next=%2Fapp%2Fdefault%2Findex=my_secret_password=my_boring_username#

I have not really changed anything in the app, only the fixed the syntax 
for Python 3.

I was looking through the Auth and related classes in gluon, but I cannot 
figure out what may have changed and I am not that knowledgeable about how 
html forms work to produce this behaviour.

I am generating the auth form with the basic 'form=auth()' in the user 
controller/view.

Any ideas?

Many thanks!

Fred

-- 
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/f1223697-9436-4d33-9dd3-ed27a39d46c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-21 Thread En Ware
That was it thanks. 

On Tuesday, May 21, 2019 at 10:05:56 AM UTC-5, Massimo Di Pierro wrote:
>
> There should be web3py folder in /tmp delete it and restart

-- 
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/9d0d7233-8c2b-4d87-888b-63e61dc417c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: javascript from ajax with :eval question

2019-05-21 Thread villas
Maybe this:  ASSIGNJS

http://www.web2py.com/books/default/chapter/29/05/the-views#ASSIGNJS



On Tuesday, 21 May 2019 15:43:25 UTC+1, Vlad wrote:
>
> I am calling ajax function with :eval and setting up some javascript [from 
> the controller] to be executed [as per :eval option js is executed in the 
> end], something like this: 
>
> result = "$('#DebugID').append('"
> result += "CONTENT"
> result += "');"
> return result
>
> Now, this works, and it displays CONTENT at the right place. 
>
> But here is a catch: instead of "CONTENT" I want it to display an object, 
> for example Rows object which is returned by db.select. 
> In other words, whatever comes out when {{=rows}} is specified in html 
> view, I want to send via javascript. 
>
> Obviously, the following 2 options are grossly incorrect and don't work, 
> for obvious reasons:  
>result += XML(rows)
>result += "={{rows}}"
>
> So, how do I make the stuff display properly as passed over vial 
> javascript? 
>  
>

-- 
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/311e1d62-0d13-41a8-8ebd-78f831a5aed8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-21 Thread Massimo Di Pierro
There should be web3py folder in /tmp delete it and restart

-- 
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/8de87389-2123-4a1e-9b2b-0db03bbd08a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] javascript from ajax with :eval question

2019-05-21 Thread Vlad
I am calling ajax function with :eval and setting up some javascript [from 
the controller] to be executed [as per :eval option js is executed in the 
end], something like this: 

result = "$('#DebugID').append('"
result += "CONTENT"
result += "');"
return result

Now, this works, and it displays CONTENT at the right place. 

But here is a catch: instead of "CONTENT" I want it to display an object, 
for example Rows object which is returned by db.select. 
In other words, whatever comes out when {{=rows}} is specified in html 
view, I want to send via javascript. 

Obviously, the following 2 options are grossly incorrect and don't work, 
for obvious reasons:  
   result += XML(rows)
   result += "={{rows}}"

So, how do I make the stuff display properly as passed over vial 
javascript? 
 

-- 
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/b5c204f4-6e99-4503-ab74-508d2d3a8bca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-21 Thread En Ware
./web3py-start apps/

 ___      __  __
|  / / / / __ |/___ \/ __ \ \/ /
| | / / /_  / /_/ /___/ / /_/ /\  /
| | /| / / __/ / __  //__  / / / /
| |/ |/ / /___/ /_/ /___/ / / / /
|___/|_/_/_/_/_/ /_/
It is still experimental...

Dashboard is at: http://127.0.0.1:8000/_dashboard
[OK] loaded _dashboard 
[OK] loaded myapp 
[OK] loaded todo 
[OK] loaded superheroes 
[OK] loaded examples 
[OK] loaded _scaffold 
Bottle v0.12.16 server starting up (using TornadoServer())...
Listening on http://127.0.0.1:8000/
Hit Ctrl-C to quit.

WARNING:tornado.access:404 GET / (127.0.0.1) 1.66ms
WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 1.11ms
ERROR:root:Traceback (most recent call last):
  File 
"/Users/aaronm/.pyenv/versions/3.6.4/envs/web3py/web3py/web3py/core.py", 
line 384, in wrapper
ret = func(*func_args, **func_kwargs)
  File 
"/Users/aaronm/.pyenv/versions/3.6.4/envs/web3py/web3py/apps/_dashboard/__init__.py",
 
line 116, in tickets
tickets = error_storage.get()
  File 
"/Users/aaronm/.pyenv/versions/3.6.4/envs/web3py/web3py/web3py/core.py", 
line 535, in get
list_rows = db(query).select(*fields, orderby=orderby, 
groupby=groupby).as_list()
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/objects.py",
 
line 2395, in select
return adapter.select(self.query, fields, attributes)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/sqlite.py",
 
line 82, in select
return super(SQLite, self).select(query, fields, attributes)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 763, in select
return self._select_aux(sql, fields, attributes, colnames)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 719, in _select_aux
rows = self._select_aux_execute(sql)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 713, in _select_aux_execute
self.execute(sql)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/__init__.py",
 
line 67, in wrap
return f(*args, **kwargs)
  File 
"/Users/aaronm/.pyenv/versions/web3py/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 413, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
sqlite3.OperationalError: no such table: web3py_error

WARNING:tornado.access:404 GET /todo/static/favicon.ico (127.0.0.1) 1.46ms
WARNING:tornado.access:404 GET /myapp/static/favicon.ico (127.0.0.1) 1.27ms
WARNING:tornado.access:404 GET /_scaffold/static/favicon.ico (127.0.0.1) 
1.48ms
WARNING:tornado.access:404 GET /superheroes/static/favicon.ico (127.0.0.1) 
1.24ms
WARNING:tornado.access:404 GET /examples/static/favicon.ico (127.0.0.1) 
1.43ms

On Tuesday, May 21, 2019 at 9:33:27 AM UTC-5, En Ware wrote:
>
> The only thing I did was:
>
> 1. git pull 
> 2. ./web3py-start apps/
>
> Thats all I did. 
>
> On Monday, May 20, 2019 at 3:08:26 PM UTC-5, 黄祥 wrote:
>>
>> Getting error missing table , sqlite3.OperationalError: no such table: 
>>> web3py_error
>>>
>>> _dashboard won't load at all. 
>>>
>>
>> could you please tell us steps to reproduce that error or show some code ?
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/024fb3b5-683d-4d3e-aa02-393a6fc60f35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-21 Thread En Ware
The only thing I did was:

1. git pull 
2. ./web3py-start apps/

Thats all I did. 

On Monday, May 20, 2019 at 3:08:26 PM UTC-5, 黄祥 wrote:
>
> Getting error missing table , sqlite3.OperationalError: no such table: 
>> web3py_error
>>
>> _dashboard won't load at all. 
>>
>
> could you please tell us steps to reproduce that error or show some code ?
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c95bb540-d81a-484e-ac10-6bb9f60bfae8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread Vlad
Leonel,
in your example, if "import peartree" doesn't bring in Pear (and thus Pear 
needs to be imported explicitly) - then... How is Pear accessible at all? I 
mean, if Pear is not accessible - then what's the difference between direct 
usage and indirect usage? I guess I am missing something basic on how 
namespaces work, but it seems straightforward to me: if rows=db.select() 
works and rows is known to be an instance of the class Rows, and Rows is 
recognized as a class and can be used, just... not directly??? I mean, it 
should be either visible or invisible, and if it's visible - everything 
about it is visible, and if it's invisible - everything about it should be 
invisible... So, how can it be that it's visible and recognized as a class, 
yet the details of this class are hidden - so it can be used partially but 
not fully?? I am mystified.  
Thank you for your patience :) 

On Tuesday, May 21, 2019 at 9:22:53 AM UTC-4, Leonel Câmara wrote:
>
> If you have a module called peartree.py which has only this
>
> class Pear:
> pass
>
>
> def shake():
> return Pear()
>
>
> If in another module you do:
>
> import peartree
>
>
> mypear = peartree.shake()
>
>
> mypear will be an instance of Pear, however Pear is not defined in this 
> context and you cannot use the class directly without going through the 
> peartree namespace. 
>
>

-- 
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/646b59a4-a583-4850-9d08-e091120cc274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread Leonel Câmara
If you have a module called peartree.py which has only this

class Pear:
pass


def shake():
return Pear()


If in another module you do:

import peartree


mypear = peartree.shake()


mypear will be an instance of Pear, however Pear is not defined in this 
context and you cannot use the class directly without going through the 
peartree namespace. 

-- 
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/b0b754cf-b87a-4b8c-9885-d4fc674fb9f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Rows class constructor question

2019-05-21 Thread Eliezer (Vlad) Tseytkin
Oops, I thought that if DAL is used extensively and all works already, all
the proper classes are already imported by the environment (otherwise how
can I run queries and do other db-related stuff without importing those
classes explicitly??) How can rows=db.select work and return 'rows', which
is an instance of the class Rows, if the class Rows is not imported and
thus not defined?? What am I missing?


On Tue, May 21, 2019, 8:31 AM Leonel Câmara  wrote:

> You need to import Rows from pydal.objects
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/C31RurYvstc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/6ea3bcf5-d419-453d-8a5d-837af3d661f9%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCD3WHacUFg2ug1z8DGTvmJiA2PD-QvvFXBPy9KWhn%2B3jA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rows class constructor question

2019-05-21 Thread Leonel Câmara
You need to import Rows from pydal.objects

-- 
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/6ea3bcf5-d419-453d-8a5d-837af3d661f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Using parse_as_rest: problem with cross joins?

2019-05-21 Thread Massimo Di Pierro
Will release at the end of the month

-- 
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/993d75f1-ac3c-467a-9fa6-ed0dca0f2d3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py Auth

2019-05-21 Thread villas
Many2many: I think a generic tagging api is a great idea in general for 
web3py.  If we can leverage that for auth groups too,  then why not.  
Clearly a link table adds complexity to all the queries, but if this is 
properly serviced by the api, then no prob.

Hierachical tagging,  nested sets always seem to be a real pain point for 
SQL unless recursive CTEs used.  But then things start getting a little 
tricky as the existing DAL doesn't do that (yet?).  There is still one easy 
option available though:  materialised path.  I think this is a great idea 
because the queries are super-simple and could easily be implemented for 
all sorts of hierarchical data structures.

The above options would be more than I suggested for auth groups, but would 
both enhance the feature-set of web3py and find lots of applications.

Thanks for thinking about these possibilities!



On Tuesday, 21 May 2019 04:31:06 UTC+1, Massimo Di Pierro wrote:
>
> I am thinking for something. I am thinking of a generic tagging api which 
> wold allow you to tag any object using efficient many2many and use 
> hierarchical tags.
> You would be able to tag users with group tags and efficiently search 
> groups for users and users by group. I have a prototype but it will not go 
> into the auth.py module.
> would that be ok?
>
>
> On Monday, 20 May 2019 08:35:21 UTC-7, villas wrote:
>>
>> Hi Massimo
>> Thanks for the auth implementation.  However, I personally think Groups 
>> are an essential feature of any auth.
>>
>> As a suggestion, could you please consider at least a slimmed-down 
>> version of Groups.  I am thinking simply this:
>>
>>- Extra field:  auth_user.group_ids list:reference
>>- Table:  auth_group,  (id, name)
>>- Function:  is_user_in_groups(user=auth.user, groups=[], all=True) 
>>   - if all==False* then 'any'* 
>>   - groups could be list of ids or names   
>>   
>> Many thanks for your consideration!  D
>>
>>

-- 
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/6e548bc2-7b9d-4840-b015-e1084ec4b2ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py Auth

2019-05-21 Thread Leonel Câmara
I use the groups and permissions mechanics extensively in my applications. 
They're useful for lots of stuff. Sharing can be as simple as giving 
permission for a record. I also use tags for the same purpose but they're 
better for stuff which will be changing based on properties of an entity 
instead of explicit permissions. I think there should be both. Note that 
RBAC is kind of a standard that people understand, and while you can 
implement it with tags it's not so straightforward and easy to understand 
in practice because tags tend to originate a kind of spaghetti that makes 
understanding how the system works murkier.  

-- 
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/9afb6012-78d8-4294-b674-e2d69db98fbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Add button to smartgrid?

2019-05-21 Thread rāma
Or better:

links=dict(meter_list=[lambda row:
   A(
   [SPAN(_class="menu-icon fa fa-paper-plane"),
SPAN("Go To "+str(row.id), _class="buttontext 
button", _title="GoTo")]
   , _href="TEST", _class="button btn btn-default 
btn-secondary")]
   ))


you can get the row properties into your button. But, what I am not sure is 
how to control where it appears in the table. Right now, by default, it 
appears before table referencing links.

On Tuesday, 21 May 2019 15:52:57 UTC+8, rāma wrote:
>
> I used:
>
> for x in grid.elements('td.row_buttons'):
> x.insert(4, A(
> [SPAN(_class="menu-icon fa fa-paper-plane"), SPAN("Go To", 
> _class="buttontext button", _title="GoTo")]
> , _href="TEST", _class="button btn btn-default btn-secondary"))
>
>
> This is specific to my needs, you may not want those span and class 
> attributes. It creates a Go To button after view, edit, and delete if its 
> turned on.
>
> On Thursday, 27 June 2013 02:42:26 UTC+8, Jim S wrote:
>>
>> Where in the smartgrid do you need to add it?  Can you just have a custom 
>> view?  Maybe post some code or pics to show what you're trying to 
>> accomplish.
>>
>> -Jim
>>
>>
>> On Wednesday, June 26, 2013 10:51:02 AM UTC-5, Tom Russell wrote:
>>>
>>> I need to add a button to the smartgrid but not like doing create=True 
>>> because I have a form factory that has 2 other tables associated with the 
>>> one. I know in html I can simply add a line for a button but since I am not 
>>> using html for this how would I add a button to that page to reference my 
>>> own view?
>>>
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/08edeae4-0ee0-4ec8-b045-1a7b2b8c06fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Add button to smartgrid?

2019-05-21 Thread rāma
I used:

for x in grid.elements('td.row_buttons'):
x.insert(4, A(
[SPAN(_class="menu-icon fa fa-paper-plane"), SPAN("Go To", 
_class="buttontext button", _title="GoTo")]
, _href="TEST", _class="button btn btn-default btn-secondary"))


This is specific to my needs, you may not want those span and class 
attributes. It creates a Go To button after view, edit, and delete if its 
turned on.

On Thursday, 27 June 2013 02:42:26 UTC+8, Jim S wrote:
>
> Where in the smartgrid do you need to add it?  Can you just have a custom 
> view?  Maybe post some code or pics to show what you're trying to 
> accomplish.
>
> -Jim
>
>
> On Wednesday, June 26, 2013 10:51:02 AM UTC-5, Tom Russell wrote:
>>
>> I need to add a button to the smartgrid but not like doing create=True 
>> because I have a form factory that has 2 other tables associated with the 
>> one. I know in html I can simply add a line for a button but since I am not 
>> using html for this how would I add a button to that page to reference my 
>> own view?
>>
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b2f16592-a375-41d9-9dfd-7a549b25a628%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.