Re: Using SQLAlchemy with Traversal.

2011-01-26 Thread Wade Leftwich
Actually I hollered "D'oh!" immediately after posting that, just then noticing that I had proudly shown off one of the classic Python beginner errors. The easy correction: class Context(object): def __init__(self): self.__name__ = None self.__parent__ = None self.childr

Re: Using SQLAlchemy with Traversal.

2011-01-26 Thread Rob Miller
On 1/26/11 6:13 AM, Wade Leftwich wrote: I've been dealing with similar issues on my first-ever Pyramid project, also using sqlalchemy and traversal. This may be indirection overkill, but I separated Context objects from Data objects. Note this is a reporting application, so it's more into displ

Re: Using SQLAlchemy with Traversal.

2011-01-26 Thread Wade Leftwich
Kind of a similar approach. In both cases I think there is merit in keeping the site-structure code separate from the data-access code. In my app, the sqlalchemy classes are also used by another application, so I don't want to load them up with stuff that is specific to the website. And composition

Re: Using SQLAlchemy with Traversal.

2011-01-26 Thread Kyle Terry
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/26/2011 06:13 AM, Wade Leftwich wrote: > I've been dealing with similar issues on my first-ever Pyramid > project, also using sqlalchemy and traversal. > > This may be indirection overkill, but I separated Context objects > from Data objects. No

Re: Using SQLAlchemy with Traversal.

2011-01-26 Thread Wade Leftwich
I've been dealing with similar issues on my first-ever Pyramid project, also using sqlalchemy and traversal. This may be indirection overkill, but I separated Context objects from Data objects. Note this is a reporting application, so it's more into displaying the results of queries than in intera

Re: Using SQLAlchemy with Traversal.

2011-01-25 Thread Daniel Holth
Kyle, You should be able to do something as simple as class Foo: bars = relationship(Bar, backref='__parent__') Is it necessary? With the default traversal implementation you override __getitem__ to return objects with __name__ and __parent__: def __getitem__(self, key): b

Re: Using SQLAlchemy with Traversal.

2011-01-25 Thread Rob Miller
On 1/25/11 3:54 PM, Kyle Terry wrote: I know this isn't the SQLAlchemy list, but I've been designing my resource tree using SQLAlchemy and traversal for my up coming project. I was thinking about starting a discussion and possibly getting some help on a problem I'm having. I have the Foo resourc

Using SQLAlchemy with Traversal.

2011-01-25 Thread Kyle Terry
I know this isn't the SQLAlchemy list, but I've been designing my resource tree using SQLAlchemy and traversal for my up coming project. I was thinking about starting a discussion and possibly getting some help on a problem I'm having. I have the Foo resource, which is an object mapped to the foo