[Repoze-dev] Predicates on routes vs views

2009-10-22 Thread Malthe Borch
Currently the predicates pertain only to views, regardless of whether
they're declared using a route or a view directive (or using the
``bfg_view`` decorator).

I would expect that if you declare a predicate on the route, that the
route would only be used if that predicate matches. Instead, the route
is used regardless, while the view which is declared on that same
route is guarded with the predicate check.

Does it make sense (and is it feasible in terms of
backwards-compatibility concerns) to have the predicate be matched
against the route, and if it does not match, go on to the next route?

\malthe
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Predicates on routes vs views

2009-10-22 Thread Malthe Borch
2009/10/22 Tres Seaver tsea...@palladion.com:
 The view predicates are there to allow selecting a particular view among
 several registered for the route or context:  e.g., to dispatch to
 different views for GET versus POST for the same route / context and
 view name.

It makes perfect sense with view.

With route, however, I think predicates make sense without
specifying a view. And currently, predicates are silently ignored if
you don't provide a view directly when you define a route.

\malthe
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] zope.autointerface: using the autointerface crashes sphinx

2009-10-22 Thread Jean Daniel
Hello,

I can't document python interfaces with the autointerface directive
for Sphinx and Zope interface. I use the simplest setup in a virtual
env with the latest autointerface and sphinx eggs.

The document I try to compile is the basic template generated by
sphinx-quickstart and the class I try to document is the class IFoo
from the zope Interface doc on Pypi.

I have also used the repoze.sphinx.autointerface from trunk in 0.3dev,
it is possible that I am missing something obvious...

Thanks in advance,



Here is a reproducer :

virtualenv autointerface
cd autointerface
source bin/activate
easy_install sphinx
easy_install repoze.sphinx.autointerface

sphinx-quickstart
#  [ ... ]   # use the default options, no extensions

sed 's/extensions = \[\]/extensions = \['repoze.sphinx.autointerface',\]/'

sphinx-build . _build   # everything is fine: there is no call to
the autointerface directive

cat  index.rst
.. autointerface:: test.IFoo
ctrl-d

sphinx-build . _build   # crash

Exception occurred:
  File 
/home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/statemachine.py,
line 414, in check_line
match = pattern.match(self.line)
TypeError: expected string or buffer
The full traceback has been saved in /tmp/sphinx-err-6Zf498.log, if
you want to report the issue to the author.

The full traceback is attached. There is no difference wether or not
the module test.py is actually present.
# Sphinx version: 0.6.3
# Docutils version: 0.6 release
Traceback (most recent call last):
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/cmdline.py, line 172, in main
app.build(all_files, filenames)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/application.py, line 130, in build
self.builder.build_update()
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/builders/__init__.py, line 265, in build_update
'out of date' % len(to_build))
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/builders/__init__.py, line 285, in build
purple, length):
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/builders/__init__.py, line 131, in status_iterator
for item in iterable:
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/environment.py, line 513, in update_generator
self.read_doc(docname, app=app)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/environment.py, line 604, in read_doc
pub.publish()
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/core.py, line 203, in publish
self.settings)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/readers/__init__.py, line 69, in read
self.parse()
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/readers/__init__.py, line 75, in parse
self.parser.parse(self.input, document)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/__init__.py, line 157, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 170, in run
input_source=document['source'])
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/statemachine.py, line 233, in run
context, state, transitions)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/statemachine.py, line 421, in check_line
return method(match, context, next_state)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 2678, in underline
self.section(title, source, style, lineno - 1, messages)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 323, in section
self.new_subsection(title, lineno, messages)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 391, in new_subsection
node=section_node, match_titles=1)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 278, in nested_parse
node=node, match_titles=match_titles)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/parsers/rst/states.py, line 195, in run
results = StateMachineWS.run(self, input_lines, input_offset)
  File /home/jdbrowne/autointerface/lib/python2.6/site-packages/docutils-0.6-py2.6.egg/docutils/statemachine.py, line 233, in run

Re: [Repoze-dev] Predicates on routes vs views

2009-10-22 Thread Chris McDonough
Malthe Borch wrote:
 2009/10/22 Tres Seaver tsea...@palladion.com:
 The view predicates are there to allow selecting a particular view among
 several registered for the route or context:  e.g., to dispatch to
 different views for GET versus POST for the same route / context and
 view name.
 
 It makes perfect sense with view.
 
 With route, however, I think predicates make sense without
 specifying a view. And currently, predicates are silently ignored if
 you don't provide a view directly when you define a route.

Do we just need to change the path matching syntax instead to get your *.html 
case to work?  Is there another case for predicates?

- C

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev