diff -r 000000000000 -r b97547f5f1fa goa/appobjects/components.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/goa/appobjects/components.py Wed Nov 05 15:52:50 2008 +0100 @@ -0,0 +1,100 @@ +"""overrides some base views for cubicweb on google appengine + +:organization: Logilab +:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr +""" +__docformat__ = "restructuredtext en" + +from os.path import join + +from logilab.mtconverter import html_escape +from logilab.common.decorators import cached + +from cubicweb import typed_eid +from cubicweb.schema import display_name +from cubicweb.common.view import StartupView, EntityView +from cubicweb.common.selectors import (onelinerset_selector, searchstate_selector, + accept_selector) +from cubicweb.web import Redirect +from cubicweb.web.views import vid_from_rset +from cubicweb.goa.db import rset_from_objs + +from google.appengine.api import datastore, mail + +from main import APPLROOT + + +class SearchForAssociationView(EntityView): + """view called by the edition view when the user asks + to search for something to link to the edited eid + """ + id = 'search-associate' + + __selectors__ = (onelinerset_selector, searchstate_selector, accept_selector) + accepts = ('Any',) + search_states = ('linksearch',) + + def cell_call(self, row, col): + entity = self.entity(0, 0) + role, eid, rtype, etype = self.req.search_state[1] + assert entity.eid == typed_eid(eid) + rset = entity.unrelated(rtype, etype, role, ordermethod='fetch_order') + vid = vid_from_rset(self.req, rset, self.schema) + self.w(u'