[web2py] Re: storing hierarchical data in web2py database

2010-07-13 Thread sociotech
You might want to check out Massimo's code for Modified Preorder Tree
Traversal, which is an extremely efficient way of storing tree
structures in a database:

http://groups.google.com/group/web2py/browse_thread/thread/70efddab62dfe73

On Jul 13, 11:59 am, "topher.baron"  wrote:
> I'm looking forward to it.
>
> On Jul 13, 1:12 pm, Vasile Ermicioi  wrote:
>
> > I am developing a solution for my needs, something similar to nested sets,
> > if you could wait a few days I think I will be able to share it


[web2py] Re: ANN: first pre-alfa release (v0.2) of Web2Py_CC

2010-08-31 Thread sociotech
Stef,

Thanks for developing what looks like an awesome environment for
web2py.

I tried installing it with your recommended dependencies on my Ubuntu
10.04 system (Python 2.6) and got the following error:

Traceback (most recent call last):
  File "Web2py_CC.py", line 24, in 
import wx.lib.agw.thumbnailctrl as TC
ImportError: No module named agw.thumbnailctrl

I have wxpython installed (version wx-2.8-gtk2-unicode) so I'm not
sure what's missing.

I'll keep following your development efforts and hope to get it
working so I can try it out.

Thanks,

Chris

On Aug 27, 1:13 pm, Stef Mientki  wrote:
>  hello,
>
> I'm proud to  present the first pre-alfa release of Web2Py_CC.
>
> *Windows*: as it's developed under windows, it runs without exceptions (and 
> of course a few bugs ;-)
> Sorry, I wasn't  able to produce an executable, because py2exe had problems 
> (probably with my
> recently upgraded wxPython, and I can't go back).
>
> *Fedora 13*: runs as expected
>
> *Ubuntu 10*: 2 days ago, it runned as expected, but after an adviced upgrade 
> of wxPython, my
> complete Ubuntu installation is ruined.
>
> *Mac*: sorry I've no access to Mac
>
> you can find some documentation here:
>  http://mientki.ruhosting.nl/web2py/web2py_cc.html
> a download link and installation instructions are at the bottom of the above 
> page.
>
> have fun,
> Stef


[web2py:16290] Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread sociotech

Just wondering if anyone has implemented modified preorder tree
traversal (MPTT) functions for Web2Py yet. MPTT is an efficient
approach to organizing hierarchically-related records (e.g., nested
menus, parent/child relationships, etc.) in a database.

I was hoping someone here might've already implemented it (there is an
implementation for Django and more general information here:
http://code.google.com/p/django-mptt/), but I haven't found anything
yet.

Thanks very much,

Chris

--~--~-~--~~~---~--~~
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:16317] Re: Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread sociotech

Massimo,

Thanks very much for your quick response and helpful code.

I'm new to Web2Py, but I'm really enjoying it so far.  In a way, it
reminds me of the rapid development positive feedback loop I felt
when I first encountered Borland's Delphi environment.  Addictively
fun!

I'm not sure what's involved in packaging the code better, but I'll
give it
a shot as soon as i figure it out :)

Thanks again!

Chris

On Feb 13, 8:27 am, mdipierro  wrote:
> Chris, you manage to package this a little better please let me know.
> You could write an alterego entry about it or just post the code
> somewhere.
>
> Massimo
>
> On Feb 13, 10:24 am, mdipierro  wrote:
>
> > Hi Chris,
>
> > no. But it is trivial with web2py.
>
> > Here I implemented the example 
> > inhttp://www.sitepoint.com/print/hierarchical-data-database/
>
> > db=SQLDB('sqlite://tree.db')
> > db.define_table('tree',db.Field('title'),db.Field
> > ('left','integer'),db.Field('right','integer'))
> > db.tree.insert(title='Food',left=1,right=2)
>
> > def add_node(title,parent_title):
>
> > """
> >     add_node
> > ('Fruit','Food')
> >     add_node
> > ('Meat','Food')
> >     add_node
> > ('Red','Fruit')
> >     """
> >     parent=db(db.tree.title==parent_title).select()[0]
> >     db(db.tree.right>=parent.right).update(right=db.tree.right+2)
> >     db(db.tree.left>=parent.right).update(left=db.tree.left+2)
> >     db.tree.insert(title=title,left=parent.right,right=parent.right+1)
>
> > def ancestors(title,*fields):
> >     """ print ancestors('Red',db.tree.title)"""
> >     node=db(db.tree.title==title).select()[0]
> >     return db(db.tree.leftnode.right).select
> > (orderby=db.tree.left,*fields)
>
> > def descendants(title,*fields):
> >     """ print ancestors('Fruit',db.tree.title)"""
> >     node=db(db.tree.title==title).select()[0]
> >     return db(db.tree.left>node.left)(db.tree.right > (orderby=db.tree.left,*fields)
>
> > def test():
> >     print db().select(db.tree.ALL)
> >     add_node('Fruit','Food')
> >     print db().select(db.tree.ALL)
> >     add_node('Meat','Food')
> >     print db().select(db.tree.ALL)
> >     add_node('Red','Fruit')
> >     print db().select(db.tree.ALL)
> >     print ancestors('Red',db.tree.title)
> >     print descendants('Fruit',db.tree.title)
>
> > test()
>
> > OUTPUT:
> > tree.id,tree.title,tree.left,tree.right
> > 1,Food,1,2
>
> > tree.id,tree.title,tree.left,tree.right
> > 1,Food,1,4
> > 2,Fruit,2,3
>
> > tree.id,tree.title,tree.left,tree.right
> > 1,Food,1,6
> > 2,Fruit,2,3
> > 3,Meat,4,5
>
> > tree.id,tree.title,tree.left,tree.right
> > 1,Food,1,8
> > 2,Fruit,2,5
> > 3,Meat,6,7
> > 4,Red,3,4
>
> > tree.title
> > Food
> > Fruit
>
> > tree.title
> > Red
>
> > On Feb 13, 2:31 am, sociotech  wrote:
>
> > > Just wondering if anyone has implemented modified preorder tree
> > > traversal (MPTT) functions for Web2Py yet. MPTT is an efficient
> > > approach to organizing hierarchically-related records (e.g., nested
> > > menus, parent/child relationships, etc.) in a database.
>
> > > I was hoping someone here might've already implemented it (there is an
> > > implementation for Django and more general information 
> > > here:http://code.google.com/p/django-mptt/), but I haven't found anything
> > > yet.
>
> > > Thanks very much,
>
> > > Chris
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---