<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style>.EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; }</style>
</head>
<body>
<font face="Courier New, monospace" size="2">
<div>Hi,</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>First of all, thank you Grok and ZOPE developers for a wonderfull web framework.</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>I am finishing my first web project with Grok.</div>
<div>But i have one problem with customized exception views.</div>
<div>I created a custom view &#8220;Unauthorized&#8221; for exception &#8220;IUnauthorized&#8221;:</div>
<div>&nbsp;</div>
<div>class Unauthorized(grok.View):</div>
<div>&nbsp;&nbsp;&nbsp; grok.context(IUnauthorized)</div>
<div>&nbsp;&nbsp;&nbsp; grok.name('index.html')</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; def update(self):</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8230;</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>For that view I created template, in that template I use something like that (please note &#8220;${view/application_url}&#8221;): </div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>&nbsp; &lt;a i18n:translate=&quot;&quot; tal:attributes=&quot;href string:${view/application_url}/offers?offertype=sale&amp;realtytype=apartment&quot;&gt;sale&lt;/a&gt;</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>When I try to browse grok administrator at url <a href="http://localhost:8080"><font color="#0000FF"><u>http://localhost:8080</u></font></a> to create application instance, the following page is rendered in browser:</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>&gt;&gt;&gt;</div>
<div style="margin-top: 5pt; margin-bottom: 5pt; "><font face="Times New Roman, serif" size="5"><b>&lt;class 'zope.security.interfaces.Unauthorized'&gt;</b></font></div>
<div><font face="Times New Roman, serif" size="3">A server error occurred.</font></div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>&lt;&lt;&lt;</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>And following exception is thrown, (copy-paste from console output):</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>&gt;&gt;&gt;</div>
<div>&nbsp; 2008-03-31T14:11:39 ERROR SiteError Exception while rendering view on exception</div>
<div>&nbsp; ...</div>
<div>&nbsp; &lt;FILES IN STACK TRACE&gt;</div>
<div>&nbsp; ...</div>
<div>&nbsp; File &quot;d:\src\klucsiteenv\klucsite\buildout-eggs\zope.tales-3.4.0a1-py2.5.egg\zope\tales\tales.py&quot;, line 696, in evaluate</div>
<div>&nbsp;&nbsp;&nbsp; return expression(self)</div>
<div>&nbsp;&nbsp; - d:\src\klucsiteenv\klucsite\src\klucsite\app_templates\unauthorized.pt</div>
<div>&nbsp;&nbsp; - Line 20, Column 6</div>
<div>&nbsp;&nbsp; - Expression: &lt;StringExpr u'${view/application_url}/offers?offertype=sale&amp;realtytype=apartment'&gt;</div>
<div>&nbsp;&nbsp; - Names:</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {'args': (),</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'context': &lt;zope.app.folder.folder.Folder object at 0x0208C2F0&gt;,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'default': &lt;object object at 0x00A705E8&gt;,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'loop': {},</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'nothing': None,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'options': {},</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'repeat': {},</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'request': &lt;zc.resourcelibrary.publication.Request instance URL=http://localhost:8080/favicon.ico&gt;,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'static': &lt;grok.components.DirectoryResource object at 0x02F8D4B0&gt;,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'template': &lt;grok.components.TrustedFilePageTemplate object at 0x02E7D310&gt;,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'view': &lt;klucsite.app.NotFound object at 0x02F8D3F0&gt;}</div>
<div>&nbsp; File &quot;d:\src\klucsiteenv\klucsite\buildout-eggs\zope.tales-3.4.0a1-py2.5.egg\zope\tales\expressions.py&quot;, line 261, in __call__</div>
<div>&nbsp;&nbsp;&nbsp; v = var(econtext)</div>
<div>&nbsp; File &quot;d:\src\klucsiteenv\klucsite\buildout-eggs\zope.tales-3.4.0a1-py2.5.egg\zope\tales\expressions.py&quot;, line 217, in __call__</div>
<div>&nbsp;&nbsp;&nbsp; return self._eval(econtext)</div>
<div>&nbsp; File &quot;d:\src\klucsiteenv\klucsite\buildout-eggs\zope.tales-3.4.0a1-py2.5.egg\zope\tales\expressions.py&quot;, line 211, in _eval</div>
<div>&nbsp;&nbsp;&nbsp; return ob()</div>
<div>&nbsp; File &quot;d:\src\klucsiteenv\klucsite\buildout-eggs\grok-0.11.1-py2.5.egg\grok\components.py&quot;, line 186, in application_url</div>
<div>&nbsp;&nbsp;&nbsp; raise ValueError(&quot;No application found.&quot;)</div>
<div>ValueError: No application found.</div>
<div>&lt;&lt;&lt;</div>
<div>&nbsp;</div>
<div>As I understand, the exception of type &#8220;IUnauthorized&#8221; is thrown. Then my custom view for that exception is evaluated and failed on path expression: ${view/application_url}/offers?offertype=sale&amp;realtytype=apartment. I discovered that exception with value
&#8220;ValueError: No application found.&#8221; is rased in function application_url(). I understand that there is no application created, but I can not create one, if I can not login to Grok administrator. I understand that this is because my custom exception view somehow
replaced default view that popups login form.</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>Please can someone tell me how to properly use custom exception views ?</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div>Thank in advance for any help,</div>
<div>Roman Lacko</div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
<div><font face="Calibri, sans-serif" size="2">&nbsp;</font></div>
</font>
</body>
</html>