SQLAlchemy and Pyramid, how to get resources from context?

I have a problem related around my Pyramid web application. I structured it very similar to that described by Michael Merikel here , except that I use a clean bypass to find my views. (They are declared configured with context = 'path.toResource' name = 'myView'), a fairly standard tariff according to what I can say from the workaround wiki My application has a more complex URL structure: My user resources are under /users/{user_id}, and my projects are under /projects/{project_id}. All my resources are saved using SQLAlchemy ORM; I have a User and Project class with attributes __name__and __parent__, as well as other attributes extending the columns.

class User(Base):
    id = Column(...)
    __name__ = None
    __parent__ = None
Class Project(Base):
    id = Column(...)
    __name__ = None
    __parent__ = None
    owner_id = Column(...ForeignKey(User.id))
    owner = relationship(User,...)

RootFactory, ProjectFactory UserFactory, __name__ __parent__ __get_item__.

, Project Project request.context. , ? project.owner, RootFactory, __parent__ __name__ . , request.resource_url, URL- User, .

SO? request.root? , , User Project? - CrapFactory, SQLAlchemy, ?

?

, , URL-...

+5
1

, SQLAlchemy . , , node .

2 .

  • , , . , , . . . User Project resource_id , , , .

  • , , request.root, .

__resource_url__ , .

, , , , " URL- " , . URL- , .

+5

All Articles