# HG changeset patch # User Sylvain Thénault # Date 1248430097 -7200 # Node ID 6983631f5d0dd468b641e24a49a13118ca236a48 # Parent c4ccfd38a5427dc8fee870abd6f66de15155720f don't fail on unknown eid, simply issue a warning diff -r c4ccfd38a542 -r 6983631f5d0d ext/rest.py --- a/ext/rest.py Fri Jul 24 10:36:57 2009 +0200 +++ b/ext/rest.py Fri Jul 24 12:08:17 2009 +0200 @@ -31,6 +31,7 @@ from logilab.mtconverter import ESC_UCAR_TABLE, ESC_CAR_TABLE, xml_escape +from cubicweb import UnknownEid from cubicweb.ext.html4zope import Writer # We provide our own parser as an attempt to get rid of @@ -68,8 +69,13 @@ return [prb], [msg] # Base URL mainly used by inliner.pep_reference; so this is correct: context = inliner.document.settings.context - refedentity = context.req.eid_rset(eid_num).get_entity(0, 0) - ref = refedentity.absolute_url() + try: + refedentity = context.req.eid_rset(eid_num).get_entity(0, 0) + except UnknownEid: + ref = '#' + rest += u' ' + context.req._('(UNEXISTANT EID)') + else: + ref = refedentity.absolute_url() set_classes(options) return [nodes.reference(rawtext, utils.unescape(rest), refuri=ref, **options)], []