rough edges

Andy Altepeter <[email protected]> Wed, 23 May 2012 09:29:36 -0500
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Hi Devs,

I've been mostly silent lately -- working on a number of projects 
internal to Bethel, or projects which can't be released until Silva 
Pages is done.

Kit's encouraged me to communicate more (we all need to!).  I've spent a 
lot of time developing interfaces and content types in Silva 2.3, so I'm 
going to list below some of the rough edges I've found.  A lot of this 
is around trying to develop unit tests in Silva 2.3.  As I've said 
before, on the whole Silva 2.3 has a rather good development model, but 
there are rough edges.

general silva
=======

* I've found minimal documentation on creating a silva service and 
having it be zmi addable.
To figure this out, I needed to debug in the startup process and the 
grokker for zmiobjects in order
to learn my interface for the service needs to extend 
ISilvaLocalService.  There's no mention of this in the Silva 3.0 
developer documentation for services either.

zeam
====

* zeam forms (the <form> tag) has no 'name' or 'id' attribute.  As such 
it impossible to test
zeam forms using infrae.testbrowser's "get_form" method.  I have a local 
clone and branch of zeam, and have adjusted some of the form templates 
to simply put the form prefix as the name attribute.  Not the best, but 
quick enough to enable writing of functional tests using infrae.testbrowser.

* If a zeam form fails to initialize you get a 404 Not Found, and no 
error is
recorded in the error log.  Example: a custom composed form with an __init__
that creates subforms based on criteria other than adapters, i.e. a subform
for each value of a property on the content object.  If the __init__ 
fails, a 404 is raised.

* what is a field / widget to use to manage an arbitrary set (of strings)?
I want to be able to add strings to the set and remove strings from the
set.  I thought a textarea would work, but I ended up creating a custom
DataManager to convert the text area value into a set and back into
a list.  I see that the tuple schema field has a difficult to use UI, is 
there something better?

infrae.wsgi
=======

* I would like ability to write to the error log from code sources while 
swallowing the error (if a CS has an error, the page should still display)

* I would like ability to add additional exceptions to ignore in a
persistent manner, e.g. in zope.conf or something.  The old zope error log
also recorded a full suite of data about an error; all we get is a short 
list
of state variables and a traceback. I usually find the recorded state to be
insufficient.  It would also be nice to be able to have more than 25 
errors in
the log, and an improved errorlog view (collapsible errors?) would also 
be helpful.

Basically, I miss the old zope error log :-)

Writing tests
========

Silva seems to be in between two unit test frameworks.  I say "seems" 
because I'm not sure, and I find getting the initial testing framework 
set up for a new package to be time consuming and frought with dead 
ends.  I typically spend a day getting the layer and inital test case 
setup to install the packages and products I need, install the 
extensions, and such.  It's a good thing I'm persistent or I would have 
given up writing tests long ago.

Is there any thorough documentation on setting up a complete testing 
suite for a
new silva extension?  I usually end up digging through poorly documented 
tests
for Silva trying to find what I need.  There's little documentation on 
setting
up a configure.zcml for testing and what's needed in the layer and such.

* How do I test a local service in a publication or folder (NOT the 
silva root)?
  E.g. how do I make a folder or publication a site in order to add a 
local service?
One would think there would be tests for local
services already, and that there would be a standard body of helper 
functions
to do these sorts of things.  There seems to be a transition in process for
testing suites, and it's hard to know what's where.

* The TestRequest used by Silva only partially implements a real request 
object. As such
it is impossible to write any tests to cover virtual hosting 
situations.  Is there any way around this?

Thanks all.
Peace,
Andy