[web2py] DAL implementation nof the Table-per-type inheritance model?

2020-10-17 Thread BigBaaadBob
It's hard to believe that I was talking about this in 2013 
, but here 
it is again!

I'm wondering if you can directly implement the Table-per-type or 
Shared-primary-key method of inheritance in the DAL?

[image: subclass-gradstu-scheme.gif]

The standard DAL inheritance method (including a table as a field) is a 
Table-per-concrete approach that has pros and cons. In particular for me, 
it is harder to deal with the common stuff (the stuff in the superclass) 
with the standard DAL method.  In many cases I never need to refer to the 
subclass specifics.

The best I have been able to do is something like the below. There is a lot 
of common stuff in the duration table (and, btw, the duration can be 
overridden and isn't necessarily the difference of the start and stop 
values in the subclasses). Depending on how the time is tracked, there are 
different algorithms used to compute a duration, for  example subtracting 
two datetimes or subtracting two floats (representing hours).

db.define_table(
'duration',
# Common stuff
Field('duration','decimal(10,2)',notnull=True),
)

db.define_table(
'datetime_duration',
Field('superclass','reference duration',unique=True,notnull=True),
Field('start','datetime',notnull=True),
Field('stop','datetime',notnull=True),
)

db.define_table(
'hour_duration',
Field('superclass','reference duration',unique=True,notnull=True),
Field('start','decimal(10,2)',notnull=True),
Field('stop','decimal(10,2)',notnull=True),
)

-- 
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/08ce05ed-8ce8-4877-9452-0fded7d07f1en%40googlegroups.com.


[web2py] Re: Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread BigBaaadBob
Yes, thanks. I’m just surprised this doesn’t work In the Welcome 
application out of the box. I’m not writing a new application; I’m just 
clicking on the buttons provided in unchanged freshly cloned code.

On Tuesday, September 22, 2020 at 11:04:00 AM UTC-7 Константин Комков wrote:

> Hello! You need to comment decorator #@auth.requires_membership('admin') 
> or add your user in 'admin' group see chapter 9 Access Control in The book.
> Also set table name, forexample:
> tablename = 'auth_user'
>
>
>
>

-- 
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/e9a55652-c0f7-40f9-8e60-6d8c6fed033dn%40googlegroups.com.


[web2py] Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread BigBaaadBob
I just now cloned (recursive) the web2py distro, started it, and clicked on 
the "grid example" button in the welcome application. I then registered 
when asked to authenticate. I got redirected back to the welcome app index 
page. I then click on the "grid example" button again and I get "Not 
authorized, insufficient privileges".

Should this work out-of-the-box?

-- 
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/03eb5752-0066-48ae-8cfb-7cb8775c3056n%40googlegroups.com.


[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')"&q

[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&#

[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 
> <http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html> 
> 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 
> <http://www.vertabelo.com/blog/technical-articles/identifying-the-bill-of-materials-bom-structure-in-databases>,
>  
> 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.


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

2018-11-20 Thread BigBaaadBob
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.


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

2018-11-20 Thread BigBaaadBob
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.


[web2py] Re: Subclassing models?

2013-09-15 Thread BigBaaadBob
Yes,* *I didn't read far enough into the documentation.  Ooopsies!

On Sunday, September 15, 2013 6:33:18 PM UTC-7, Massimo Di Pierro wrote:
>
> Do you mean?
>
> db.define_table('Certificate',db.Pilot,...)
>
>
> On Sunday, 15 September 2013 20:25:38 UTC-5, BigBaaadBob wrote:
>>
>> Suppose I have a "Person" table with all the typical stuff:
>>
>> db.define_table('Person',
>> Field('FirstName','string', length=40, notnull=True),
>> Field('MiddleName','string', length=40),
>> Field('LastName','string', length=40, notnull=True),
>> Field('Nickname','string', length=40),
>> Field('DateOfBirth','date', notnull=True),
>> Field('EmployeeId','string', length=10, unique=True,required
>> =True, notnull=True),
>> format=lambda r: Fullname(r.FirstName, r.MiddleName, r.
>> Nickname, r.LastName)
>> )
>>
>>
>> And suppose I have various special kinds of people, for exampe pilots, 
>> who have things that normal people don't have, like certificates or whatnot.
>>
>> db.define_table('Pilot',
>> Field('PersonId', db.Person),
>> )
>>
>> db.define_table('Certificate',
>> Field('PilotId', db.Pilot),
>> Field('TypeId', db.CertificateType),
>> Field('Expires','date'),
>> Field('CertificateLimitations','string', length=100),
>> )
>>
>>
>> What's the proper way to do this kind of thing in the DAL?
>>
>> For example:
>>
>>
>>1. The Pilot format should be the same as the Person format, and I'd 
>>like to do that without duplicating lots of tricky lambda stuff. (BTW, 
>>Virtual fields seem worthless for use in "format"!)
>>2. Accessing a Pilot's Person attributes should be as easy as 
>>accessing the Pilot's Attributes.
>>3. Requires (not shown above) should work for Pilots the same way as 
>>they work for Persons.
>>4. Etc.
>>
>> Have I strolled way off the beaten path into the muddy weeds?
>>
>>

-- 
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/groups/opt_out.


[web2py] Subclassing models?

2013-09-15 Thread BigBaaadBob
Suppose I have a "Person" table with all the typical stuff:

db.define_table('Person',
Field('FirstName','string', length=40, notnull=True),
Field('MiddleName','string', length=40),
Field('LastName','string', length=40, notnull=True),
Field('Nickname','string', length=40),
Field('DateOfBirth','date', notnull=True),
Field('EmployeeId','string', length=10, unique=True,required
=True, notnull=True),
format=lambda r: Fullname(r.FirstName, r.MiddleName, r.
Nickname, r.LastName)
)


And suppose I have various special kinds of people, for exampe pilots, who 
have things that normal people don't have, like certificates or whatnot.

db.define_table('Pilot',
Field('PersonId', db.Person),
)

db.define_table('Certificate',
Field('PilotId', db.Pilot),
Field('TypeId', db.CertificateType),
Field('Expires','date'),
Field('CertificateLimitations','string', length=100),
)


What's the proper way to do this kind of thing in the DAL?

For example:


   1. The Pilot format should be the same as the Person format, and I'd 
   like to do that without duplicating lots of tricky lambda stuff. (BTW, 
   Virtual fields seem worthless for use in "format"!)
   2. Accessing a Pilot's Person attributes should be as easy as accessing 
   the Pilot's Attributes.
   3. Requires (not shown above) should work for Pilots the same way as 
   they work for Persons.
   4. Etc.

Have I strolled way off the beaten path into the muddy weeds?

-- 
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/groups/opt_out.


[web2py] Re: Generically accessing the results of select

2010-10-24 Thread BigBaaadBob


On Oct 23, 10:52 pm, ron_m  wrote:
> The rows is a dict so if you apply the keys() function you get a list
> of keys or values returns a list of values under the keys.
>
> rows = big_hairy_select_with_joins
>
> for row in rows:
>   for table in row.values()
>     for field in table.values()

Yes, it is a dict of dicts.   But the above doesn't return the vals in
the order they were queried.  If you are generating, say, JSON for
jqGrid, you need to know the order of the data.

Massimo's comment does what I want to do (and what I was already
doing), but I somehow felt that going to the second level the
[internal dicts] was relying on an internal implementation detail of
Row.

I was naively thinking that since Rows has colnames in the format
'table.column' that Row would know how to r['table.column'].
Actually, I still do.   ;-)

> rows_list = (big_hairy_select_with_joins).select().as_list()
>
> So now the query result is processed generically with no prior
> knowledge of the table or column names?

Again, that doesn't return them in the order queried.


[web2py] Re: Generically accessing the results of select

2010-10-23 Thread BigBaaadBob
I must be expressing myself poorly.  I'm saying that if the dal (and
sql) Row class had a method like this:

def column(self, colname):
(table, field) = colname.split('.')
return self[table][field]

I could do this (which is what jqGrid wants):

results = list()
for row in big_long_hairy_select_with_joins_and_stuff
vals=list()
for f in rows.colnames:
vals.append(row.column(f))
results.append(dict(id=row.column(rows.colnames[0]),cell=vals))

return dict(results=results)

Am I alone in thinking this is something the Row class should know how
to do, or is there some trivial way of doing this already?

It seems weird that no one else has run into this problem...


[web2py] Re: Generically accessing the results of select

2010-10-22 Thread BigBaaadBob
I'm probably dense, but I don't see how it does.

rows.colnames has strings like 'foo.id' and 'a.name'.  But you can't
index into a row with those strings: you can't say r['foo.id'] or
r['a.name'].  You have to parse the column name and create code like
r['foo']['id'] and the problem I have with that is it seems like
improperly looking into the internals of the Row class.  It seems like
the Row class should have some kind of method like r.col('foo.id')
that would "do the right thing".  Or that r['a.name'] should just do
the right thing.

But, again, maybe I'm missing something.

On Oct 21, 11:24 am, Richard Vézina 
wrote:
> Maybe this thread could be of some help.
>
> http://groups.google.com/group/web2py/browse_thread/thread/e533b38bd5...
>
> <http://groups.google.com/group/web2py/browse_thread/thread/e533b38bd5...>
>
> On Thu, Oct 21, 2010 at 2:05 PM, BigBaaadBob  wrote:
> > Suppose you do a query like this:
>
> > rows = db((db.a.id==db.foo.xx) &
> > (db.b.id==db.foo.yy)).select(db.foo.id, db.foo.aaa, db.a.name,
> > db.b.name, db.foo.zzz, )
>
> > And you want to processes the results generically, say to produce JSON
> > for input to jqGrid.  By generically, I mean not having to repeat the
> > "db.foo.aaa, db.a.name" stuff.  You know, DRY.
>
> > For r in rows:
> >   stuff...
>
> > What is the supported way of doing this?
>
> > Problems I see are:
>
> >   * You can't say: r[0] because row is a dict with keys 'a', 'b', and
> > 'foo'.
> >   * You can't say: r[rows.colnames[0]] because, well, the same reason
> > as the previous item.
>
> > I see code in the Rows class like this:
>
> >           (t, f) = col.split('.')
> >                 if isinstance(record.get(t, None), (Row,dict)):
> >                        row.append(none_exception(record[t][f]))
>
> > But I wouldn't want to do that because it assumes the internal
> > structure of the Rows class...
>
>


[web2py] Generically accessing the results of select

2010-10-21 Thread BigBaaadBob
Suppose you do a query like this:

rows = db((db.a.id==db.foo.xx) &
(db.b.id==db.foo.yy)).select(db.foo.id, db.foo.aaa, db.a.name,
db.b.name, db.foo.zzz, )

And you want to processes the results generically, say to produce JSON
for input to jqGrid.  By generically, I mean not having to repeat the
"db.foo.aaa, db.a.name" stuff.  You know, DRY.

For r in rows:
   stuff...

What is the supported way of doing this?

Problems I see are:

   * You can't say: r[0] because row is a dict with keys 'a', 'b', and
'foo'.
   * You can't say: r[rows.colnames[0]] because, well, the same reason
as the previous item.

I see code in the Rows class like this:

   (t, f) = col.split('.')
 if isinstance(record.get(t, None), (Row,dict)):
row.append(none_exception(record[t][f]))

But I wouldn't want to do that because it assumes the internal
structure of the Rows class...



[web2py] Re: What does this mean?

2010-10-21 Thread BigBaaadBob
So, is this a bug in populuate, or something else?

On Oct 19, 8:27 pm, BigBaaadBob  wrote:
> # The origin of the requirement: i.e. whether it is fundamental or
> derived
> db.define_table('origin',
>     Field('name', requires=IS_NOT_EMPTY()),
>     Field('key', requires=IS_NOT_EMPTY()),
>     format='%(name)s'
> )
>
> # The category of the requirement
> db.define_table('kind',
>     Field('name', requires=IS_NOT_EMPTY()),
>     Field('key', requires=IS_NOT_EMPTY()),
>     format='%(name)s'
> )
>
> # The actual requirement object
> db.define_table('requirement',
>     Field('title',requires=IS_NOT_EMPTY()),
>     Field('body', 'text',requires=IS_NOT_EMPTY()),
>     Field('rationale', 'text'),
>     Field('preconditions', 'text'),
>     Field('postconditions', 'text'),
>     Field('traces_to', 'reference
> requirement',requires=IS_EMPTY_OR(IS_IN_DB(db, 'requirement.id',
> 'requirement.title'))),
>     Field('origin', db.origin,requires=IS_IN_DB(db, 'origin.id',
> 'origin.name')),
>     Field('kind', db.kind,requires=IS_IN_DB(db, 'kind.id',
> 'kind.name')),
>     Field('is_safety_critical','boolean'),
>     Field('updated_by', db.auth_user, default=auth.user_id,
> update=auth.user_id, readable=False, writable=False),
>     Field('updated_on', 'datetime', default=request.now,
> update=request.now, readable=False, writable=False),
>     format='%(title)s'
> )
>
> # Put fake data in the requirements table
> from gluon.contrib.populate import populate
> if db(db.origin.id>0).count() == 0:
>     populate(db.origin,5)
>     db.commit()
>
> if db(db.kind.id>0).count() == 0:
>     populate(db.kind,5)
>     db.commit()
>
> if db(db.requirement.id>0).count() == 0:
>     populate(db.requirement,50)
>     db.commit()
>
> On Oct 19, 8:16 pm,BigBaaadBob wrote:
>
> > I can reliably create this problem with a model that contains
> > "references xxx" and using populate.  Trying to access the table in
> > the db manager causes the referenced error.
>
>


[web2py] Re: What does this mean?

2010-10-19 Thread BigBaaadBob
# The origin of the requirement: i.e. whether it is fundamental or
derived
db.define_table('origin',
Field('name', requires=IS_NOT_EMPTY()),
Field('key', requires=IS_NOT_EMPTY()),
format='%(name)s'
)

# The category of the requirement
db.define_table('kind',
Field('name', requires=IS_NOT_EMPTY()),
Field('key', requires=IS_NOT_EMPTY()),
format='%(name)s'
)

# The actual requirement object
db.define_table('requirement',
Field('title',requires=IS_NOT_EMPTY()),
Field('body', 'text',requires=IS_NOT_EMPTY()),
Field('rationale', 'text'),
Field('preconditions', 'text'),
Field('postconditions', 'text'),
Field('traces_to', 'reference
requirement',requires=IS_EMPTY_OR(IS_IN_DB(db, 'requirement.id',
'requirement.title'))),
Field('origin', db.origin,requires=IS_IN_DB(db, 'origin.id',
'origin.name')),
Field('kind', db.kind,requires=IS_IN_DB(db, 'kind.id',
'kind.name')),
Field('is_safety_critical','boolean'),
Field('updated_by', db.auth_user, default=auth.user_id,
update=auth.user_id, readable=False, writable=False),
Field('updated_on', 'datetime', default=request.now,
update=request.now, readable=False, writable=False),
format='%(title)s'
)

# Put fake data in the requirements table
from gluon.contrib.populate import populate
if db(db.origin.id>0).count() == 0:
populate(db.origin,5)
db.commit()

if db(db.kind.id>0).count() == 0:
populate(db.kind,5)
db.commit()

if db(db.requirement.id>0).count() == 0:
populate(db.requirement,50)
db.commit()


On Oct 19, 8:16 pm, BigBaaadBob  wrote:
> I can reliably create this problem with a model that contains
> "references xxx" and using populate.  Trying to access the table in
> the db manager causes the referenced error.


[web2py] Re: What does this mean?

2010-10-19 Thread BigBaaadBob
I can reliably create this problem with a model that contains
"references xxx" and using populate.  Trying to access the table in
the db manager causes the referenced error.


[web2py] "Pack all" and databases

2010-10-19 Thread BigBaaadBob
I gather "pack all" just packages the contents of the application's
directory...right?

This would then include the content "databases", right ?  But if I
want to deploy an app, it seems like I usually wouldn't want to also
deploy the content of a database.

Is there a way to "pack all" without including the content of
databases?


[web2py] Re: Simple self-reference doesn't work; probable noob error...

2010-10-17 Thread BigBaaadBob
Incidenntally, adding the requires you mention above makes everything
work fine.  Thanks!

On Oct 17, 10:26 am, mdipierro  wrote:
> Somehow you got a string in a field that is supposed to be a
> reference. My guess is that you inserted the data and than you changed
> the field type.

No, but without the requires the crud form didn't contain a drop-down
with references.  Instead I got a box and if I didn't enter something
I would get the exception.


[web2py] Re: Simple self-reference doesn't work; probable noob error...

2010-10-17 Thread BigBaaadBob
I realized at the grocery store last night that entering 0 (which I
assume is an invalid ID) instead of nothing (equal to '') would
resolve the problem because:

>>> x = int('')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: invalid literal for int() with base 10: ''

But what I don't understand is why the examples in the book don't have
that problem:

http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases

And, of course, I'm too noob to know what the code web2py code should
actually do.

On Oct 16, 3:54 pm, mdipierro  wrote:
> this should now be default behavior in trunk.No need for
> db.test.referes_to.requires=IS_EMPTY_OR(IS_IN_DB(db,'test.refers_to'))
>
> please check it.
>

I still get pretty much the same exception:

Traceback (most recent call last):
  File "/home/witr/Desktop/web2pytrunk/gluon/restricted.py", line 188,
in restricted
exec ccode in environment
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 59, in 
  File "/home/witr/Desktop/web2pytrunk/gluon/globals.py", line 96, in

self._caller = lambda f: f()
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 12, in create
form = crud.create(db.test, next = URL('index'))
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2864, in
create
deletable=False,
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2807, in
update
hideerror=self.settings.hideerror):
  File "/home/witr/Desktop/web2pytrunk/gluon/sqlhtml.py", line 1074,
in accepts
fields[fieldname] = int(fields[fieldname])
ValueError: invalid literal for int() with base 10: ''


[web2py] Simple self-reference doesn't work; probable noob error...

2010-10-16 Thread BigBaaadBob
If I have this model:

db.define_table('test',
Field('name', writable=False),
Field('refers_to', 'reference test'))

And this controller function:

def create():
db.test.name.default=request.args(0)
form = crud.create(db.test, next = URL('index'))
return dict(form=form)

And go to URL .../create/xyzzy, I get the expected form but when I
submit I get a ticket with this exception:

Exception: (invalid literal for int()
with base 10: '')

referring to this code:

 if field.type == 'integer':
if fields[fieldname] != None:
fields[fieldname] = int(fields[fieldname])
elif str(field.type).startswith('reference'):
if fields[fieldname] != None and
isinstance(self.table,Table) and not keyed:
fields[fieldname] = int(fields[fieldname])

elif field.type == 'double':
if fields[fieldname] != None:
fields[fieldname] = float(fields[fieldname])

What dumb thing did I do?


[web2py] SSO using Atlassian Crowd

2010-10-16 Thread BigBaaadBob
Does anyone have any experience using Web2py with Atlassian Crowd
supplying SSO?

See: http://www.atlassian.com/software/crowd/


[web2py:17844] Re: Source repository confusion

2009-03-10 Thread BigBaaadBob

Is it fair to say, then, that you won't accept any patches that make
it possible for git users to work on Web2Py?

There are lots of places where Web2py crashes if there is no directory
where it expects otherwise, even if that directory is empty.  Maybe it
is just me, but that seems like a design flaw.

On Mar 6, 11:00 am, mdipierro  wrote:
> the Makefile is only for building binaries. I do not expect users to
> run the Makefile.
>
> I am against using a version control system that forces me to change
> the code (put empty files in empty folders) because they cannot handle
> empty folders.
>
> Massimo
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17598] Re: Source repository confusion

2009-03-06 Thread BigBaaadBob

On Mar 5, 9:44 am, Yarko Tymciurak  wrote:
> The repository (git or otherwise - whoever maintains it) --- should have a
> placeholder to hold empty directories.

If the authoritative repository doesn't anchor these directories then
you force other mirrors to be different to anchor these directories.
I don't think that is a good approach.

I personally think a better approach is to either have web2py
automatically create directories it needs or to have the Makefile do
it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17479] Re: Source repository confusion

2009-03-04 Thread BigBaaadBob

One bummer with collapsing to BZR: I don't think there is a git-bzr is
there?

I agree with the below suggestions.  There really needs to be ONE repo
that is authoritative.

I especially agree that it is better practice to NOT check-in
generated contents like the epydocs, but rather have them get
generated by the Makefile or something.  I've done a lot of work
already on the Makefile (there is some stuff in it that isn't exactly
right).

Also, can we solve the empty-directories problem somehow in the
authoritative repo?  Currently the directory structure of Web2Py apps
is a side effect of the fact they are cloned from the demo application
that has empty dirs in the SCM.  I think it would be much more robust
if there were a "create new empty application" API or something that
would assure the correct directory structure as required by Web2Py.

I've modified the Makefile locally to generate all missing
subdirectories for existing apps.  Remember: Git doesn't (currently)
track empty directories.

On Mar 3, 6:39 pm, AchipA  wrote:
> A few suggestions:
>
> - make one repository a master repository and just mirror it from the
> other(s), do not 'do' anything separately with the other or they will
> diverge over time. I can make a mirroring script although bzr has some
> svn integration via the bzr-svn plugin.
>
> - epydocs and the .tar files are IMO distribution parts, not source.
> You can of course keep them there if it's easier for you, but put them
> on ignore in that case. Patchsets will get smaller and branching/
> pulling/pushing will get faster.
>
> - use branches/tags to release 'official' versions. These would
> include whatever needs to be generated (tar, epydoc, ubuntu packages,
> whatever) and will be easier to reference than just a revision number
>
> - use merging to include patches - again, easier to track and manage
> (I know, you're not a fan of patch automatization but it really is
> easier).
>
> On Mar 3, 11:00 pm, mdipierro  wrote:
>
> > This really helps. Now I understand the problem and will fix it
> > tonight.
>
> > They are both wrong but bzr is better, It only misses some epydocs. I
> > am not updated them periodically because some people asked for that.
> > The .tar files are not necessary when the applications folder is
> > there.
>
> > Massimo
>
> > On Mar 3, 2:28 pm, Markus Gritsch  wrote:
>
> > > On Tue, Mar 3, 2009 at 5:14 PM, mdipierro  wrote:
>
> > > > If you look in the repository Makefile I have a script and I
>
> > > > make svn
> > > > bzr commit -m "..."
> > > > cd ../web2py_svn
> > > > svn commit -m "..."
>
> > > > I do not understand why they are not the same. Other than that the
> > > > other svn problems have been solved.
>
> > > I just checked out the current BZR and SVN revisions, and there are
> > > several differences between them:
>
> > > SVN contains several files which are not present in the BZR repo:
>
> > > __exit__.py
> > > applications/examples/modules/images.py
> > > applications/examples/static/epydoc/gluon*.html
> > > applications/examples/static/epydoc/toc-gluon*.html
> > > applications/examples/views/default/authentication.html
> > > applications/examples/views/default/authorization.html
> > > applications/examples/views/default/crud.html
> > > applications/examples/views/default/features.html
> > > applications/examples/views/default/orm.html
> > > applications/examples/views/default/pyamf_howto.html
> > > applications/examples/views/default/thanks.html
> > > applications/examples/views/default/web2py_vs_php.html
>
> > > Conversely the BZR repo contains files which are not present in SVN:
>
> > > admin.tar
> > > examples.tar
> > > index.yaml
> > > TODO
> > > applications/admin/static/eamy/*
>
> > > And some are different in both repositories:
>
> > > Makefile
> > > scripts/cleancss.py
> > > scripts/repair.py
> > > scripts/session2trash.py
> > > scripts/sync_languages.py
> > > scripts/tickets2db.py
> > > scripts/
>
> > > To me it remains unclear which repo is the authorative one.
>
> > > Markus
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16794] Re: New Appliance Submission: QrOne CSS Designer

2009-02-23 Thread BigBaaadBob

Maybe I'm overly fussy but "if you don't want sessions" doesn't scream
GAE to me...  Isn't there a way this can either be made automatic or
at least explicit as in "if you us GAE you can't use sessions"...

On Feb 23, 8:11 am, dhmorgan  wrote:
> fantastic!
>
> On Feb 19, 2:51 pm, blackthorne  wrote:
>
> > hi
>
> > I've been planning to work on this little application for a while but
> > only now I made it happen.
> > It's a  port from a very simple CSS Designer that generates code for
> > you and allows you to keep visually updated on how it's going to look
> > on the fly.
>
> >http://mdp.cti.depaul.edu/appliances/default/show/47
>
> > feedback is welcome!
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16462] Facebook Web2py group (and gluon group)

2009-02-17 Thread BigBaaadBob

It isn't real important or anything, but I was goofing off and
discovered there is a web2py facebook group that has a few members but
is lacking an admin.  I also discovered there is a gluon FB group too.

Maybe the gluon members can switch to the web2py group and maybe
someone wants to be the group admin ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16368] Re: Normalized database constraints and validation

2009-02-15 Thread BigBaaadBob

Yes, that is what I meant by "think I can solve it by means discussed
here previously".  I think I can see how this would generalize to
additional tables in a DB.  I don't think it generalizes to multiple
DBs though, right?

What I was really asking was if there should be a more direct way of
doing this (what I call "sugar")?

It might help if there was better documentation for IS_NOT_IN_DB
because this trick is a little hard (for me at least) to wrap your
head around.  The current docstring says:  "INPUT
(_type='text',_name='name',requires=IS_NOT_IN_DB(db,db.table))".

As I understand it this does the moral equivalent of "SELECT
events.name WHERE db.events.competition==request.vars.competition AND
events.name==value" and checks if anything is returned?

On Feb 15, 3:32 pm, mdipierro  wrote:
> I think you are looking for this:
>
> db.events.name.requires=IS_NOT_IN_DB(db
> (db.events.competition==request.vars.competition),'events.name')
>
> On Feb 15, 2:20 pm, BigBaaadBob  wrote:
>
> > This seems to be a problematic FAQ, but: if I'm making an effort to
> > normalize my database structure how do I do cross-table validation?
>
> > Example (with extraneous things left out):
>
> > db.define_table('competitions',
> >     SQLField('name','string'),
> >     SQLField('chief_ref','string'))
> > db.competitions.name.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB
> > (db,'competitions.name')]
>
> > db.define_table('events',
> >     SQLField('name','string',length=64),
> >     SQLField('competition',db.competitions))
> > db.events.competition.requires=IS_IN_DB
> > (db,'competitions.id','competitions.name')
>
> > I want to assure that newly added events meet the constraint that the
> > combination of events.name+competitions.id is unique.  IOW, I don't
> > want two events with the same name for a specific competition.
>
> > In this simple case I think I can solve it by means discussed here
> > previously,  But still, I would think cross-table validation is a very
> > frequent requirement in real applications that there should be some
> > sugar for it, no?
>
> > If you use a carefully normalized schema the number of cross-table
> > validations requirements grows beyond just two.  And in real
> > "enterprise" applications, wouldn't you even need to do cross-DB
> > validations?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16350] Normalized database constraints and validation

2009-02-15 Thread BigBaaadBob

This seems to be a problematic FAQ, but: if I'm making an effort to
normalize my database structure how do I do cross-table validation?

Example (with extraneous things left out):

db.define_table('competitions',
SQLField('name','string'),
SQLField('chief_ref','string'))
db.competitions.name.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB
(db,'competitions.name')]

db.define_table('events',
SQLField('name','string',length=64),
SQLField('competition',db.competitions))
db.events.competition.requires=IS_IN_DB
(db,'competitions.id','competitions.name')

I want to assure that newly added events meet the constraint that the
combination of events.name+competitions.id is unique.  IOW, I don't
want two events with the same name for a specific competition.

In this simple case I think I can solve it by means discussed here
previously,  But still, I would think cross-table validation is a very
frequent requirement in real applications that there should be some
sugar for it, no?

If you use a carefully normalized schema the number of cross-table
validations requirements grows beyond just two.  And in real
"enterprise" applications, wouldn't you even need to do cross-DB
validations?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16335] Re: Web2py requires being run in CWD

2009-02-14 Thread BigBaaadBob

Incidentally, it looks like VERSION gets read in two places (main and
widget).  Why is that?

On Feb 14, 3:57 pm, BigBaaadBob  wrote:
> Suppose you:
>
> $ mkdir foo
> $ cd foo
> $ wgethttp://mdp.cti.depaul.edu/examples/static/web2py_src.zip
> $ unzip web2py_src.zip
>
> That leaves you with web2py in the web2py subdir.
>
> If you then:
>
> $ python web2py/web2py.py
> Traceback (most recent call last):
>   File "web2py/web2py.py", line 7, in 
>     from gluon.widget import start
>   File "/home/witr/Projects/ijslog/web2py/gluon/widget.py", line 28,
> in 
>     from gluon.main import HttpServer, save_password
>   File "/home/witr/Projects/ijslog/web2py/gluon/main.py", line 77, in
> 
>     web2py_version = open(os.path.join(web2py_path, 'VERSION'),
> 'r').read()
> IOError: [Errno 2] No such file or directory: '/home/witr/Projects/
> ijslog/VERSION'
>
> That seems like an overreaction.  This specific problem can be easily
> solved in main.py with this:
>
> web2py_path = os.path.realpath(os.path.dirname(sys.argv[0]))
>
> But then the problem shows up elsewhere.
>
> So, is it a fundamental design principle that web2py must be run in
> CWD or can/should this be fixed?
>
> It seems that if web2py were packaged as part of a larger system it
> would be nicer to not have this issue...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16333] Web2py requires being run in CWD

2009-02-14 Thread BigBaaadBob

Suppose you:

$ mkdir foo
$ cd foo
$ wget http://mdp.cti.depaul.edu/examples/static/web2py_src.zip
$ unzip web2py_src.zip

That leaves you with web2py in the web2py subdir.

If you then:

$ python web2py/web2py.py
Traceback (most recent call last):
  File "web2py/web2py.py", line 7, in 
from gluon.widget import start
  File "/home/witr/Projects/ijslog/web2py/gluon/widget.py", line 28,
in 
from gluon.main import HttpServer, save_password
  File "/home/witr/Projects/ijslog/web2py/gluon/main.py", line 77, in

web2py_version = open(os.path.join(web2py_path, 'VERSION'),
'r').read()
IOError: [Errno 2] No such file or directory: '/home/witr/Projects/
ijslog/VERSION'

That seems like an overreaction.  This specific problem can be easily
solved in main.py with this:

web2py_path = os.path.realpath(os.path.dirname(sys.argv[0]))

But then the problem shows up elsewhere.

So, is it a fundamental design principle that web2py must be run in
CWD or can/should this be fixed?

It seems that if web2py were packaged as part of a larger system it
would be nicer to not have this issue...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:15053] Re: Unable to run web2py in a git workspace

2009-01-16 Thread BigBaaadBob

I just want to point out, for those who do not know git, that it isn't
necessary to use github to use git.  By using git-svn ( the "git svn"
command) you can directly track the Google svn repo.  Some may prefer
using the github repo and some (like I do) may prefer to track the
Google svn repo.  Github is really handy for teams that primarily
collaborate using git, but here it seems that most of the
collaboration is via svn or bzr.

On Jan 16, 9:18 pm, Yarko Tymciurak  wrote:
> doh - see how tired I am?  ceej wrote in this thread... sorry for all my
> noise...
>
> On Fri, Jan 16, 2009 at 8:17 PM, Yarko Tymciurak  wrote:
> > It looks like ceej maintains this mirror - I've sent him an email about
> > this so he can take care of it.
>
> > On Fri, Jan 16, 2009 at 8:13 PM, Yarko Tymciurak wrote:
>
> >> The person maintaining the github repository should just do this;
> >> It doesn't look like github has an issue tracker (shame), so you can't
> >> really report this to the mirror maintainer...
>
> >> I've edited that wiki, and put a warning in it (I'm sure someone will be
> >> unhappy, but oh, well!)
>
> >> On Fri, Jan 16, 2009 at 8:06 PM, Yarko Tymciurak wrote:
>
> >>> Of course, if it were I - I would not put empty placeholder files in my
> >>> master if I did not need to, nor useless init files 
> >>> We who mirror where that is needed can write our own scripts to hold
> >>> those directories (by putting empty files in;  I wouldn't do the other way
> >>> around, as the whole point of web2py is no setup - and changed code is...
> >>> well, changed code).
>
> >>> Your mileage may vary.
>
> >>> Y.
>
> >>> On Fri, Jan 16, 2009 at 8:00 PM, Yarko Tymciurak wrote:
>
> >>>> bazaar and svn version directories and files;cvs and mercurial and git
> >>>> do not;
>
> >>>> To "hold" directories (since they are not really versioned) you need to
> >>>> put an empty file in them.
>
> >>>> You can see how I handled it for mercurial by looking at the repository
> >>>> athttp://bitbucket.org/yarko/web2py/
>
> >>>> (you don't have to use mercurial - you can just get a zip or tar file -
> >>>> see upper-right).
>
> >>>> Massimo - perhaps you could (just as a service to the community that
> >>>> uses other repositories) include / merge in "empty, directory 
> >>>> place-holder"
> >>>> files for those that use other repositories?   It's not strictly 
> >>>> necessary,
> >>>> but then the mirrors would at least look the same, and be comparable with
> >>>> tools.
>
> >>>> Thanks,
> >>>> Yarko
>
> >>>> I've been a little busy, so I haven't updated in the past week, but
> >>>> likely will this weekend
>
> >>>> On Fri, Jan 16, 2009 at 4:53 PM, BigBaaadBob  wrote:
>
> >>>>> Massimo:
>
> >>>>> I'm curious on your thoughts here.  I'd like to use git and track your
> >>>>> Google repo because I think that is the authoritative one.   There are
> >>>>> options:
>
> >>>>> * If you make the currently empty directories non-empty (by adding
> >>>>> a .something file or something) this will "just work".
>
> >>>>> * I can cause the empty directories to be created somehow and publish
> >>>>> that for other git users (tracking svn) could do the same.  This could
> >>>>> even be automated somehow.
>
> >>>>> I understand that you might not want to do things to support a SCM you
> >>>>> don't use.
>
> >>>>> On Jan 16, 9:50 am, BigBaaadBob  wrote:
> >>>>> > Ceej:  I'm using git-svn to track Massimo's SVN repo directly.
>
> >>>>> > It is probably just me, but I prefer to track the authoritative
> >>>>> > repo.   I worry if different repos have the different "trunk"
> >>>>> > content.  I know you are only talking about .gitignore files but it
> >>>>> > feels like a slippery slope to me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:15046] Re: Unable to run web2py in a git workspace

2009-01-16 Thread BigBaaadBob

Massimo:

I'm curious on your thoughts here.  I'd like to use git and track your
Google repo because I think that is the authoritative one.   There are
options:

* If you make the currently empty directories non-empty (by adding
a .something file or something) this will "just work".

* I can cause the empty directories to be created somehow and publish
that for other git users (tracking svn) could do the same.  This could
even be automated somehow.

I understand that you might not want to do things to support a SCM you
don't use.

On Jan 16, 9:50 am, BigBaaadBob  wrote:
> Ceej:  I'm using git-svn to track Massimo's SVN repo directly.
>
> It is probably just me, but I prefer to track the authoritative
> repo.   I worry if different repos have the different "trunk"
> content.  I know you are only talking about .gitignore files but it
> feels like a slippery slope to me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:15040] Re: Unable to run web2py in a git workspace

2009-01-16 Thread BigBaaadBob

Ceej:  I'm using git-svn to track Massimo's SVN repo directly.

It is probably just me, but I prefer to track the authoritative
repo.   I worry if different repos have the different "trunk"
content.  I know you are only talking about .gitignore files but it
feels like a slippery slope to me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:15033] Re: Unable to run web2py in a git workspace

2009-01-15 Thread BigBaaadBob

Ceej is right, and I realized it right after I posted. Git can't
version empty directories.  There is a long thread about it here, with
Linux weighing in.  http://kerneltrap.org/mailarchive/git/2007/7/17/251902.
I don't know if anything has been done in Git to change this behavior.

I'm not sure I would like to have the SVN (or BZR) repo
contain .gitignore files because that would imply it should also
have .whateverignore files for every other SCM that might hold web2py.

That would be a bad idea for a number of reasons, but the most
troubling would be that this would duplicate the "ignore" information
in a lot of places and would then be error prone and a pain to
maintain.

Of course one could put some file in each empty directory as a work-
around as Ceej suggests but that would only address the empty
directory problem and not the ignore problem.

Maybe there is a better way that kills two birds with one stone.  I
observe that the basic information about empty directories is in the
Makefile, as well as the info for which stuff should be ignored.
Maybe this could be generalized so one could have targets like
"gitconfig" that would create the required empty directories and also
put .gitignore files with the correct contents where they go.

Good or bad idea?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:15018] Unable to run web2py in a git workspace

2009-01-15 Thread BigBaaadBob

If I do a SVN checkout from Google and then run web2py, everthing
works fine.

If I do the same thing using git, I get this:

 $ ./web2py.py
default applications appear to be installed already
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2008
Version 1.55 (2009-01-07 21:07:28)
Database drivers available: SQLite3
choose a password:password
please visit:
http://127.0.0.1:8000
use "kill -SIGTERM 30396" to shutdown the web2py server
WARNING:root:no cache.disk
ERROR:root:Traceback (most recent call last):
  File "/home/witr/Projects/web2py/repo/gluon/restricted.py", line 62,
in restricted
exec ccode in environment
  File "/home/witr/Projects/web2py/repo/applications/welcome/models/
db.py", line 8, in 
db=SQLDB('sqlite://storage.db') # if not, use SQLite or
other DB
  File "/home/witr/Projects/web2py/repo/gluon/sql.py", line 458, in
__init__
self._pool_connection(lambda:sqlite3.Connection(dbpath))
  File "/home/witr/Projects/web2py/repo/gluon/sql.py", line 423, in
_pool_connection
self._connection=f()
  File "/home/witr/Projects/web2py/repo/gluon/sql.py", line 458, in

self._pool_connection(lambda:sqlite3.Connection(dbpath))
OperationalError: unable to open database file

Any suggestions how to debug this"?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14677] Re: Support for workflow?

2009-01-07 Thread BigBaaadBob

>
> So, the best font ishttp://www.workflowpatterns.com/patterns/index.php
>

Oohh.

Lots there, but I guess I was hoping for a Web2pyish simplest workflow
api that could possibly work.  ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14648] Support for workflow?

2009-01-06 Thread BigBaaadBob

How would the group recommend one support workflow in a Web2py app?

Consider, for example, a document approval application.  The document
may have to go through various steps of review and signoff, with
notification and recording at each step.

Is there support for that in Web2py, or something that is easily
integratable?  Anything other than hand rolling?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:12185] Re: issues deploying latest web2py to GAE

2008-11-19 Thread BigBaaadBob

Isn't the ticket feature one of the key features of web2py?  It is
listed on the features page.

On Nov 19, 2:53 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> It would not be too difficult but would it really be necessary? The
> google error logs are not too bad.
>
> Massimo
>
> On Nov 19, 1:45 pm, Andrew <[EMAIL PROTECTED]> wrote:
>
> > Okay thanks. Got it working. I was trying to access the admin / ticket
> > interface which I overlooked isn't supported in GAE.
>
> > Is it possible to make a version that uses GQL for tickets and such so
> > we can use admin / ticket interface on GAE? Or would that be a great
> > undertaking?
>
> > On Nov 19, 12:36 pm, yarko <[EMAIL PROTECTED]> wrote:
>
> > > There is recent discussion (including a step-by-step) of this here:
>
> > >http://groups.google.com/group/web2py/browse_thread/thread/e9fc4ce130...
>
> > > Perhaps that will help?
>
> > > On Nov 19, 12:23 pm, Andrew <[EMAIL PROTECTED]> wrote:
>
> > > > Hey guys,
>
> > > > I was following the guide here:
>
> > > >http://mdp.cti.depaul.edu/AlterEgo/default/show/186
>
> > > > and simply deployed the default web2py and hit my appspot page and
> > > > only got:
>
> > > > Invalid request. It even forward it from the root of my appspot uri /
> > > > to /welcome/default/index
>
> > > > I checked the Appspot logs and saw this from the request:
>
> > > > #
>
> > > >   11-19 08:57AM 41.584 / 303 1323ms 3566mcycles 0kb
> > > >       See details
>
> > > >       66.84.209.94 - - [19/11/2008:08:57:42 -0800] "GET / HTTP/1.1"
> > > > 303 145 - -
>
> > > >    [W] 11-19 08:57AM 41.707
> > > >       no file locking
>
> > > >    [D] 11-19 08:57AM 42.055
> > > >       no sqlite3 or dbapi2 driver
>
> > > >    [D] 11-19 08:57AM 42.059
> > > >       no MySQLdb driver
>
> > > >    [D] 11-19 08:57AM 42.062
> > > >       no psycopg2 driver
>
> > > >    [D] 11-19 08:57AM 42.065
> > > >       no cx_Oracle driver
>
> > > >    [D] 11-19 08:57AM 42.069
> > > >       no MSSQL driver
>
> > > >    [D] 11-19 08:57AM 42.073
> > > >       no kinterbasdb driver
>
> > > >    [D] 11-19 08:57AM 42.077
> > > >       no informixdb driver
>
> > > >    [W] 11-19 08:57AM 42.145
> > > >       unable to import dbhash
>
> > > >    [W] 11-19 08:57AM 42.178
> > > >       unable to import py_compile
>
> > > >    [W] 11-19 08:57AM 42.295
> > > >       unable to import wsgiserver
>
> > > > Is it an issue that it can't import wsgiserver or all of these failed
> > > > imports typical?
>
> > > > TIA!
>
> > > > Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:11199] Re: About patches

2008-11-05 Thread BigBaaadBob


> Should I just try a mercurial site, and see if that would work better? :-)

Trac with GIT?  ;-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:10597] Re: Video tutorial uses blob instead of text

2008-10-24 Thread BigBaaadBob

http://www.vimeo.com/428474

On Oct 24, 11:24 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> Thank you. Which one is it?
>
> Massimo
>
> On Oct 24, 8:38 pm, BigBaaadBob <[EMAIL PROTECTED]> wrote:
>
> > [I tried to reply to a previous message about this, but stupid google
> > groups expires reply capability after a while...]
>
> > The video tutorial on viveo tells you to use blob instead of text,
> > which causes the example to fail.  You might want to put a note on
> > that site if you can't voice-over the problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:10595] Video tutorial uses blob instead of text

2008-10-24 Thread BigBaaadBob

[I tried to reply to a previous message about this, but stupid google
groups expires reply capability after a while...]

The video tutorial on viveo tells you to use blob instead of text,
which causes the example to fail.  You might want to put a note on
that site if you can't voice-over the problem.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---