# HG changeset patch # User Sylvain Thénault # Date 1284655420 -7200 # Node ID 83179ccbda1f784114a45d02ec33c103400bb30e # Parent cb4a48b2250e20348404da35e11ba966e3299862# Parent 9d20b138775180a11755908bfc7ac371b5e97027 merge stable heads diff -r 9d20b1387751 -r 83179ccbda1f ext/rest.py --- a/ext/rest.py Thu Sep 16 18:36:42 2010 +0200 +++ b/ext/rest.py Thu Sep 16 18:43:40 2010 +0200 @@ -242,8 +242,14 @@ data = data.translate(ESC_CAR_TABLE) settings = {'input_encoding': encoding, 'output_encoding': 'unicode', 'warning_stream': StringIO(), + 'traceback': True, # don't sys.exit + 'stylesheet': None, # don't try to embed stylesheet (may cause + # obscure bug due to docutils computing + # relative path according to the directory + # used *at import time* # dunno what's the max, severe is 4, and we never want a crash - # (though try/except may be a better option...) + # (though try/except may be a better option...). May be the + # above traceback option will avoid this? 'halt_level': 10, } if context: diff -r 9d20b1387751 -r 83179ccbda1f web/application.py --- a/web/application.py Thu Sep 16 18:36:42 2010 +0200 +++ b/web/application.py Thu Sep 16 18:43:40 2010 +0200 @@ -429,11 +429,12 @@ self.validation_error_handler(req, ex) except (Unauthorized, BadRQLQuery, RequestError), ex: self.error_handler(req, ex, tb=False) - except Exception, ex: + except BaseException, ex: self.error_handler(req, ex, tb=True) except: self.critical('Catch all triggered!!!') self.exception('this is what happened') + result = 'oops' finally: if req.cnx and not commited: try: diff -r 9d20b1387751 -r 83179ccbda1f web/views/__init__.py --- a/web/views/__init__.py Thu Sep 16 18:36:42 2010 +0200 +++ b/web/views/__init__.py Thu Sep 16 18:43:40 2010 +0200 @@ -84,7 +84,7 @@ return VID_BY_MIMETYPE[mimetype] nb_rows = len(rset) # empty resultset - if nb_rows == 0 : + if nb_rows == 0: return 'noresult' # entity result set if not schema.eschema(rset.description[0][0]).final: diff -r 9d20b1387751 -r 83179ccbda1f web/views/urlpublishing.py --- a/web/views/urlpublishing.py Thu Sep 16 18:36:42 2010 +0200 +++ b/web/views/urlpublishing.py Thu Sep 16 18:43:40 2010 +0200 @@ -179,10 +179,19 @@ return self.handle_etype_attr(req, cls, attrname, value) return self.handle_etype(req, cls) - def handle_etype(self, req, cls): - rset = req.execute(cls.fetch_rql(req.user)) + def set_vid_for_rset(self, req, cls, rset):# cls is there to ease overriding if rset.rowcount == 0: raise NotFound() + # we've to set a default vid here, since vid_from_rset may try to use a + # table view if fetch_rql include some non final relation + if rset.rowcount == 1: + req.form.setdefault('vid', 'primary') + else: # rset.rowcount >= 1 + req.form.setdefault('vid', 'sameetypelist') + + def handle_etype(self, req, cls): + rset = req.execute(cls.fetch_rql(req.user)) + self.set_vid_for_rset(req, cls, rset) return None, rset def handle_etype_attr(self, req, cls, attrname, value): @@ -196,8 +205,7 @@ raise PathDontMatch() else: rset = req.execute(rql, {'x': value}) - if rset.rowcount == 0: - raise NotFound() + self.set_vid_for_rset(req, cls, rset) return None, rset