source: publico/il.spdo/trunk/il/spdo/containers.py @ 5327

Última Alteração nesse arquivo desde 5327 foi 5327, incluída por fabianosantos, 8 anos atrás

Import inicial.

File size: 1.0 KB
Linha 
1from OFS.SimpleItem import SimpleItem
2from zope.interface import implements
3from zope.component import getUtility
4from zope.publisher.interfaces import IPublishTraverse
5from zope.publisher.interfaces import NotFound
6#from test.crudform.interfaces import IAgenda
7#from test.crudform.persona import Persona
8
9from il.spdo.interfaces import IArea
10from il.spdo.config import Session
11from il.spdo.db import Area
12
13class AreaContainer(SimpleItem):
14    implements(IArea, IPublishTraverse)
15
16    __name__ = None
17    __parent__ = None
18    title = u'Areas'
19    id = 'areas'
20
21    def Title(self):
22        return self.title
23
24    def publishTraverse(self, request, area_id):
25        import pdb; pdb.set_trace()
26        if area_id:
27            session = Session()
28            results = session.query(Area).filter_by(id=area_id)
29            if results.count() == 0:
30                raise NotFound(self, area_id, request)
31
32        area = results.one()
33        area.__name__ = area_id
34        area.__parent__ = self
35        return area.__of__(self)
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.