Re: [web2py] Re: Future of web2py

2018-11-21 Thread 黄祥
another alternative for vue admin:
https://github.com/PanJiaChen/vue-element-admin

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: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-21 Thread BigBaaadBob
The use case is manufacturing. Large complicated manufacturing with special 
requirements. And SAP need not apply... :-)

On Wednesday, November 21, 2018 at 1:26:56 PM UTC-8, Dave S wrote:
>
>
>
> On Wednesday, November 21, 2018 at 10:33:13 AM UTC-8, BigBaaadBob wrote:
>>
>> I'm just trying to find a good solid way of doing the BOM pattern using 
>> the DAL, and pretty much all of the decent articles I've found say the 
>> Closure Table method is the best trade-off, especially for large-ish and 
>> deep-ish BOM structures. 
>>
>
> It would be interesting to hear your use case.  Are you into a scheduling 
> problem like the airport/flight example?  Or an organizational example 
> where you need to quickly find the director in the hierarchy above one us 
> grunts?
>
>
>> But, I'm not dogmatic. How would you code up a version using "with 
>> recursive" queries using the DAL? If you post a running example it would be 
>> great at informing the group!
>>
>> On Wednesday, November 21, 2018 at 9:56:48 AM UTC-8, Val K wrote:
>>>
>>> Why do you have to use this crutches (despite they are genius)? Now, 
>>> even Sqlite3 supports 'with recursive' queries.
>>> And what do you mean under BOM  and large tree? If we are talking about 
>>> BOM of  real (physical) object like a car or even an aircraft carrier, I 
>>> think  it is not large tree
>>>  only if you don't want to have BOAOM (bill of atoms of materials) 
>>>
>>>
> My BOM experience is more with circuit boards, and there would probably a 
> dozen part numbers for resistors and and a dozen part numbers for 
> capacitors, and more than a dozen ICs.  But there could be a dozen or a 
> hundred boards using part X, and if you need to figure out which boards are 
> affected when the manufacturer stops manuffing the part, it starts getting 
> interesting.  If you also make boxes the boards go into, then the hierarchy 
> gains another level (although not many entries at that level).
>
>  
>
>> On Wednesday, November 21, 2018 at 7:58:48 PM UTC+3, BigBaaadBob wrote:

 I went ahead and coded something up, inspired by Massimo's Preorder 
 Traversal example. I wouldn't be offended if people suggest how to make it 
 better/faster, perhaps by combining stuff in the Link function into one 
 query instead of many.

 # Demonstrate closure tables. Deletion of nodes is left as an exercise 
 to the reader.
 # See: 
 http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
  

 from gluon import DAL, Field

 db=DAL('sqlite://closure.db') 

 db.define_table(
 'thing',
 db.Field('name')
 )
 db.thing.truncate()

 db.define_table(
 'closure',
 db.Field('parent', type='reference thing'),
 db.Field('child', type='reference thing'),
 db.Field('depth', type='integer')
 )
 db.closure.truncate()

 def link(parent_id,child_id):
 """ link(1,3) """
 p = db.closure.with_alias('p')
 c = db.closure.with_alias('c')
 rows = db((p.child==parent_id) & (c.parent==child_id)).select(
 p.parent.with_alias('parent'),
 c.child.with_alias('child'),
 (p.depth+c.depth+1).with_alias('depth'))
 for row in rows:
 db.closure.insert(parent=row.parent, child=row.child, 
 depth=row.depth)
 
 def add_node(name,parent_name): 
 """ add_node('Fruit','Food') """
 child_id=db.thing.insert(name=name)
 db.closure.insert(parent=child_id, child=child_id, depth=0)
 if parent_name is not None:
 parent_id=db(db.thing.name==parent_name).select().first().id
 link(parent_id, child_id)
 
 def ancestors(name): 
 """ print ancestors('Red')""" 
 node=db(db.thing.name==name).select().first()
 return db((db.closure.child==node.id) & (db.closure.parent != 
 node.id)).select(
 db.thing.name, left=db.thing.on(db.thing.id==db.closure.parent), 
 orderby=db.closure.depth)

 def descendants(name): 
 """ print descendants('Fruit')""" 
 node=db(db.thing.name==name).select().first()
 return db((db.closure.parent==node.id) & (db.closure.child != 
 node.id)).select(
 db.thing.name, left=db.thing.on(db.thing.id==db.closure.child), 
 orderby=db.closure.depth)

 def closure():
 """ print closure() """
 parent = db.thing.with_alias('parent')
 child = db.thing.with_alias('child')
 return db().select(db.closure.id, parent.name, child.name, 
 db.closure.depth,
left=(parent.on(parent.id == db.closure.parent),
  child.on(child.id == db.closure.child)))

 def test(): 
 add_node('Food',None) 
 db.commit()
 print closure()

 add_node('Vehicle',None) 
 db.commit()
 

[web2py] Vuepy = Vue.js - (NOde.js + webpack) + RapydScript_in_browser + CodeMirror

2018-11-21 Thread Val K
I did it! 
just try  https://valq7711.github.io/vuepy/demo/

-- 
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: Migrations

2018-11-21 Thread Dave S


On Wednesday, November 21, 2018 at 5:32:29 AM UTC-8, Ben Duncan wrote:
>
> Ok, I turned migration on for tables, and it gave errors because of 
> foreign keyes. 
> Everything looks exactly like the docs spell out.
>
> I'm not sure I see the reasoning for the stuff in directory 'database'.
>

It's the DAL's representation of the schema, with hints on how to translate 
it for the flavor of DB backend in use (through a driver, like pgsql).  If 
the table changes (in models/mytables.py), the migrate steps update the 
database/*.table files and generate the appropriate SQL instructions to get 
the backend to match.  Fake migrate skips the generate, and is used when 
the changes already are in place on the backend.
 

>
> I'm going ahead putting back migration=False on all the tables, since It 
> works that way and these
> are external tables.
>
> Anyone see any problems with that ?
>
>
Productiion should normally have migration=False.  When it is needed, it 
only needs to be True for one access (barring errors).

 

> Thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>

/dps
 

>
> On Wed, Nov 21, 2018 at 6:57 AM Ben Duncan  > wrote:
>
>> I tried enable fake migrations (Backend has tables), nothing was created 
>> in databases, but everything works as it should ..
>> *Ben Duncan*
>> DBA / Chief Software Architect 
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Tue, Nov 20, 2018 at 4:20 PM Dave S > 
>> wrote:
>>
>>>
>>>
>>> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:

 Is it necessary to enable or even do migrations in the DAL (creating 
 database/ entries) if the database and the tables are already preexisting 
 ? 

 Thanks ...

 *Ben Duncan*
 DBA / Chief Software Architect 
 Mississippi State Supreme Court
 Electronic Filing Division

>>>
>>>
>>> Let's see if I get it right:
>>>
>>> new table design: enable migrations
>>> new field in existing design: enable migrations
>>> new definition, backend has table:enable fake_migrations
>>>
>>> /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+un...@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: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-21 Thread Dave S


On Wednesday, November 21, 2018 at 10:33:13 AM UTC-8, BigBaaadBob wrote:
>
> I'm just trying to find a good solid way of doing the BOM pattern using 
> the DAL, and pretty much all of the decent articles I've found say the 
> Closure Table method is the best trade-off, especially for large-ish and 
> deep-ish BOM structures. 
>

It would be interesting to hear your use case.  Are you into a scheduling 
problem like the airport/flight example?  Or an organizational example 
where you need to quickly find the director in the hierarchy above one us 
grunts?


> But, I'm not dogmatic. How would you code up a version using "with 
> recursive" queries using the DAL? If you post a running example it would be 
> great at informing the group!
>
> On Wednesday, November 21, 2018 at 9:56:48 AM UTC-8, Val K wrote:
>>
>> Why do you have to use this crutches (despite they are genius)? Now, even 
>> Sqlite3 supports 'with recursive' queries.
>> And what do you mean under BOM  and large tree? If we are talking about 
>> BOM of  real (physical) object like a car or even an aircraft carrier, I 
>> think  it is not large tree
>>  only if you don't want to have BOAOM (bill of atoms of materials) 
>>
>>
My BOM experience is more with circuit boards, and there would probably a 
dozen part numbers for resistors and and a dozen part numbers for 
capacitors, and more than a dozen ICs.  But there could be a dozen or a 
hundred boards using part X, and if you need to figure out which boards are 
affected when the manufacturer stops manuffing the part, it starts getting 
interesting.  If you also make boxes the boards go into, then the hierarchy 
gains another level (although not many entries at that level).

 

> On Wednesday, November 21, 2018 at 7:58:48 PM UTC+3, BigBaaadBob wrote:
>>>
>>> I went ahead and coded something up, inspired by Massimo's Preorder 
>>> Traversal example. I wouldn't be offended if people suggest how to make it 
>>> better/faster, perhaps by combining stuff in the Link function into one 
>>> query instead of many.
>>>
>>> # Demonstrate closure tables. Deletion of nodes is left as an exercise 
>>> to the reader.
>>> # See: 
>>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>>  
>>>
>>> from gluon import DAL, Field
>>>
>>> db=DAL('sqlite://closure.db') 
>>>
>>> db.define_table(
>>> 'thing',
>>> db.Field('name')
>>> )
>>> db.thing.truncate()
>>>
>>> db.define_table(
>>> 'closure',
>>> db.Field('parent', type='reference thing'),
>>> db.Field('child', type='reference thing'),
>>> db.Field('depth', type='integer')
>>> )
>>> db.closure.truncate()
>>>
>>> def link(parent_id,child_id):
>>> """ link(1,3) """
>>> p = db.closure.with_alias('p')
>>> c = db.closure.with_alias('c')
>>> rows = db((p.child==parent_id) & (c.parent==child_id)).select(
>>> p.parent.with_alias('parent'),
>>> c.child.with_alias('child'),
>>> (p.depth+c.depth+1).with_alias('depth'))
>>> for row in rows:
>>> db.closure.insert(parent=row.parent, child=row.child, 
>>> depth=row.depth)
>>> 
>>> def add_node(name,parent_name): 
>>> """ add_node('Fruit','Food') """
>>> child_id=db.thing.insert(name=name)
>>> db.closure.insert(parent=child_id, child=child_id, depth=0)
>>> if parent_name is not None:
>>> parent_id=db(db.thing.name==parent_name).select().first().id
>>> link(parent_id, child_id)
>>> 
>>> def ancestors(name): 
>>> """ print ancestors('Red')""" 
>>> node=db(db.thing.name==name).select().first()
>>> return db((db.closure.child==node.id) & (db.closure.parent != 
>>> node.id)).select(
>>> db.thing.name, left=db.thing.on(db.thing.id==db.closure.parent), 
>>> orderby=db.closure.depth)
>>>
>>> def descendants(name): 
>>> """ print descendants('Fruit')""" 
>>> node=db(db.thing.name==name).select().first()
>>> return db((db.closure.parent==node.id) & (db.closure.child != 
>>> node.id)).select(
>>> db.thing.name, left=db.thing.on(db.thing.id==db.closure.child), 
>>> orderby=db.closure.depth)
>>>
>>> def closure():
>>> """ print closure() """
>>> parent = db.thing.with_alias('parent')
>>> child = db.thing.with_alias('child')
>>> return db().select(db.closure.id, parent.name, child.name, 
>>> db.closure.depth,
>>>left=(parent.on(parent.id == db.closure.parent),
>>>  child.on(child.id == db.closure.child)))
>>>
>>> def test(): 
>>> add_node('Food',None) 
>>> db.commit()
>>> print closure()
>>>
>>> add_node('Vehicle',None) 
>>> db.commit()
>>> print closure()
>>>
>>> add_node('Fruit','Food') 
>>> db.commit()
>>> print closure()
>>>
>>> add_node('Meat','Food') 
>>> db.commit()
>>> print closure()
>>>
>>> add_node('Red','Fruit') 
>>> db.commit()
>>> print closure()
>>>
>>> add_node('Chevy','Vehicle') 
>>> db.commit()
>>> 

[web2py] Re: Scheduler Replacement

2018-11-21 Thread Dave S


On Wednesday, November 21, 2018 at 10:31:13 AM UTC-8, Boris Aramis Aguilar 
Rodríguez wrote:
>
> TL;DR : Do you guys know or has experience with an alternative scheduler 
> to web2py's one that you would recommend? we use features such as 
> scheduling tasks at a specific time, repetitions, timeouts, and check the 
> task current state. Any further comments, advice and experience is really 
> appreciated.
> [...]
> Do anyone of you guys know or has experience with an alternative 
> scheduler? I've seen several options (rabbit-mq, python-rq, mrq, so on); 
> but I'm not sure about the limitations of those schedulers... any further 
> comments are really appreciated.
>

Nope, and my scheduler runs all of 8 tasks a day (creeping up to 16), so 
I've hardly pushed the limit.

But I would look at just running web2py instances on those other servers, 
and having the "master" do nothing more than send https requests to each of 
them, and each local scheduler then deals with its own workers only.  Not 
quite like sharding on Elastisearch, but definitely division of labor.

If Niphlod was still monitoring the group, that would get you the best 
comments on the in-box scheduler.  He's the expert -- wrote the current 
scheduler and the test suite, runs databases on diverse systems (including 
MSSQL behind IIS, IIRC). He also did the JWT implementation.

/dps

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


[web2py] Re: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-21 Thread BigBaaadBob
I'm just trying to find a good solid way of doing the BOM pattern using the 
DAL, and pretty much all of the decent articles I've found say the Closure 
Table method is the best trade-off, especially for large-ish and deep-ish 
BOM structures. 

But, I'm not dogmatic. How would you code up a version using "with 
recursive" queries using the DAL? If you post a running example it would be 
great at informing the group!

On Wednesday, November 21, 2018 at 9:56:48 AM UTC-8, Val K wrote:
>
> Why do you have to use this crutches (despite they are genius)? Now, even 
> Sqlite3 supports 'with recursive' queries.
> And what do you mean under BOM  and large tree? If we are talking about 
> BOM of  real (physical) object like a car or even an aircraft carrier, I 
> think  it is not large tree
>  only if you don't want to have BOAOM (bill of atoms of materials) 
>
> On Wednesday, November 21, 2018 at 7:58:48 PM UTC+3, BigBaaadBob wrote:
>>
>> I went ahead and coded something up, inspired by Massimo's Preorder 
>> Traversal example. I wouldn't be offended if people suggest how to make it 
>> better/faster, perhaps by combining stuff in the Link function into one 
>> query instead of many.
>>
>> # Demonstrate closure tables. Deletion of nodes is left as an exercise to 
>> the reader.
>> # See: 
>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html 
>>
>> from gluon import DAL, Field
>>
>> db=DAL('sqlite://closure.db') 
>>
>> db.define_table(
>> 'thing',
>> db.Field('name')
>> )
>> db.thing.truncate()
>>
>> db.define_table(
>> 'closure',
>> db.Field('parent', type='reference thing'),
>> db.Field('child', type='reference thing'),
>> db.Field('depth', type='integer')
>> )
>> db.closure.truncate()
>>
>> def link(parent_id,child_id):
>> """ link(1,3) """
>> p = db.closure.with_alias('p')
>> c = db.closure.with_alias('c')
>> rows = db((p.child==parent_id) & (c.parent==child_id)).select(
>> p.parent.with_alias('parent'),
>> c.child.with_alias('child'),
>> (p.depth+c.depth+1).with_alias('depth'))
>> for row in rows:
>> db.closure.insert(parent=row.parent, child=row.child, 
>> depth=row.depth)
>> 
>> def add_node(name,parent_name): 
>> """ add_node('Fruit','Food') """
>> child_id=db.thing.insert(name=name)
>> db.closure.insert(parent=child_id, child=child_id, depth=0)
>> if parent_name is not None:
>> parent_id=db(db.thing.name==parent_name).select().first().id
>> link(parent_id, child_id)
>> 
>> def ancestors(name): 
>> """ print ancestors('Red')""" 
>> node=db(db.thing.name==name).select().first()
>> return db((db.closure.child==node.id) & (db.closure.parent != node.id
>> )).select(
>> db.thing.name, left=db.thing.on(db.thing.id==db.closure.parent), 
>> orderby=db.closure.depth)
>>
>> def descendants(name): 
>> """ print descendants('Fruit')""" 
>> node=db(db.thing.name==name).select().first()
>> return db((db.closure.parent==node.id) & (db.closure.child != node.id
>> )).select(
>> db.thing.name, left=db.thing.on(db.thing.id==db.closure.child), 
>> orderby=db.closure.depth)
>>
>> def closure():
>> """ print closure() """
>> parent = db.thing.with_alias('parent')
>> child = db.thing.with_alias('child')
>> return db().select(db.closure.id, parent.name, child.name, 
>> db.closure.depth,
>>left=(parent.on(parent.id == db.closure.parent),
>>  child.on(child.id == db.closure.child)))
>>
>> def test(): 
>> add_node('Food',None) 
>> db.commit()
>> print closure()
>>
>> add_node('Vehicle',None) 
>> db.commit()
>> print closure()
>>
>> add_node('Fruit','Food') 
>> db.commit()
>> print closure()
>>
>> add_node('Meat','Food') 
>> db.commit()
>> print closure()
>>
>> add_node('Red','Fruit') 
>> db.commit()
>> print closure()
>>
>> add_node('Chevy','Vehicle') 
>> db.commit()
>> print closure()
>>
>> print "descendants of 'Food'"
>> print descendants('Food') 
>>
>> print "ancestors of 'Red'"
>> print ancestors('Red')
>>
>> test() 
>>
>>
>>
>> On Tuesday, November 20, 2018 at 5:02:33 PM UTC-8, BigBaaadBob wrote:
>>>
>>> Has anyone implemented a closure table with triggers 
>>>  
>>> approach 
>>> to hierarchy (specifically for a Bill of Materials (BOM) pattern) in 
>>> Web2Py's DAL?
>>>
>>> I've seen Massimo's implementation of Preorder Traversal which doesn't 
>>> work for BOM patterns where there are multiple roots. The Adjacency Table 
>>> method is slow for large trees.
>>>
>>> In a Bill of Materials situation 
>>> ,
>>>  
>>> there are multiple roots in the main table, like this:
>>>
>>> db.define_table('item',
>>>  

[web2py] Scheduler Replacement

2018-11-21 Thread Boris Aramis Aguilar Rodríguez
TL;DR : Do you guys know or has experience with an alternative scheduler to 
web2py's one that you would recommend? we use features such as scheduling 
tasks at a specific time, repetitions, timeouts, and check the task current 
state. Any further comments, advice and experience is really appreciated.

Details:

We've beeng experiencing several issues with web2py's scheduler limits, our 
scenario currently looks something like:

 - 30,000+ tasks queued daily.
 - Around 40+ workers distributed into four different servers (somewhere 
between 10 workers per server): We do this because of the nature of the 
tasks we are distributing, we need them to be run on a specific server 
located somewhere in the world that has access to do what we need.
 - A centralized database that holds tasks+runs (PostgreSQL)
 - A centralized REDIS that manages the scheduler (with redis_scheduler.py 
module wihtin gluon/contrib/redis_scheduler.py)

We previously used web2py's (default) non-redis scheduler but we found the 
total workers that the database supported was around ~13-15 (too few for 
our usage scenario, above that number of workers started to get deadlocks 
from the database and ticker would fail to assign tasks) so we tried using 
redis_scheduler which worked (with one really weird bug we found a way to 
overcome but have found no fix yet) for some time until we needed more 
workers, now we are having issues, again with the relational database that 
holds the tasks (scheduler_task and scheduler_run tables, database 
connection gets closed after sometime when we have somewhere between 50+ 
workers); 

So I can only see that we need to replace web2py's scheduler on our 
application to support more workers and bring back stability to our 
project's hunger for workers nature...

Do anyone of you guys know or has experience with an alternative scheduler? 
I've seen several options (rabbit-mq, python-rq, mrq, so on); but I'm not 
sure about the limitations of those schedulers... any further comments are 
really appreciated.

-- 
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: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-21 Thread Val K
Why do you have to use this crutches (despite they are genius)? Now, even 
Sqlite3 supports 'with recursive' queries.
And what do you mean under BOM  and large tree? If we are talking about BOM 
of  real (physical) object like a car or even an aircraft carrier, I think  
it is not large tree
 only if you don't want to have BOAOM (bill of atoms of materials) 

On Wednesday, November 21, 2018 at 7:58:48 PM UTC+3, BigBaaadBob wrote:
>
> I went ahead and coded something up, inspired by Massimo's Preorder 
> Traversal example. I wouldn't be offended if people suggest how to make it 
> better/faster, perhaps by combining stuff in the Link function into one 
> query instead of many.
>
> # Demonstrate closure tables. Deletion of nodes is left as an exercise to 
> the reader.
> # See: 
> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html 
>
> from gluon import DAL, Field
>
> db=DAL('sqlite://closure.db') 
>
> db.define_table(
> 'thing',
> db.Field('name')
> )
> db.thing.truncate()
>
> db.define_table(
> 'closure',
> db.Field('parent', type='reference thing'),
> db.Field('child', type='reference thing'),
> db.Field('depth', type='integer')
> )
> db.closure.truncate()
>
> def link(parent_id,child_id):
> """ link(1,3) """
> p = db.closure.with_alias('p')
> c = db.closure.with_alias('c')
> rows = db((p.child==parent_id) & (c.parent==child_id)).select(
> p.parent.with_alias('parent'),
> c.child.with_alias('child'),
> (p.depth+c.depth+1).with_alias('depth'))
> for row in rows:
> db.closure.insert(parent=row.parent, child=row.child, 
> depth=row.depth)
> 
> def add_node(name,parent_name): 
> """ add_node('Fruit','Food') """
> child_id=db.thing.insert(name=name)
> db.closure.insert(parent=child_id, child=child_id, depth=0)
> if parent_name is not None:
> parent_id=db(db.thing.name==parent_name).select().first().id
> link(parent_id, child_id)
> 
> def ancestors(name): 
> """ print ancestors('Red')""" 
> node=db(db.thing.name==name).select().first()
> return db((db.closure.child==node.id) & (db.closure.parent != node.id
> )).select(
> db.thing.name, left=db.thing.on(db.thing.id==db.closure.parent), 
> orderby=db.closure.depth)
>
> def descendants(name): 
> """ print descendants('Fruit')""" 
> node=db(db.thing.name==name).select().first()
> return db((db.closure.parent==node.id) & (db.closure.child != node.id
> )).select(
> db.thing.name, left=db.thing.on(db.thing.id==db.closure.child), 
> orderby=db.closure.depth)
>
> def closure():
> """ print closure() """
> parent = db.thing.with_alias('parent')
> child = db.thing.with_alias('child')
> return db().select(db.closure.id, parent.name, child.name, 
> db.closure.depth,
>left=(parent.on(parent.id == db.closure.parent),
>  child.on(child.id == db.closure.child)))
>
> def test(): 
> add_node('Food',None) 
> db.commit()
> print closure()
>
> add_node('Vehicle',None) 
> db.commit()
> print closure()
>
> add_node('Fruit','Food') 
> db.commit()
> print closure()
>
> add_node('Meat','Food') 
> db.commit()
> print closure()
>
> add_node('Red','Fruit') 
> db.commit()
> print closure()
>
> add_node('Chevy','Vehicle') 
> db.commit()
> print closure()
>
> print "descendants of 'Food'"
> print descendants('Food') 
>
> print "ancestors of 'Red'"
> print ancestors('Red')
>
> test() 
>
>
>
> On Tuesday, November 20, 2018 at 5:02:33 PM UTC-8, BigBaaadBob wrote:
>>
>> Has anyone implemented a closure table with triggers 
>>  
>> approach 
>> to hierarchy (specifically for a Bill of Materials (BOM) pattern) in 
>> Web2Py's DAL?
>>
>> I've seen Massimo's implementation of Preorder Traversal which doesn't 
>> work for BOM patterns where there are multiple roots. The Adjacency Table 
>> method is slow for large trees.
>>
>> In a Bill of Materials situation 
>> ,
>>  
>> there are multiple roots in the main table, like this:
>>
>> db.define_table('item',
>> Field('name', type='string', length=128, label=T('Name')))
>>
>> db.define_table('bill_of_materials',
>> Field('parent_item_id', type='reference item', notnull=True, 
>> label=T('Parent Item')),
>> Field('child_item_id', type='reference item', notnull=True, 
>> label=T('Child Item')),
>> Field('quantity', type='decimal(8,2)', default='1.0', 
>> label=T('Quantity')))
>>
>>
>>

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

Re: [web2py] Re: Future of web2py

2018-11-21 Thread António Ramos
Just an admin with vue and vuetify
https://github.com/tookit/vue-material-admin

Em qua, 21 de nov de 2018 às 17:24, António Ramos 
escreveu:

> Just my 2 cents
> If we are on to Vuejs the better options is not bootstrap, its vuetify...
> they were made to be together..
>
> Em ter, 20 de nov de 2018 às 19:23, Fernando Lucas 
> escreveu:
>
>> Did you think about the JS framework, https://aurelia.io/?
>> Thank's
>> Fernando Lucas
>>
>> Em seg, 29 de mai de 2017 às 20:29, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> escreveu:
>>
>>> My plan is this
>>>
>>> It is based on bottle + gevent + gunicorn + rethinkdb + pydal + vue.js +
>>> some code ported from web2py (templates, helpers, validators,
>>> internationalization, scheduler)
>>>
>>> Unlike web2py it uses modules not execfile and this makes it 10x faster
>>> (this part is done) and code it no longer interpreted at every request.
>>> Only on change.
>>>
>>> Routes are declared using decorators like in bottle and flask.
>>>
>>> It will use rethinkdb for storing errors, sessions, and anything user
>>> defined. This allows to scale horizontally. Nothing gets stored on the file
>>> system any more. Ever. Unless you choose to use sqlite for your app.
>>>
>>> No more forms and grids generated server side. Possible and will
>>> probably backport SQLFrom and Gid but will discourage it. The default
>>> client will be in vue.js. The forms and grids will be generated client-side
>>> based on self-documenting APIs. This work must be done. It is not terribly
>>> hard just pedantic.
>>>
>>> It has a redesigned admin. Not necessarily better but leaner. This part
>>> is also done although it may need restyling.
>>>
>>> I am ditching a lot of the web2py auth logic. Nobody really uses groups
>>> and permissions and the way it is done may not be the best way for
>>> everybody. Instead I will default to auth0 integration.
>>>
>>> From a developer prospective the code will look very similar and I will
>>> be able to recycle 90% of the documentation.
>>>
>>> The problems are that web2py grew a bit bloated and typical programming
>>> patterns have shifted from postbacks to single page apps with form
>>> submission via API. Also web2py does not provide enough tools for scaling
>>> since uses filesystem by default. The new version will do less then current
>>> web2py but will remedy those issues and make it easier to make responsive
>>> and scalable apps.
>>>
>>> I am conflicted. I could use help to get this done quicker but I do not
>>> want to post something that is half done people are unhappy with. What I
>>> would like may not be what everybody likes but I am mostly building this in
>>> a way that would work well for myself and share in the hope it is useful to
>>> others. BSD license.
>>>
>>> If you are willing to help before the code is made public feel free to
>>> contact me personally.
>>>
>>> Massimo
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sunday, 28 May 2017 11:47:49 UTC-5, Oasis Agano wrote:


 Is the new framework web3py if so when is the official launch?
 On Sunday, May 28, 2017 at 2:32:01 AM UTC+2, Relsi Maron wrote:
>
>
> Hi Andrea,
>
> Yes, there will be a future for web2py!
>
> Web2py will remain being what it is. :)
>
> A new version, with support for Python 3, is about to come. Even
> though Massimo is developing a new framework, Web2py will continue to 
> exist
> - with the same purpose for which it was created: to teach development.
>
> Cheers.
>
>
> Em sábado, 27 de maio de 2017 04:11:02 UTC-3, Andrea Fae' escreveu:
>>
>> Hello guys,
>> I'd like to know if there will be future of web2py? Any information
>> about it?
>> 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.
>>>
>> --
>> 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 

Re: [web2py] Re: Future of web2py

2018-11-21 Thread António Ramos
Just my 2 cents
If we are on to Vuejs the better options is not bootstrap, its vuetify...
they were made to be together..

Em ter, 20 de nov de 2018 às 19:23, Fernando Lucas 
escreveu:

> Did you think about the JS framework, https://aurelia.io/?
> Thank's
> Fernando Lucas
>
> Em seg, 29 de mai de 2017 às 20:29, Massimo Di Pierro <
> massimo.dipie...@gmail.com> escreveu:
>
>> My plan is this
>>
>> It is based on bottle + gevent + gunicorn + rethinkdb + pydal + vue.js +
>> some code ported from web2py (templates, helpers, validators,
>> internationalization, scheduler)
>>
>> Unlike web2py it uses modules not execfile and this makes it 10x faster
>> (this part is done) and code it no longer interpreted at every request.
>> Only on change.
>>
>> Routes are declared using decorators like in bottle and flask.
>>
>> It will use rethinkdb for storing errors, sessions, and anything user
>> defined. This allows to scale horizontally. Nothing gets stored on the file
>> system any more. Ever. Unless you choose to use sqlite for your app.
>>
>> No more forms and grids generated server side. Possible and will probably
>> backport SQLFrom and Gid but will discourage it. The default client will be
>> in vue.js. The forms and grids will be generated client-side based on
>> self-documenting APIs. This work must be done. It is not terribly hard just
>> pedantic.
>>
>> It has a redesigned admin. Not necessarily better but leaner. This part
>> is also done although it may need restyling.
>>
>> I am ditching a lot of the web2py auth logic. Nobody really uses groups
>> and permissions and the way it is done may not be the best way for
>> everybody. Instead I will default to auth0 integration.
>>
>> From a developer prospective the code will look very similar and I will
>> be able to recycle 90% of the documentation.
>>
>> The problems are that web2py grew a bit bloated and typical programming
>> patterns have shifted from postbacks to single page apps with form
>> submission via API. Also web2py does not provide enough tools for scaling
>> since uses filesystem by default. The new version will do less then current
>> web2py but will remedy those issues and make it easier to make responsive
>> and scalable apps.
>>
>> I am conflicted. I could use help to get this done quicker but I do not
>> want to post something that is half done people are unhappy with. What I
>> would like may not be what everybody likes but I am mostly building this in
>> a way that would work well for myself and share in the hope it is useful to
>> others. BSD license.
>>
>> If you are willing to help before the code is made public feel free to
>> contact me personally.
>>
>> Massimo
>>
>>
>>
>>
>>
>>
>> On Sunday, 28 May 2017 11:47:49 UTC-5, Oasis Agano wrote:
>>>
>>>
>>> Is the new framework web3py if so when is the official launch?
>>> On Sunday, May 28, 2017 at 2:32:01 AM UTC+2, Relsi Maron wrote:


 Hi Andrea,

 Yes, there will be a future for web2py!

 Web2py will remain being what it is. :)

 A new version, with support for Python 3, is about to come. Even
 though Massimo is developing a new framework, Web2py will continue to exist
 - with the same purpose for which it was created: to teach development.

 Cheers.


 Em sábado, 27 de maio de 2017 04:11:02 UTC-3, Andrea Fae' escreveu:
>
> Hello guys,
> I'd like to know if there will be future of web2py? Any information
> about it?
> 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.
>>
> --
> 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: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-21 Thread BigBaaadBob
I went ahead and coded something up, inspired by Massimo's Preorder 
Traversal example. I wouldn't be offended if people suggest how to make it 
better/faster, perhaps by combining stuff in the Link function into one 
query instead of many.

# Demonstrate closure tables. Deletion of nodes is left as an exercise to 
the reader.
# See: 
http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html 

from gluon import DAL, Field

db=DAL('sqlite://closure.db') 

db.define_table(
'thing',
db.Field('name')
)
db.thing.truncate()

db.define_table(
'closure',
db.Field('parent', type='reference thing'),
db.Field('child', type='reference thing'),
db.Field('depth', type='integer')
)
db.closure.truncate()

def link(parent_id,child_id):
""" link(1,3) """
p = db.closure.with_alias('p')
c = db.closure.with_alias('c')
rows = db((p.child==parent_id) & (c.parent==child_id)).select(
p.parent.with_alias('parent'),
c.child.with_alias('child'),
(p.depth+c.depth+1).with_alias('depth'))
for row in rows:
db.closure.insert(parent=row.parent, child=row.child, 
depth=row.depth)

def add_node(name,parent_name): 
""" add_node('Fruit','Food') """
child_id=db.thing.insert(name=name)
db.closure.insert(parent=child_id, child=child_id, depth=0)
if parent_name is not None:
parent_id=db(db.thing.name==parent_name).select().first().id
link(parent_id, child_id)

def ancestors(name): 
""" print ancestors('Red')""" 
node=db(db.thing.name==name).select().first()
return db((db.closure.child==node.id) & (db.closure.parent != 
node.id)).select(
db.thing.name, left=db.thing.on(db.thing.id==db.closure.parent), 
orderby=db.closure.depth)

def descendants(name): 
""" print descendants('Fruit')""" 
node=db(db.thing.name==name).select().first()
return db((db.closure.parent==node.id) & (db.closure.child != 
node.id)).select(
db.thing.name, left=db.thing.on(db.thing.id==db.closure.child), 
orderby=db.closure.depth)

def closure():
""" print closure() """
parent = db.thing.with_alias('parent')
child = db.thing.with_alias('child')
return db().select(db.closure.id, parent.name, child.name, 
db.closure.depth,
   left=(parent.on(parent.id == db.closure.parent),
 child.on(child.id == db.closure.child)))

def test(): 
add_node('Food',None) 
db.commit()
print closure()

add_node('Vehicle',None) 
db.commit()
print closure()

add_node('Fruit','Food') 
db.commit()
print closure()

add_node('Meat','Food') 
db.commit()
print closure()

add_node('Red','Fruit') 
db.commit()
print closure()

add_node('Chevy','Vehicle') 
db.commit()
print closure()

print "descendants of 'Food'"
print descendants('Food') 

print "ancestors of 'Red'"
print ancestors('Red')

test() 



On Tuesday, November 20, 2018 at 5:02:33 PM UTC-8, BigBaaadBob wrote:
>
> Has anyone implemented a closure table with triggers 
>  
> approach 
> to hierarchy (specifically for a Bill of Materials (BOM) pattern) in 
> Web2Py's DAL?
>
> I've seen Massimo's implementation of Preorder Traversal which doesn't 
> work for BOM patterns where there are multiple roots. The Adjacency Table 
> method is slow for large trees.
>
> In a Bill of Materials situation 
> ,
>  
> there are multiple roots in the main table, like this:
>
> db.define_table('item',
> Field('name', type='string', length=128, label=T('Name')))
>
> db.define_table('bill_of_materials',
> Field('parent_item_id', type='reference item', notnull=True, 
> label=T('Parent Item')),
> Field('child_item_id', type='reference item', notnull=True, 
> label=T('Child Item')),
> Field('quantity', type='decimal(8,2)', default='1.0', 
> label=T('Quantity')))
>
>
>

-- 
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: Migrations

2018-11-21 Thread Ben Duncan
Ok, I turned migration on for tables, and it gave errors because of foreign
keyes.
Everything looks exactly like the docs spell out.

I'm not sure I see the reasoning for the stuff in directory 'database'.

I'm going ahead putting back migration=False on all the tables, since It
works that way and these
are external tables.

Anyone see any problems with that ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Nov 21, 2018 at 6:57 AM Ben Duncan  wrote:

> I tried enable fake migrations (Backend has tables), nothing was created
> in databases, but everything works as it should ..
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Tue, Nov 20, 2018 at 4:20 PM Dave S  wrote:
>
>>
>>
>> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:
>>>
>>> Is it necessary to enable or even do migrations in the DAL (creating
>>> database/ entries) if the database and the tables are already preexisting ?
>>>
>>> Thanks ...
>>>
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>
>>
>> Let's see if I get it right:
>>
>> new table design: enable migrations
>> new field in existing design: enable migrations
>> new definition, backend has table:enable fake_migrations
>>
>> /dps
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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: Migrations

2018-11-21 Thread Ben Duncan
I tried enable fake migrations (Backend has tables), nothing was created in
databases, but everything works as it should ..
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Nov 20, 2018 at 4:20 PM Dave S  wrote:

>
>
> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:
>>
>> Is it necessary to enable or even do migrations in the DAL (creating
>> database/ entries) if the database and the tables are already preexisting ?
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
>
> Let's see if I get it right:
>
> new table design: enable migrations
> new field in existing design: enable migrations
> new definition, backend has table:enable fake_migrations
>
> /dps
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: How to work with files in multipart/form-data?

2018-11-21 Thread Val K
If want to validators do their stuff, just try   
db_app.doc_images.validate_and_insert(... , file=doc)

db_app.doc_images.file.store - just a helper that sanitizes the filename, 
adds a unique prefix and saves the file + returns its real (OS) name
So,  in your example, the  validation happens too late.












On Wednesday, November 21, 2018 at 12:29:07 PM UTC+3, Константин Комков 
wrote:
>
> loadDoc = db_app.doc_images.validate_and_insert(person='{0} {1} 
> {2}'.format(session.abit_f,session.abit_i,session.abit_o),file=db_app.doc_images.file.store(doc,doc.filename))
> I see another expansion in uploads yet. And loadDoc.errors.as_dict() 
> contain {'file','enter valid filename'}.
>

-- 
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: Changing color of a cell function of another cell value

2018-11-21 Thread Yann Dulondel


Le mercredi 21 novembre 2018 10:51:16 UTC+1, Yann Dulondel a écrit :
>
> Hi all,
> I have a container number and a function that check the number is valid.
> The result of the function is store in field cntnumok (boolean).
> I found that we can change the color with "represent" and found an example 
> in webgroup.
>
> db.articles.conteneur.represent = lambda v, row: SPAN(v, _class=
> 'cnt-false' if db.articles.cntnumok==False else None)
> I understand lambda is an inline function, i want that the if test the 
> value of  "cntnumok" for the row
> How can i have the value of  "cntnumok"  for the row?
> I tried this also
> db.articles.conteneur.represent = lambda v, row: SPAN(v,_class='cnt-false' 
> if row.cntnumok==False else None)
>
> Try this
db.articles.conteneur.represent = lambda cntnumok, row:SPAN(row['conteneur'
], _class='cnt-false' if cntnumok==False and cntnumok else None)

No error message but the color doesn't change

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


[web2py] Changing color of a cell function of another cell value

2018-11-21 Thread Yann Dulondel
Hi all,
I have a container number and a function that check the number is valid.
The result of the function is store in field cntnumok (boolean).
I found that we can change the color with "represent" and found an example 
in webgroup.

db.articles.conteneur.represent = lambda v, row: SPAN(v, _class='cnt-false' 
if db.articles.cntnumok==False else None)
I understand lambda is an inline function, i want that the if test the 
value of  "cntnumok" for the row
How can i have the value of  "cntnumok"  for the row?
I tried this also
db.articles.conteneur.represent = lambda v, row: SPAN(v,_class='cnt-false' 
if row.cntnumok==False else None)

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.


[web2py] Re: How to work with files in multipart/form-data?

2018-11-21 Thread Константин Комков
loadDoc = db_app.doc_images.validate_and_insert(person='{0} {1} 
{2}'.format(session.abit_f,session.abit_i,session.abit_o),file=db_app.doc_images.file.store(doc,doc.filename))
I see another expansion yet. And loadDoc.errors.as_dict() contain 
{'file','enter valid filename'}.

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