Re: [Repoze-dev] Error importing repoze.who.config

2012-04-17 Thread Chris McDonough
On Tue, 2012-04-17 at 22:18 +0100, Anusha Ranganathan wrote:
 Hello, 
 I have been trying to get repoze.what / repoze.who working with a
 pylons 1.0 application.
 
 When I try to initialize my pylons application, I get the following
 error 
 
 from repoze.who.config import make_middleware_with_config as
 make_who_with_config
 ImportError: No module named config
 
 I have repoze.what/repoze.who configured and working on another
 machine but have problems getting it to work on a new installation.


I suspect you've got some repoze packages installed with pip and some
installed with easy_install.  They don't mix well.  I'd suggest maybe
starting in a new virtualenv and installing everything using
easy_install.
 
 I have tried installing just repoze.who again, but that makes no
 difference.
 
 A few links that may be of use:
 who.ini file used by repoze.who: 
 https://github.com/dataflow/RDFDatabank/blob/master/who.ini
 middleware.py which throws the exception: 
 
 https://github.com/dataflow/RDFDatabank/blob/master/rdfdatabank/config/middleware.pyMy
  database model
 Sqlalchemy model
 
 https://github.com/dataflow/RDFDatabank/tree/master/rdfdatabank/model
 
 Packages installed using easy_install (on Ubuntu Oneiric with python
 2.7)
 pylons 1.0
 repooze.what-pylons
 repoze.what-quickstart
 
 If you would like to have a look at what I am trying to achieve with
 repoze, a demo of my app currently working with repoze.what and
 sqlalchemy is available at http://databank-vm1.oerc.ox.ac.uk 
 
 Any thoughts and suggestions would be greatly appreciated as I am
 stumped.
 
 Regards,
 Anusha
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] Error importing repoze.who.config

2012-04-17 Thread Chris McDonough
On Tue, 2012-04-17 at 22:31 +0100, Anusha Ranganathan wrote:
 Hello Chris,
 Thanks for your reply.
 I haven't used pip though I did use apt-get to install some of the
 python packages like sqlalchemy.
 I'll try installing the packages again in a virtual env and install
 all of them using easy_install.


Make sure to use the --no-site-packages flag when you create the new
virtualenv.  It's the default in newer versions of virtualenv, but you
may have an older one.
 
 Let's see how that goes.
 
 Regards.
 Anusha
 
 On Tue, Apr 17, 2012 at 10:25 PM, Chris McDonough chr...@plope.com
 wrote:
 On Tue, 2012-04-17 at 22:18 +0100, Anusha Ranganathan wrote:
  Hello,
  I have been trying to get repoze.what / repoze.who working
 with a
  pylons 1.0 application.
 
  When I try to initialize my pylons application, I get the
 following
  error
 
  from repoze.who.config import
 make_middleware_with_config as
  make_who_with_config
  ImportError: No module named config
 
  I have repoze.what/repoze.who configured and working on
 another
  machine but have problems getting it to work on a new
 installation.
 
 
 
 I suspect you've got some repoze packages installed with pip
 and some
 installed with easy_install.  They don't mix well.  I'd
 suggest maybe
 starting in a new virtualenv and installing everything using
 easy_install.
 
  I have tried installing just repoze.who again, but that
 makes no
  difference.
 
  A few links that may be of use:
  who.ini file used by repoze.who:
 
 https://github.com/dataflow/RDFDatabank/blob/master/who.ini
  middleware.py which throws the exception:
 
 
 
 https://github.com/dataflow/RDFDatabank/blob/master/rdfdatabank/config/middleware.pyMy
  database model
  Sqlalchemy model
 
 
 https://github.com/dataflow/RDFDatabank/tree/master/rdfdatabank/model
 
  Packages installed using easy_install (on Ubuntu Oneiric
 with python
  2.7)
  pylons 1.0
  repooze.what-pylons
  repoze.what-quickstart
 
  If you would like to have a look at what I am trying to
 achieve with
  repoze, a demo of my app currently working with repoze.what
 and
  sqlalchemy is available at http://databank-vm1.oerc.ox.ac.uk
 
  Any thoughts and suggestions would be greatly appreciated as
 I am
  stumped.
 
  Regards,
  Anusha
 
 
  ___
  Repoze-dev mailing list
  Repoze-dev@lists.repoze.org
  http://lists.repoze.org/listinfo/repoze-dev
 
 
 


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


Re: [Repoze-dev] Jenkins instance (re?) setup

2012-03-26 Thread Chris McDonough
On Mon, 2012-03-26 at 09:46 -0400, Tres Seaver wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 I got http://jenkins.repoze.org/ populated over the weekend with all the
 projects I'm currently supporting (those on GitHub that I can do the
 maintenance on).  There are a number of repos I didn't add, because they
 are entirely maintained by others (Malthe, Gustavo).  I would be fine
 with putting them into the rotation if the maintainers will add / debug
 the  tox.ini for their repository.

You did a shitload of work here, Tres, thank you.

- C


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


Re: [Repoze-dev] locking in repoze.lru

2011-12-28 Thread Chris McDonough
On Wed, 2011-12-28 at 18:55 -0500, Jimmy Hartzell wrote:
 I'm reading the repoze.lru repository, which I checked out of
 https://github.com/repoze/repoze.lru.
 
 I have two questions about the locking:
 
 1) It uses explicit self.lock.acquire and self.lock.release's. Is there a
 reason it's not using the with statement?

It's compatible with Python 2.4, which has no with statement.

 2) But more interestingly, is there any reason why the get method (lines
 34-45 in lru's __init__.py) doesn't seem to be protected with locks?

IIRC, I analyzed it and decided that get didn't need any locking, that
the unserialized access to self.clock and self.hand that it does are
effectively harmless.  If you have info to the contrary, I'd like to
hear it.

Thanks!

- C


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


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


[Repoze-dev] [Pylons/cartouche] 8a7ad6: add pyc ignores

2011-11-07 Thread Chris McDonough
  Branch: refs/heads/master
  Home:   https://github.com/Pylons/cartouche

  Commit: 8a7ad63e0c6d8822184b255332dd60db4aed71ab
  
https://github.com/Pylons/cartouche/commit/8a7ad63e0c6d8822184b255332dd60db4aed71ab
  Author: Chris McDonough chr...@plope.com
  Date:   2011-11-07 (Mon, 07 Nov 2011)

  Changed paths:
M .gitignore

  Log Message:
  ---
  add pyc ignores


  Commit: 28477b54be974d079358345a2969d9905e8d182d
  
https://github.com/Pylons/cartouche/commit/28477b54be974d079358345a2969d9905e8d182d
  Author: Chris McDonough chr...@plope.com
  Date:   2011-11-07 (Mon, 07 Nov 2011)

  Changed paths:
M cartouche/tests/test_pyramidpolicy.py

  Log Message:
  ---
  fix zcml tests


Compare: https://github.com/Pylons/cartouche/compare/10b710b...28477b5
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue179] respoze.profile doesn't handle WSGI iterables properly.

2011-09-30 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Hi Graham,

The intent here is to only unwind generators because they may be calling 
start_response() as a side effect of the first iteration.  While other 
iterables might 
do that, I think they can lose, because this case is fairly uncommon, and the 
only 
side effect of not doing it is that profiling data is skewed.

Unwinding all iterables would mean running out of RAM when you unwound an 
app_iter that happened to serve up e.g. a big file, which I think would be 
worse 
than providing skewed profile data.

Thoughts?

--
status: unread - chatting

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue179
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue179] respoze.profile doesn't handle WSGI iterables properly.

2011-09-30 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

The case this that eagerly unwinding the app_iter is trying to defend against 
is (as 
you probably know) this one:

def someapp(environ, start_response):
 start_response('200 OK', [... headers ...])
 for item in listofbytes:
 yield item

The pattern of calling start_response during the first iteration is, IMO, 
insane and 
supporting is is only a courtesty/kindness.  Unwinding every iterator from 
every 
arbitrary downstream applications just in case someone does this, in my 
estimation at least, will cause more problems (resource exhaustion) for people 
who never do this more than not doing it will cause problems for people that 
use 
this pattern.   You're right that someone could return a generator that streams 
and 
exhaust RAM that way but if it's consistency we're after, I'll just rip it out 
instead.

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue179
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue179] respoze.profile doesn't handle WSGI iterables properly.

2011-09-30 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

That's a good idea.  I'll just take out the generator check entirely, and put 
in a knob.

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue179
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue179] respoze.profile doesn't handle WSGI iterables properly.

2011-09-30 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Grr.  Let's try that URL again.

https://github.com/repoze/repoze.profile/commit/8fa63f072de5b14a6b8e4ccf5f78e9
8a62d6cfdc

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue179
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] Chameleon unexpected error

2011-03-26 Thread Chris McDonough
Try Chameleon 1.X instead of 2.X (easy_install chameleon1.99).

Note that you need to subscribe to the list in order to post.

- C


On Sat, 2011-03-26 at 13:39 +, repoze-dev-ow...@lists.repoze.org
wrote:
 As list administrator, your authorization is requested for the
 following mailing list posting:
 
 List:Repoze-dev@lists.repoze.org
 From:demm...@gmail.com
 Subject: Chameleon unexpected error
 Reason:  Post by non-member to a members-only list
 
 At your convenience, visit:
 
 http://lists.repoze.org/admindb/repoze-dev
 
 to approve or deny the request.
 email message attachment
   Forwarded Message 
  From: Dmitry Shamov demm...@gmail.com
  To: repoze-dev@lists.repoze.org
  Subject: Chameleon unexpected error
  Date: Sat, 26 Mar 2011 16:42:15 +0300
  
  I try to use BFG. My template have this code:
  li tal:repeat=item params.menu
  !--span
  tal:content=repeat.item.number123/span --
  a tal:condition=not: item.current
  href=/${item.name}${item.title}/a
  span
  tal:condition=item.current${item.title}/span
  span tal:condition=params.edit 
  a href=/page_up?name=
  ${item.name}uarr;/a 
  a href=/page_down?name=
  ${item.name}darr;/a 
  /span
  /li
  Withh commented line all work good.
  But if i uncomment i got strange error:
  Re-GET Page
  URL: http://127.0.0.1:6543/titulnaya-stranitsa
  Module paste.evalexception.middleware:306 in respond 
app_iter = self.application(environ, detect_start_response)
  Module repoze.tm:23 in __call__ 
result = self.application(environ, save_status_and_headers)
  Module repoze.bfg.router:137 in __call__ 
response = view_callable(context, request)
  Module repoze.bfg.configuration:2396 in _rendered_view 
response = view(context, request)
  Module fortuna.views:41 in view_page 
return
  root.templates[context.templateName].render_to_response(request,page,params=params)
  Module fortuna.models:96 in render_to_response 
request=request)
  Module repoze.bfg.renderers:110 in render_to_response 
return renderer.render_to_response(value, None, request=request)
  Module repoze.bfg.renderers:290 in render_to_response 
result = self.render(value, system_values, request=request)
  Module repoze.bfg.renderers:286 in render 
result = renderer(value, system_values)
  Module repoze.bfg.chameleon_zpt:62 in __call__ 
result = self.template(**system)
  Module chameleon.template:121 in __call__ 
return self.render(**kwargs)
  Module chameleon.zpt.template:104 in render 
return super(PageTemplate, self).render(**k)
  Module chameleon.template:155 in render 
self._render(stream, econtext, rcontext)
  Module default_3616acbd2b42f34657d7d9b47361fd7e9ffa3f67:628 in
  render 
_content = convert(_content)
  TypeError: 'NoneType' object is not callable
  extra data
  
  
  Who knows what it is it?
  
  -- 
  С уважением, Дмитрий
  
 email message attachment
   Forwarded Message 
  From: repoze-dev-requ...@lists.repoze.org
  Subject: confirm f1aec2dedc0221f11dd316ea64d02f453385b496
  Date: Sat, 26 Mar 2011 13:39:33 +
  
  If you reply to this message, keeping the Subject: header intact,
  Mailman will discard the held message.  Do this if the message is
  spam.  If you reply to this message and include an Approved: header
  with the list password in it, the message will be approved for posting
  to the list.  The Approved: header can also appear in the first line
  of the body of the reply.


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


[Repoze-dev] [issue151] Deform's SequenceWidget needs fixed count support

2011-03-01 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

In Deform 0.9, this feature exists (albeit not with the patch supplied) using 
min_len 
and max_len arguments to the SequenceWidget.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue151
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue176] venusian cannot work with pymongo

2011-03-01 Thread Chris McDonough

New submission from Chris McDonough chr...@plope.com:

The issue tracker for venusian has moved to 
https://github.com/Pylons/venusian/issues .  I don't see any details on this 
report, 
please refile there if this is still an issue.

--
status: chatting - deferred

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue176
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Passing on primary WebOb maintainership to Sergey Schetinin

2011-02-17 Thread Chris McDonough
On Tue, 2011-02-15 at 20:20 +0200, Sergey Schetinin wrote:
 Thanks Ian for all the work you've put into the project. I hope I'll
 be a deserving maintainer.
 
 I don't have any immediate plans as I've already committed most of the
 improvements I thought were most important. There's a community effort
 to improve the test coverage which we'll merge into the trunk sometime
 soon. The bug fixing was quite quick recently, I think, and I intend
 to keep it that way.
 
 Python 3 port will need to happen eventually, but I don't think I'll
 be pressing to make it happen ASAP.

Hi Sergey,

We've listed attempt to port WebOb to Python 3 as one of the tasks at
the PyCon Pylons/Pyramid sprint
(http://us.pycon.org/2011/sprints/projects/).  I think basically this
task translates to give WebOb 100% test coverage as a first step (we
may not get around to actually doing the conversion, as writing the
tests will take some time).  Do you think you could merge the tests done
by the community into the trunk before we do this so we don't repeat
effort?

- C


 
 Also, as Ian mentioned, I'll be blogging about WebOb at 
 http://self.maluke.com/
 
 -Sergey
 
 On 14 February 2011 23:06, Ian Bicking i...@colorstudy.com wrote:
  Oops, I forgot to mention that Sergey started a blog in part with the
  intention of posting on WebOb and related things: http://self.maluke.com/
 
 
  On Mon, Feb 14, 2011 at 3:01 PM, Ian Bicking i...@colorstudy.com wrote:
 
  Hi all.
 
  I've decided to pass primary maintainer duties to Sergey Schetinin
  (maluke) for WebOb -- while I have attended to WebOb sporadically he has
  been far more consistent in responding to bugs and inquiries, and in many
  ways has been acting maintainer.  So I think it fitting to make that more
  formal and give Sergey that title more formally, and put project management
  in the hands of someone doing the project management.
 
  WebOb of course is used by many of libraries, and as such must remain
  stable and conservative in its forward development, but I think its scope
  makes the meaning of that fairly clear for everyone so I am not worried on
  that front.  Python 3 is the one thing that looms, and with PEP  a
  porting effort is now reasonable.  I'm not sure that it's at the top of
  Sergey's list of things to do, but I hope the community can organize itself
  in this respect -- I believe well-done port of WebOb could make the porting
  effort for other libraries much easier as it can serve as insulation for
  many of the more tweaky differences between the Python versions.
 
 
  Relatedly, I am also interested in finding maintainers for other packages,
  such as Paste*, WebTest, ScriptTest, FormEncode, WSGIProxy, and virtualenv.
  If you are interested or have any questions, please contact me (email or
  IRC, I'm easy enough to find).
 
  Cheers,
Ian
 
 
 
 
 
 
 -- 
 Best Regards,
 Sergey Schetinin
 
 http://self.maluke.com/ -- My articles and open-source stuff
 http://www.maluke.com/ -- My commercial software and custom development 
 services
 


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


[Repoze-dev] heads up about package moves...

2011-02-15 Thread Chris McDonough
Hi all,

I've moved the following packages, which were previously hosted in
Repoze.org SVN to GitHub:

colander
deform
venusian
peppercorn
translationstring

They can all be found as subrepositories of the Pylons GitHub
organization:

https://github.com/Pylons

If you want to continue to contribute to these packages, please use
GitHub's pull request mechanism after forking a package.

Thanks!

- C


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


[Repoze-dev] [issue175] repoze.sphinx.autointerface generates exception if options.members is None

2011-02-13 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks!  Fixed in SVN (still needs release though).

--
status: chatting - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue175
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] Pyramid 1.0 released..

2011-01-30 Thread Chris McDonough
Hi folks,

The web framework formerly known as repoze.bfg is named Pyramid now. The
1.0 (final) of Pyramid has been released.  See
http://groups.google.com/group/pylons-devel/browse_thread/thread/2e0c1d669924ea3f
 for more information.

Users of BFG will be particularly interested in
http://docs.pylonsproject.org/projects/pyramid/1.0/tutorials/bfg/index.html 
(Converting a BFG Application to Pyramid).

- C




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


[Repoze-dev] test123

2011-01-05 Thread Chris McDonough
testing 123, please ignore

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


[Repoze-dev] svn committers: svn.repoze.org now being served from a new box

2011-01-05 Thread Chris McDonough
Hi folks,

svn.repoze.org (both the SVN-via-ssh access and the http browser) are
now being served by a new server.  DNS changes have been made to make
this box canonical, but may not have propagated to you yet.  If you need
more immediate access, use this in your /etc/hosts file:

   76.74.238.39 svn.repoze.org

However, even when the DNS change has propagated, folks with write
privileges may have problems performing svn+ssh actions.  Here's an
example of a symptom:

  [chr...@thinko gd2]$ svn ls svn+ssh://rep...@svn.repoze.org/svn
  svn: Network connection closed unexpectedly

If you see this, try sshing in manually (e.g. ssh
rep...@svn.repoze.org).

[chr...@thinko gd2]$ ssh rep...@svn.repoze.org
@@@
@   WARNING: POSSIBLE DNS SPOOFING DETECTED!  @
@@@
The RSA host key for svn.repoze.org has changed,
and the key for the corresponding IP address 76.74.238.39
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/chrism/.ssh/known_hosts:44
@@@
@WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle
attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
32:49:f2:7e:07:60:ab:5f:a5:82:5e:e6:c0:ad:05:f7.
Please contact your system administrator.
Add correct host key in /home/chrism/.ssh/known_hosts to get rid of this
message.
Offending key in /home/chrism/.ssh/known_hosts:5
RSA host key for svn.repoze.org has changed and you have requested
strict checking.
Host key verification failed.

To fix the issue, edit your ~/.ssh/known_hosts file and remove the
offending host key line, then try using svn ls svn
+ssh://rep...@svn.repoze.org/svn again.

- C


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


Re: [Repoze-dev] venusian scanning test code

2010-12-28 Thread Chris McDonough
On Tue, 2010-12-28 at 15:36 +0100, Wichert Akkerman wrote:
 I recently refactored a package to move all test infrastructure out of 
 tests/ to testing.py. This has one unfortunate side effect: on installs 
 without test dependencies my app will now no longer start since the 
 venusian scan aborts on test imports in testing.py. Is there a way block 
 venusian from scanning testing.py?

I'm afraid not.  But I'm not sure why it worked under tests/ but not
under testing.py, as Venusian scans everything?

- C


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


Re: [Repoze-dev] venusian scanning test code

2010-12-28 Thread Chris McDonough
On Tue, 2010-12-28 at 20:35 +0100, Wichert Akkerman wrote:
  I actually argue that moving imports out of module scope in testcase
  modules is best practice:
 
 I agree, but in this case TestBrowser is not something that is tested 
 but a utility to help writing tests. It is similar to DummyRequest, 
 DummyModel, etc. That is why I moved it out to testing.py as well.

I could add features to venusian to allow it to skip certain
package/module names by regex, but this may be a case where having the
test code as a subpackage of the distributed package (a opposed to a
tests directory in the setuptools project directory, as a peer of
setup.py) is a lose. 

- C


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


Re: [Repoze-dev] Implementing multi-dropdown deform widget

2010-12-26 Thread Chris McDonough
On Mon, 2010-12-27 at 16:32 +1300, Tim Knapp wrote:
 Hi,
 
 I've been hammering away at a deform widget that consists of 2-3
 dropdown menus that are much like the 'cascading' jquery plugin, i.e.
 you choose a value in the first menu and an ajax call is made to a url
 that returns the values for the subsequent menu and the same for the 3rd
 one.
 
 So far I've got the jquery/python going independently of deform and now
 I'm trying to create a deform widget for it.
 
 Here's the deform widget code:
 http://duffyd.pastebin.com/GpxyjmCq
 
 Here's my current template code:
 http://duffyd.pastebin.com/JtYWeLRz
 
 And here's the traceback I get when clicking on submit:
 http://duffyd.pastebin.com/FQsC1W2X
 
 This is the jquery:
 http://duffyd.pastebin.com/EV26iPht
 
 Any tips on how I can get this to work in deform?

Not really.  You'll need to look at the other widgets and the docs.

- C


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


[Repoze-dev] [issue168] race condition in repoze.profile

2010-12-20 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks, this is fixed on the HEAD.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue168
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue152] Deform select widget broken in Linux version of Firefox

2010-12-20 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Sure enough.  Thanks for reporting this, it's fixed on the trunk.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue152
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [Colander/Deform] Deserialization issue (Required error)

2010-12-07 Thread Chris McDonough
On Wed, 2010-12-08 at 06:55 +0100, Andreas Jung wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Andreas Jung wrote:
 
 The issue seems to be related to the Zope 2 request - Webob request
 converter here:
 
 
   18
   19 def getDeformData(request, schema):
   20  Turn request into webob request for proper
   21 form data serialization.
   22 
   23 request.stdin.seek(0)
   24 body = request.stdin.read()
   25 req = webob.Request.blank('/', POST=body, environ=request.environ)
   26 form = deform.Form(schema,  method='POST')
   27 data = form.validate(req.POST.items())
   28 return data
 
 The Zope 2 request/form is the following
 
 (Pdb) print request.form
 {'__formid__': 'deform', 'titel': '0', 'autorengruppe': '1', 'strasse':
 '', 'bemerkung': '', 'telefon': '', 'kontakt': '', '_charset_': '',
 'id': '7483', 'vita': '', 'kundennr': '', 'email2': '', 'anrede': '1',
 'stip_konform': '', 'kontonr': '', 'eintritt': '', 'firma': '', 'mobil':
 '', 'ort2': '', '__start__': ['default:mapping', 'fibu:mapping',
 'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'vorname':
 'Andreas ', 'postfach': '', 'fax2': '', 'internet': '', 'mail': '',
 'ort': '', 'bemadresse': '', 'status': '0', 'fax': '', 'firma_funktion':
 '', 'funktion': '', 'ust': '', 'fazusatz': '', 'kreditor': '', 'plz':
 '', 'geburtstag': '', 'plzpostfach': '', 'benutzervorher': '',
 'stip_brief': '', 'bank': '', 'telefon2': '', 'land': '2', 'name':
 'Jung', 'blz': '', 'steuernr': '', 'zuverlaessigkeit': '0', 'Speichern':
 'Speichern', '__end__': ['default:mapping', 'fibu:mapping',
 'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'beruf':
 '', 'qualifikation': '0', 'benutzer': ''}
 
 and transformed through the method above into
 
 (Pdb) print form_data
 {'default': {'kontakt': False, 'titel': u'0', 'bemerkung': False,
 'telefon': False, 'id': 7483, 'vita': False, 'kundennr': False,
 'email2': False, 'anrede': u'1', 'eintritt': False, 'firma': False,
 'mobil': False, 'ort2': False, 'beruf': False, 'vorname': u'Andreas',
 'fax2': False, 'internet': False, 'mail': False, 'status': u'0', 'fax':
 False, 'firma_funktion': False, 'funktion': False, 'persoenlich': False,
 'fazusatz': False, 'geburtstag': False, 'vertraulich': False,
 'telefon2': False, 'name': u'Jung'}, 'fibu': {'kontonr': False, 'blz':
 False, 'steuerpflichtig': False, 'kreditor': 0, 'steuernr': False,
 'ust': 0, 'bank': False}, 'privatadresse': {'land': u'2', 'ort': False,
 'plz': False, 'postfach': False, 'plzpostfach': False, 'strasse':
 False}, 'interna': {'herausgeber': False, 'autorengruppe': u'1',
 'zuverlaessigkeit': u'0', 'bemadresse': False, 'anonym': False,
 'benutzervorher': False, 'redakteur': False, 'qualifikation': u'0',
 'benutzer': False}, 'stip': {'stip_konform': False, 'stip_brief': False}}
 
 So both empty string values for  'ust' and 'kreditor' field
 are turned into a numeric 0 value. Obviously a side-effect
 deserialize() seems to expect strings only (which make sense).
 
 I think my problem is that I trying a double deserialization here.
 So the code in getDeformData() seems to perform some implicit
 deserialization - correct?

I think maybe instead of trying to use WebOb to do this for you, you
might try something like:

from ZPublisher.HTTPRequest import ZopeFieldStorage
environ = request.environ
f = request.stdin
f.seek(0)
fs = ZopeFieldStorage(f, environ=environ, keep_blank_values=1)

fields = []

if fs.list:
for field in fs.list:
if field.filename:
fields.append((field.name, field))
else:
fields.append((field.name, field.value))

data = form.validate(fields)

Not tested, just reading through ZPublisher.HTTPRequest to try to puzzle
it out.

- C

 
 Andreas
 
 
 
 
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQGUBAEBAgAGBQJM/x28AAoJEADcfz7u4AZjaYALwMj1kwz9C225WfAOttAfiPyp
 tJ88a2t4YzKf4TAUcHpBPlXDwEp78feH2cfuJOlUL2oZuM/wY/Wvrx5Qv/Rw5EDN
 B7u0NMpnQW5FIYTktj+zQ7vALhO5VWovINALnVz40saaEp56Xm+kLiev1IPjwAa+
 vL1SmGjs2JIjg236D7eQ1CMMO0Gg1MYEhaRLWpKte/iKolJnpO/2nt8I2cwXje/F
 v6TDKlPxodsFy7tRDL0aLjgc525MA0u4AgiRu95sTBVwWtdGgMa22tYHveOhv8cA
 ss+rsi6qMPrUZ166KSrGCyyFueNsyEHO4ESgrLQLiAQBrbHY6KDUgEFRqsbFqVVI
 4Cwi9XcWjbBBQeGVzzZH94SUaBEszJ/dqpfaMseTToUJvW1WAE9zBYQkL13+fwCu
 jRNcS5CWt9mphB+R06Y236RrqiPizAvkqgMb+r1Ui3deymsi43c6Puxf5QTL1dbd
 TLF5UYjpeORJrx/zvX7UNSA75VO5BWE=
 =CKPM
 -END PGP SIGNATURE-


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


Re: [Repoze-dev] Some questions on Deform

2010-12-02 Thread Chris McDonough
On Thu, 2010-12-02 at 13:29 +0100, Andreas Jung wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi there,
 
 I am currently evaluating Deform + Colander for an upcoming project.
 
 Open questions:
 
 Is there some support (in the renderer) for grouping fields? E.g. we
 have a Person form with fields for business and privat address. The
 related fields should be grouped together (e.g. through a fieldset).

One possibly wrong way to do this would be to create a subschema:

class Address(colander.Schema):


class MySchema(colander.Schema)
private = Address()
public = Address()

This will render each address in its own fieldset.

Another would be a custom address widget.

Neither is entirely satisfactory in every context.  I'd like to provide
documentation that would allow Deform widgets to be used imperatively in
a template, but I don't have it.

 Does Deform provide some kind of View mode support (beside the
 rendering of the edit form itself) - similar to View/Edit mode in
 Archetypes?

There's a readonly mode for the entire form.  But there isn't a readonly
mode for individual widgets on a form yet.

 
 What is the strategy for filtered edit forms. E.g. a Manager
 should be allowed to edit all fields of a Person - a standard
 editor should be allowed to edit only a subset of the fields - all other
 fields should be either hidden or show as text (View mode).

Schema binding and the after_bind mechanism could be used to do this.
See http://docs.repoze.org/colander/binding.html#after-bind

 
 Andreas
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.11 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQGUBAEBAgAGBQJM95EyAAoJEADcfz7u4AZjc5ALv2SPU5byuFJbAPAMAk3eN9bf
 XbPcXe58qlauMeY22a5nHfiGQpdZAeW74ebAJEz2GeIk3Qd2w3Gng8aLnkd+XDK/
 9x6SRAYeBm5o97vtNrxCx8Pyu/gxIs/512cVGMru68QG+Pw03K93ZcOW7bzrwK4/
 nyPjE5nJfYm91lLqz7CEV22ww3SjA6ngNI7uAgugtKV6+V0cI8KwNivDHrR5rn4r
 mhCFoigjAe3fKq+d1Lg2BHTcoEQH7vb3gMiB0wbFD/sXl510ziyj8wmv/uqNyDKU
 Nfm5gSBG00tEs9kfjSZ4AWiXf3q0kHnORrIRo2JeQM8U5o4ELKoXjPOeA9UfA26l
 FtIESaLD0yzwj1YpjHsryliLB/nh2Ap879szVGvSAWYuNdTdIgSiO86VkFvYXrlY
 53VdGtNd9c+19YMn8Pe3BOQelbvi+xXSys3ipcNXth+x8GafTmXEhdlzdusN6rAC
 ZbFeHMLlBilE85DI5Am99iGDleFlXL0=
 =tFFC
 -END PGP SIGNATURE-
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


[Repoze-dev] questions for podcast...

2010-12-01 Thread Chris McDonough
Hi folks,

We'll be putting together a podcast tomorrow evening about Pylons (and
about Pyramid, formerly known as repoze.bfg).  If you have a few
moments, please submit a question or two to:
http://www.google.com/moderator/#15/e=3f534t=3f534.40o=10 so we have
some representation on the repoze side of things.

- C


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


Re: [Repoze-dev] Improving renderer setup for views

2010-11-16 Thread Chris McDonough
On Tue, 2010-11-16 at 12:22 +0100, Wichert Akkerman wrote:
 On 2010-11-3 15:56, Wichert Akkerman wrote:
  I spent some time today trying to figure out why my views where unable
  to find a renderer even though it was registered. It turns out that I
  was calling config.scan() before doing config.add_renderer(). The
  resulting behaviour is a bit misleading: when rendering a view
  RendererHelper.renderer() will raise a ValueError indicating that no
  renderer factory was registered, even though a queryUtility would
  happily return the right factory. I see two ways to improve this:
 
  1. update RendererHelper.__init__() to check if the result of
  queryUtility(IRendererFactory, name=renderer_type) is None, and if
  so raise an exception. Something like raise ProgrammingError(Trying
  to use a renderer %s which is not (yet) registered) would have
  helped me track this down a lot faster.
 
 FWIW: I was going to implemented this, but noticed that this was already 
 implemented in Pyramid in changeset 
 f5fa3f9e2a754ce199386e3f20735cd2dfbbc3fc.

Guess it just happened by-the-by, sorry.

- C


 
 Wichert.
 


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


Re: [Repoze-dev] DummyRequest breaks GET/POST API

2010-11-05 Thread Chris McDonough
I suppose my issue with adding getall to the thing: if getall needs to
behave like it does in a normal webob request and multiple values for
each key need to be kept around, you might as well just use a normal
one.  Or, as Fergus did, subclass.

- C

On Fri, 2010-11-05 at 22:23 +, Fergus Doyle wrote:
 I ended up subclassing DummyRequest to add the functionality where i needed 
 it (I had a number of other aspects to add to the class due to the app setup, 
 so it wasn't too painful)
 
 I suppose it can't be a bad thing to resemble webob.Request as closely as 
 possible?
 
 On 4 Nov 2010, at 12:40, Wichert Akkerman wrote:
 
  Since the issue tracker on bfg.repoze.org is still broken I'm posting 
  this here.
  
  I ran into a little problem today: I was adding some tests for a 
  function which uses request.POST.getall(), but it turns out that 
  repoze.bfg.testing.DummyRequest uses a plain dict for POST instead of a 
  WebOb multidict, so .getall() is not available.
  
  Wichert.
  ___
  Repoze-dev mailing list
  Repoze-dev@lists.repoze.org
  http://lists.repoze.org/listinfo/repoze-dev
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


Re: [Repoze-dev] Apparent rendering bug in Chameleon Genshi templates.

2010-11-05 Thread Chris McDonough
Hi Ceri,

This message was discarded (apparently because you're not a member of
the repoze-dev maillist).  I'm forwarding it on your behalf, but you'll
need to sign up at http://lists.repoze.org to reply.

- C

On Sat, 2010-11-06 at 14:10 +0900, Ceri Storey wrote:
 Hi there.
 
 
 I think there was a bug introduced between chameleon 1.2.1--1.2.2; in
 that content included from a py:def statement will be followed by a
 None. Looking into the internals (although please forgive me if this
 is unhelpful), it looks like when the py:def is translated into a
 function definition; it naturally returns None; and somehow; that's
 not being caught by the translation code. It looks like it should be;
 looking at the output from GenshiTemplate.compile() in 1.2.13; but I
 couldn't quite figure out what was going wrong. 
 
 
 Please find a test case below. I've bolded the erroneous None and
 versions for clarity.
 
 rhk:chameleon cez$ ipython
 Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) 
 Type copyright, credits or license for more information.
 
 
 IPython 0.10 -- An enhanced Interactive Python.
 ? - Introduction and overview of IPython's features.
 %quickref - Quick reference.
 help  - Python's own help system.
 object?   - Details about 'object'. ?object also works, ?? prints
 more.
 
 
 In [1]: from chameleon.genshi.template import *;
 GenshiTemplate(div xmlns=http://www.w3.org/1999/xhtml;
 xmlns:py=http://genshi.edgewall.org/;
 xmlns:xi=http://www.w3.org/2001/XInclude; py:def
 function='fish'Halibut/py:defspanThe fish of the day is
 ${fish()}. /span/div).render()
 Out[1]: u'div xmlns=http://www.w3.org/1999/xhtml; spanThe fish of
 the day is Halibut. /span/div'
 
 
 In [2]: import chameleon; chameleon.__file__
 Out[2]:
 '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Chameleon-1.2.1-py2.5.egg/chameleon/__init__.pyc'
 
 
 In [3]: 
 Do you really want to exit ([y]/n)? 
 rhk:chameleon cez$  
 
 
 And now our failing case:
 
 
 rhk:chameleon cez$ ipython
 Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) 
 Type copyright, credits or license for more information.
 
 
 IPython 0.10 -- An enhanced Interactive Python.
 ? - Introduction and overview of IPython's features.
 %quickref - Quick reference.
 help  - Python's own help system.
 object?   - Details about 'object'. ?object also works, ?? prints
 more.
 
 
 In [1]: import chameleon; chameleon.__file__
 Out[1]:
 '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Chameleon-1.2.2-py2.5.egg/chameleon/__init__.pyc'
 
 
 In [2]: from chameleon.genshi.template import *;
 GenshiTemplate(div xmlns=http://www.w3.org/1999/xhtml;
 xmlns:py=http://genshi.edgewall.org/;
 xmlns:xi=http://www.w3.org/2001/XInclude; py:def
 function='fish'Halibut/py:defspanThe fish of the day is
 ${fish()}. /span/div).render()
 Out[2]: u'div xmlns=http://www.w3.org/1999/xhtml; spanThe fish of
 the day is HalibutNone. /span/div'
 
 
 In [3]: 
 Do you really want to exit ([y]/n)? 
 rhk:chameleon cez$ 
 
 
 I can hack around this for now by providing an alternative translation
 function; a-la:
 
 
 In [4]: from chameleon.genshi.template import *;
 GenshiTemplate(div xmlns=http://www.w3.org/1999/xhtml;
 xmlns:py=http://genshi.edgewall.org/;
 xmlns:xi=http://www.w3.org/2001/XInclude; py:def
 function='fish'Halibut/py:defspanThe fish of the day is
 ${fish()}. /span/div, translate=lambda x, **kwargs: x is not
 None and x or '').render()
 Out[4]: u'div xmlns=http://www.w3.org/1999/xhtml; spanThe fish of
 the day is Halibut. /span/div'
 
 
 In [5]: import chameleon; chameleon.__file__
 Out[5]:
 '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Chameleon-1.2.2-py2.5.egg/chameleon/__init__.pyc'
 
 
 In [6]: 
 
 This also works on 1.2.13. Although; in that case; if I pass
 'translate' to a GenshiTemplateLoader; I can't see that __init__ for
 chameleon.core.loader:TemplateLoader will do anything with it. It
 doesn't appear to pass it to the loaded GenshiTemplate instances
 (read; I still get None in my output).
 
 
 Thanks in advance,
 
 
 ps. I sent this over to the month last month, but I didn't get
 nay response, nor does it show up in the list archives. Perhaps I've
 missed something.
 -- 
 Ceri Storey


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


[Repoze-dev] repoze.bfg 1.3 released

2010-11-01 Thread Chris McDonough
repoze.bfg 1.3 has been released.  This is the first major release in
the 1.3 series.  1.3 is now the current version of BFG (the previous
current release was 1.2).

It can be installed via:

  easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg

Or via PyPI.

The docs at http://docs.repoze.org/bfg/1.3 have been updated.
http://docs.repoze.org/bfg/current is now a symlink to the 1.3 docs.  

http://dist.repoze.org/bfg/current is now a symlink to
http://dist.repoze.org/bfg/1.3 .

A What's New in BFG 1.3 document is available at
http://docs.repoze.org/bfg/1.3/whatsnew-1.3.html .  It contains a
summary of new features and backwards incompatibilities.

Thanks to everyone who helped make this release possible!

The changelog follows:

1.3 (2010-11-01)


Features


- Raise more understandable error when a Jython application attempts to
  use a Chameleon template.


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


Re: [Repoze-dev] set_default_permission not working?

2010-10-26 Thread Chris McDonough

On Tue, 2010-10-26 at 10:30 +0200, Wichert Akkerman wrote:
 On 10/26/10 09:42 , Wichert Akkerman wrote:
  I tried to use config.set_default_permission with repoze.bfg 1.3b1, but
  it appears to do very little. My code looks like this:
 
  config.set_default_permission(authenticated)
  config.scan()
  config.add_route(shop+category+article+detail,
   /shop/:category/detail/:id,
   factory=factories.ArticleFactory)
  config.add_route(...)
 
  When I run the app with BFG_DEBUG_AUTHORIZATION=1 no permissions are
  hooked up to the views:
 
  2010-10-26 09:38:19,943 debug_authorization of url
  http://localhost:5000/shop/top/detail/2323 (view name u'' against
  contextArticle id=2323 modified=2010-09-13T17:05:05.844647): Allowed
  (no permission registered)

Yup, there's a problem here.  I'll fix it, thanks for reporting.

 
 I figured out why: the bfg_view decorator passes a default permission of 
 None when it calls config.add_view, but config.add_view tests for a 
 special _marker value to see if it needs to use the default permission. 
 If there a special reason add_view has to use a marker instead of None?

It's to be able to use ``None`` as a permission even when a default
permission is in effect (indicating that it's a completely anonymous
view regardless of the default permission).

- C


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


[Repoze-dev] repoze.bfg 1.3b1 released (first beta, please try)

2010-10-25 Thread Chris McDonough
The repoze.bfg web framework version 1.3b1 has been released.

It can be installed via:

   easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg

Or via PyPI.

The docs at http://docs.repoze.org/bfg/1.3 have also been updated.

This is the first beta release, and all existing BFG 1.1 and 1.2 users
are encouraged to try it out.

It's always dangerous to make predictions about the future, but I'll
make one here anyway: there won't be very many beta releases of BFG 1.3,
and it will be the 'current' release quite soon, so if you want to keep
up with the Joneses and report issues, you'll try your pre-1.3-based
app(s) with it and provide feedback here.

Existing users can see what's new in BFG 1.3 via:

http://docs.repoze.org/bfg/1.3/whatsnew-1.3.html

This document also describes known backwards incompatibilities and
behavior differences, as well as workarounds:

http://docs.repoze.org/bfg/1.3/whatsnew-1.3.html#backwards-incompatibilities

The changelog follows.

1.3b1 (2010-10-25)
==

Features


- The ``paster`` template named ``bfg_routesalchemy`` has been updated
  to use SQLAlchemy declarative syntax.  Thanks to Ergo^.

Bug Fixes
-

- When a renderer factory could not be found, a misleading error
  message was raised if the renderer name was not a string.

Documentation
-

- The bfgwiki2 (SQLAlchemy + url dispatch) tutorial has been
  updated slightly.  In particular, the source packages no longer
  attempt to use a private index, and the recommended Python version
  is now 2.6.  It was also updated to take into account the changes to
  the ``bfg_routesalchemy`` template used to set up an environment.

- The bfgwiki (ZODB + traversal) tutorial has been updated slightly.
  In particular, the source packages no longer attempt to use a
  private index, and the recommended Python version is now 2.6.


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


Re: [Repoze-dev] Using colander with real world semistructured data

2010-10-23 Thread Chris McDonough
On Sat, 2010-10-23 at 14:56 -0200, Luciano Ramalho wrote:
 I've been very intrigued by Colander, and thinking of ways I could use
 it to migrate bibliographic data from legacy ISIS databases to
 CouchDB.
 
 But here is a problem: Colander deals with missing data by generating
 nodes with a marker value, or some specified default. What we need
 when serializing bibliographic data is the option to skip the node
 altogether, and so far I have been unable to see how to specify that.
 
 For example, if an article record does not have an institutional
 author, we don't want this serialized value:
 
 {title: Onthology is overrated, 'institutional_author' = colander.null}
 
 and neither this:
 
 {title: Onthology is overrated, 'institutional_author' = ''}
 
 This is what we need:
 
 {title: Onthology is overrated}
 
 From the documentation, I haven't seen how to make colander behave as
 described. Is there a way?

The best way to do this would be to create a subclass of
colander.Mapping which:

- omits values from the appstruct created during deserialization if
  they don't exist in the input cstruct.

- omits values from the cstruct created during serialization if they
  don't exist in the input appstruct.

This is mostly a matter of subclassing colander.Mapping and overriding
its _impl method.  Let's say that subclass is called
ForgivingMapping.  Once that's done, you can do:

class ForgivingSchema(colander.Schema):
schema_type = ForgivingMapping

Then when you create schemas, you can do:

class MySchema(ForgivingSchema):
attr1 = colander.SchemaNode(...)
attr2 = colander.SchemaNode(...)

(IOW, always use ForgivingSchema to represent mappings rather than
colander.Schema).

- C


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


[Repoze-dev] [issue167] normalized sql templates for repoze.bfg + fixed db_echo bug

2010-10-13 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

This patch (delta the echo-on-by-default) has been applied to the trunk and the 
tutorial has been updated.  Thanks Ergo.

--
status: chatting - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue167
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] anyone know a good editor for BFG book?

2010-10-13 Thread Chris McDonough
Does anyone know someone with technical editing experience whom would be
willing to review and edit the BFG book (the docs in book form) for an
upcoming 1.3 release for a reasonable amount of money?

- C


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


[Repoze-dev] repoze.bfg 1.2.2 released

2010-09-21 Thread Chris McDonough
repoze.bfg 1.2.2 has been released.  This is a bugfix release.
repoze.bfg 1.2 is the stable branch of repoze.bfg.  It receives no new
features, only bugfixes.

You can install it via:

  easy_install -i http://dist.repoze.org/bfg/1.2/simple repoze.bfg

Or via PyPI.

The documentation at http://docs.repoze.org/bfg/1.2 has been updated.

This release deals with an incompatibility between WebOb version 1.0 and
BFG 1.2.  BFG 1.2 now pins its WebOb dependency to a version equal to or
better than 0.9.7, but equal to or below 0.9.9.9 to avoid this
incompatibility.

The changelog follows.

1.2.2 (2010-09-21)
==

- Fix HTML documentation rendering for Google chrome (pre tags
  surrounded by scrollbars).

- WebOb 1.0 is incompatibile with BFG version 1.2 due to its handling
  of ``default_charset``.  As a result, pin BFG 1.2's WebOb dependency
  to ``=0.9.7,=0.9.9.9``.  Note that BFG 1.3+ does not rely on
  ``default_charset`` and is compatible with WebOb 1.0+, but may break
  very old (pre 0.7.0) applications.


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


[Repoze-dev] [issue167] normalized sql templates for repoze.bfg + fixed db_echo bug

2010-09-18 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks!

I would just apply it immediately, except the bfgwiki2 tutorial (the SQLAlchemy 
tutorial) will need to be fixed to account for the changes made to the 
bfg_routesalchemy paster template (it uses the template as a bootstrap 
mechanism).

Also, is it intentional that db_echo will be True by default?

--
status: unread - chatting

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue167
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue167] normalized sql templates for repoze.bfg + fixed db_echo bug

2010-09-18 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

After taking a short stab at it, I realize why a switch to declarative in 
bfg_routesalchemy has never been done.  It's quite a bit of of work to change 
the 
tutorial, as the bfgwiki2 tutorial tries very hard to name line numbers, and 
explain 
exactly what's going on.  While I like the idea of using declarative here, I'm 
not 
going to apply this patch until I have the time to change the tutorial (and 
verify that 
it still works; no use changing it unless you validate that it works).

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue167
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] repoz.bfg 1.3a14 released

2010-09-14 Thread Chris McDonough
repoze.bfg 1.3a14 has been released.  It is a release for compatibility
with WebOb 1.0 (just released today).

It can be installed via:

   easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg

Or via PyPI.

The docs at http://docs.repoze.org/bfg/1.3 have been updated.

The changelog follows.

1.3a14 (2010-09-14)
===

Bug Fixes
-

- If an exception view was registered through the legacy
  ``set_notfound_view`` or ``set_forbidden_view`` APIs, the context
  sent to the view was incorrect (could be ``None`` inappropriately).

Features


- Compatibility with WebOb 1.0.

Requirements


- Now requires WebOb = 1.0.

Backwards Incompatibilities
---

- Due to changes introduced WebOb 1.0, the
  ``repoze.bfg.request.make_request_ascii`` event subscriber no longer
  works, so it has been removed.  This subscriber was meant to be used
  in a deployment so that code written before BFG 0.7.0 could run
  unchanged.  At this point, such code will need to be rewritten to
  expect Unicode from ``request.GET``, ``request.POST`` and
  ``request.params`` or it will need to be changed to use
  ``request.str_POST``, ``request.str_GET`` and/or
  ``request.str_params`` instead of the non-``str`` versions of same,
  as the non-``str`` versions of the same APIs always now perform
  decoding to Unicode.

Errata
--

- A prior changelog entry asserted that the ``INewResponse`` event was
  not sent to listeners if the response was not valid (if a view or
  renderer returned a response object that did not have a
  status/headers/app_iter).  This is not true in this release, nor was
  it true in 1.3a13.


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


Re: [Repoze-dev] Build failed in Hudson: chameleon #141

2010-09-09 Thread Chris McDonough
The xcover plugin we have to use to get hudson reports can't cope with
this failure (although --with-coverage handles it fine, it just spits
out a not found error alongside the file in the report).  I've disabled
coverage for chameleon now.

On Thu, 2010-09-09 at 06:11 -0400, Malthe Borch wrote:
 On 9 September 2010 06:08,  hud...@repoze.org wrote:
  coverage.misc.NoSource: No source for code: '/tmp/tmprq_hmg/tmpNuWT1u.py'
 
 But you shouldn't take offense –– it's just a temporary file!
 
 Hudson, it is you who is not unstable or better.
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] Colander i18n in deformdemo

2010-09-09 Thread Chris McDonough
On Thu, 2010-09-09 at 12:15 -0700, Douglas Cerna wrote:
 Hello everybody.
 
 I'm trying the deform demo and noticed in the Internationalization example 
 (http://deformdemo.repoze.org/i18n/) that when I set the _LOCALE_ to russian, 
 form controls and errors are in fact translated, but colander validation 
 messages are not (for example I get a is not a number).

I'll take a look at this tonight, thanks for noticing.


 
 I checked the colander egg and it has a 'ru' locale. Is there any way to make 
 colander validation errors to be translated too?

It's a bug that it isn't already translated.

 
 Also, I translated deform and colander trunk messages to Spanish. Is there a 
 chance or interest in them being included so I can send a patch?

Sure, thanks!  Can you send them as patches against the current trunks?

 
 Thanks. Douglas
 
 ... allí­ es cuando te das cuenta que las cosas malas pueden resultar 
 bastante buenas... - Lionel Messi
 
 Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
 Vea http://www.gnu.org/philosophy/no-word-attachments.es.html
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


Re: [Repoze-dev] Colander i18n in deformdemo

2010-09-09 Thread Chris McDonough
On Thu, 2010-09-09 at 15:22 -0400, Chris McDonough wrote:
 On Thu, 2010-09-09 at 12:15 -0700, Douglas Cerna wrote:
  Hello everybody.
  
  I'm trying the deform demo and noticed in the Internationalization example 
  (http://deformdemo.repoze.org/i18n/) that when I set the _LOCALE_ to 
  russian, form controls and errors are in fact translated, but colander 
  validation messages are not (for example I get a is not a number).
 
 I'll take a look at this tonight, thanks for noticing.
 
 
  
  I checked the colander egg and it has a 'ru' locale. Is there any way to 
  make colander validation errors to be translated too?
 
 It's a bug that it isn't already translated.

No, it isn't a bug.  The translation for that error message (\${val}\
is not a number) doesn't exist in the russian .po file, so it uses the
default input.  All validation messages should work fine when actually
translated.

- C


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


Re: [Repoze-dev] Deform and late binding of source values for checkbox widget and validators

2010-09-08 Thread Chris McDonough
I've been thinking about how to solve this problem, and what I've come
up with so far is this:

- Schemas may be bound to a set of values.  When a schema is bound, 
  it is cloned, and any deferred values it has will be resolved.

- A deferred value is a callable that accepts the schema node being
  bound and a set of arbitrary keyword arguments.  It should
  return a value appropriate for its usage (a widget, a missing value,
  a validator, etc).

- Deferred values are not resolved until the schema is bound.

- Schemas are bound via SomeSchema().bind(**kw).  The values in kw
  are passed to each deferred value along with the schema node being
  bound.

Here's an example:


@colander.deferred
def deferred_date_validator(node, **kw):
max_date = kw.get('max_date')
if max_date is None:
max_date = datetime.date.today()
return colander.Range(min=datetime.date.min, max=max_date)

@colander.deferred
def deferred_date_description(node, **kw):
max_date = kw.get('max_date')
if max_date is None:
max_date = datetime.date.today()
return 'Blog post date (no earlier than %s)' % max_date.ctime()

@colander.deferred
def deferred_date_missing(node, **kw):
default_date = kw.get('default_date')
if default_date is None:
default_date = datetime.date.today()
return default_date

@colander.deferred
def deferred_body_validator(node, **kw):
max_bodylen = kw.get('max_bodylen')
if max_bodylen is None:
max_bodylen = 1  18
return colander.Length(max=max_bodylen)

@colander.deferred
def deferred_body_description(node, **kw):
max_bodylen = kw.get('max_bodylen')
if max_bodylen is None:
max_bodylen = 1  18
return 'Blog post body (no longer than %s bytes)' % max_bodylen

@colander.deferred
def deferred_body_widget(node, **kw):
body_type = kw.get('body_type')
if body_type == 'richtext':
widget = deform.widget.RichTextWidget()
else:
widget = deform.widget.TextAreaWidget()
return widget

@colander.deferred
def deferred_category_validator(node, **kw):
categories = kw.get('categories', [])
return colander.OneOf([ x[0] for x in categories ])

@colander.deferred
def deferred_category_widget(node, **kw):
categories = kw.get('categories', [])
return deform.widget.RadioChoiceWidget(values=categories)

class BlogPostSchema(Schema):
title = SchemaNode(
colander.String(),
title = 'Title',
description = 'Blog post title',
validator = colander.Length(min=5, max=100),
widget = deform.widget.TextInputWidget(),
)
date = SchemaNode(
colander.Date(),
title = 'Date',
missing = deferred_date_missing,
description = deferred_date_description,
validator = deferred_date_validator,
widget = deform.widget.DateInputWidget(),
)
body = SchemaNode(
colander.String(),
title = 'Body',
description = deferred_body_description,
validator = deferred_body_validator,
widget = deferred_body_widget,
)
category = SchemaNode(
colander.String(),
title = 'Category',
description = 'Blog post category',
validator = deferred_category_validator,
widget = deferred_category_widget,
)

schema = BlogPostSchema().bind(
max_date = datetime.date.max,
max_bodylen = 5000,
body_type = 'richtext',
default_date = datetime.date.today(),
)
form = deform.Form(schema)


This proposal does not deal with conditional inclusion or exclusion of
schema nodes, only resolving deferred schema properties.

Comments are appreciated.

- C




On Tue, 2010-09-07 at 20:37 +0800, Tim Hoffman wrote:
 Bummer ;-)
 
 
 I don't think I have a developed an application in the last 10 years
 that hasn't has to do this.
 I was quite surprised when I discovered this feature was missing in
 formish, but it seems to be missing in quite a
 few other form libs like wtforms as well.
 
 I suppose at least they all have declarative method of defining the
 schema, but it does mean the actual schema definition is a bit more
 obscured.
 
 Cheers
 
 T
 
 
 
 
 On Tue, Sep 7, 2010 at 8:20 PM, Chris McDonough chr...@plope.com wrote:
  Hi Tim,
 
  Sorry, there is no built-in solution that will allow you to use
  declarative-module-scope code only.  You'll need to generate schemas and
  widgets at render time.
 
  - C
 
 
  On Tue, 2010-09-07 at 12:56 +0800, Tim Hoffman wrote:
  Hi Chris.
 
  Am just starting too look at deform in some detail and I have question.
 
  One of the things I have struggled with formish has been the fact I
  can't easily
  define a source of values for widgets like checkbox or validators such
  as OneOf to
  only be resolved late at render time. And I can't see how I would go
  about it with deform.
 
  In your example http://docs.repoze.org/deform/app.html you have
   colors = (('red', 'Red'), ('green', 'Green'), ('blue', 'Blue

Re: [Repoze-dev] Deform and late binding of source values for checkbox widget and validators

2010-09-08 Thread Chris McDonough
And, more or less, with some slight differences in spellings, and one
additional feature this is what is now in Colander 0.8:

http://docs.repoze.org/colander/binding.html

- C


On Wed, 2010-09-08 at 12:25 -0400, Chris McDonough wrote:
 I've been thinking about how to solve this problem, and what I've come
 up with so far is this:
 
 - Schemas may be bound to a set of values.  When a schema is bound, 
   it is cloned, and any deferred values it has will be resolved.
 
 - A deferred value is a callable that accepts the schema node being
   bound and a set of arbitrary keyword arguments.  It should
   return a value appropriate for its usage (a widget, a missing value,
   a validator, etc).
 
 - Deferred values are not resolved until the schema is bound.
 
 - Schemas are bound via SomeSchema().bind(**kw).  The values in kw
   are passed to each deferred value along with the schema node being
   bound.
 
 Here's an example:
 
 
 @colander.deferred
 def deferred_date_validator(node, **kw):
 max_date = kw.get('max_date')
 if max_date is None:
 max_date = datetime.date.today()
 return colander.Range(min=datetime.date.min, max=max_date)
 
 @colander.deferred
 def deferred_date_description(node, **kw):
 max_date = kw.get('max_date')
 if max_date is None:
 max_date = datetime.date.today()
 return 'Blog post date (no earlier than %s)' % max_date.ctime()
 
 @colander.deferred
 def deferred_date_missing(node, **kw):
 default_date = kw.get('default_date')
 if default_date is None:
 default_date = datetime.date.today()
 return default_date
 
 @colander.deferred
 def deferred_body_validator(node, **kw):
 max_bodylen = kw.get('max_bodylen')
 if max_bodylen is None:
 max_bodylen = 1  18
 return colander.Length(max=max_bodylen)
 
 @colander.deferred
 def deferred_body_description(node, **kw):
 max_bodylen = kw.get('max_bodylen')
 if max_bodylen is None:
 max_bodylen = 1  18
 return 'Blog post body (no longer than %s bytes)' % max_bodylen
 
 @colander.deferred
 def deferred_body_widget(node, **kw):
 body_type = kw.get('body_type')
 if body_type == 'richtext':
 widget = deform.widget.RichTextWidget()
 else:
 widget = deform.widget.TextAreaWidget()
 return widget
 
 @colander.deferred
 def deferred_category_validator(node, **kw):
 categories = kw.get('categories', [])
 return colander.OneOf([ x[0] for x in categories ])
 
 @colander.deferred
 def deferred_category_widget(node, **kw):
 categories = kw.get('categories', [])
 return deform.widget.RadioChoiceWidget(values=categories)
 
 class BlogPostSchema(Schema):
 title = SchemaNode(
 colander.String(),
 title = 'Title',
 description = 'Blog post title',
 validator = colander.Length(min=5, max=100),
 widget = deform.widget.TextInputWidget(),
 )
 date = SchemaNode(
 colander.Date(),
 title = 'Date',
 missing = deferred_date_missing,
 description = deferred_date_description,
 validator = deferred_date_validator,
 widget = deform.widget.DateInputWidget(),
 )
 body = SchemaNode(
 colander.String(),
 title = 'Body',
 description = deferred_body_description,
 validator = deferred_body_validator,
 widget = deferred_body_widget,
 )
 category = SchemaNode(
 colander.String(),
 title = 'Category',
 description = 'Blog post category',
 validator = deferred_category_validator,
 widget = deferred_category_widget,
 )
 
 schema = BlogPostSchema().bind(
 max_date = datetime.date.max,
 max_bodylen = 5000,
 body_type = 'richtext',
 default_date = datetime.date.today(),
 )
 form = deform.Form(schema)
 
 
 This proposal does not deal with conditional inclusion or exclusion of
 schema nodes, only resolving deferred schema properties.
 
 Comments are appreciated.
 
 - C
 
 
 
 
 On Tue, 2010-09-07 at 20:37 +0800, Tim Hoffman wrote:
  Bummer ;-)
  
  
  I don't think I have a developed an application in the last 10 years
  that hasn't has to do this.
  I was quite surprised when I discovered this feature was missing in
  formish, but it seems to be missing in quite a
  few other form libs like wtforms as well.
  
  I suppose at least they all have declarative method of defining the
  schema, but it does mean the actual schema definition is a bit more
  obscured.
  
  Cheers
  
  T
  
  
  
  
  On Tue, Sep 7, 2010 at 8:20 PM, Chris McDonough chr...@plope.com wrote:
   Hi Tim,
  
   Sorry, there is no built-in solution that will allow you to use
   declarative-module-scope code only.  You'll need to generate schemas and
   widgets at render time.
  
   - C
  
  
   On Tue, 2010-09-07 at 12:56 +0800, Tim Hoffman wrote:
   Hi Chris.
  
   Am just starting too look at deform in some detail and I have question

[Repoze-dev] repoze.bfg 1.3a11 released

2010-09-05 Thread Chris McDonough
1.3a10 (released just a few minutes ago) was a minor brownbag.  I have
now released 1.3a11 with the following changes:

Bug Fixes
-

- Process the response callbacks and the NewResponse event earlier, to
  enable mutations to the response to take effect.


On Sun, 2010-09-05 at 20:29 -0400, Chris McDonough wrote:
 repoze.bfg 1.3a10 has been released.  It is a minor feature release.
 
 To install:
 
easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg
 
 Or use PyPI.
 
 The documentation at http://docs.repoze.org/bfg/1.3 has been updated.
 
 The changelog follows:
 
 1.3a10 (2010-09-05)
 ===
 
 Features
 
 
 - A new ``repoze.bfg.request.Request.add_response_callback`` API has
   been added.  This method is documented in the new
   ``repoze.bfg.request`` API chapter.  It can be used to influence
   response values before a concrete response object has been created.
 
 - The ``repoze.bfg.interfaces.INewResponse`` interface now includes a
   ``request`` attribute; as a result, a handler for INewResponse now
   has access to the request which caused the response.
 
 - Each of the follow methods of the Configurator now allow the
   below-named arguments to be passed as dotted name strings
   (e.g. foo.bar.baz) rather than as actual implementation objects
   that must be imported:
 
   setup_registry
  root_factory, authentication_policy, authorization_policy,
  debug_logger, locale_negotiator, request_factory,
  renderer_globals_factory
 
   add_subscriber
  subscriber, iface
 
   derive_view
  view
 
   add_view
  view, ``for_``, context, request_type, containment
 
   add_route()
  view, view_for, factory, ``for_``, view_context
 
   scan
  package
 
   add_renderer
  factory
 
   set_forbidden_view
  view
 
   set_notfound_view
  view
 
   set_request_factory
  factory
 
   set_renderer_globals_factory()
  factory
 
   set_locale_negotiator
  negotiator
 
   testing_add_subscriber
  event_iface
 
 Bug Fixes
 -
 
 - The route pattern registered internally for a a local static view
   (either via the ``static`` ZCML directive or via the
   ``add_static_view`` method of the configurator) was incorrect.  It
   was regsistered for e.g. ``static*traverse``, while it should have
   been registered for ``static/*traverse``.  Symptom: two static views
   could not reliably be added to a system when they both shared the
   same path prefix (e.g. ``/static`` and ``/static2``).
 
 Backwards Incompatibilities
 ---
 
 - The INewResponse event is now not sent to listeners if the response
   returned by view code (or a renderer) is not a real response
   (e.g. if it does not have ``.status``, ``.headerlist`` and
   ``.app_iter`` attribtues).
 
 Documentation
 -
 
 - Add an API chapter for the ``repoze.bfg.request`` module, which
   includes documentation for the ``repoze.bfg.request.Request`` class
   (the request object).
 
 - Modify the Request and Response narrative chapter to reference the
   new ``repoze.bfg.request`` API chapter.  Some content was moved from
   this chapter into the API documentation itself.
 
 - Various changes to denote that Python dotted names are now allowed
   as input to Configurator methods.
 
 Internal
 
 
 - The (internal) feature which made it possible to attach a
   ``global_response_headers`` attribute to the request (which was
   assumed to contain a sequence of header key/value pairs which would
   later be added to the response by the router), has been removed.
   The functionality of
   ``repoze.bfg.request.Request.add_response_callback`` takes its
   place.
 
 - The ``repoze.bfg.events.NewResponse`` class's construct has changed:
   it now must be created with ``(request, response)`` rather than
   simply ``(response)``.
 
 
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


[Repoze-dev] Introductory Deform screencast

2010-09-04 Thread Chris McDonough
FYI, I just released a screencast introducing the Deform form library
(see http://docs.repoze.org/deform ).  Deform is a project I've been
working on for several months now.

http://bfg.repoze.org/videos#deformintro


We introduce the Deform form generation library by building an
application using the Pylons web framework. Deform is a
framework-independent form generation library written by the authors of
BFG (and other Repoze projects). In the screencast, we build a small
application using Deform in real time





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


Re: [Repoze-dev] What is the good practice (good pattern in repoze.bfg) to test my models (based on SQLAlchemy) in test context (use test.ini, test.db…) ?

2010-08-21 Thread Chris McDonough
Can you read
http://docs.repoze.org/bfg/1.3/tutorials/bfgwiki2/definingviews.html#adding-tests
 and see if you have further questions?

On Sat, 2010-08-21 at 14:46 +0200, KLEIN Stéphane wrote:
 Hi,
 
 I wonder what is the good practice to test my model layer based on 
 sqlalchemy in repoze.bfg framework.
 
 In Pylons project, ``development.ini`` is the configuration used in 
 development mode.
 ``test.ini`` is the configuration used in test mode (when I launch 
 ``nosetests``).
 
 So, ``development.db`` is used in dev mode and ``test.db`` is used in 
 test mode.
 
 In my ``repoze.bfg`` project, I've only ``my_project_name.ini`` config file.
 
 This is my ``models.py`` file :
 
 http://public.hg.stephane-klein.info/hgwebdir.cgi/todo_panel/file/8be7a61ba8bc/todo_panel/models.py
 
 This is the beginning of ``test_models.py`` file :
 
 http://public.hg.stephane-klein.info/hgwebdir.cgi/todo_panel/file/8be7a61ba8bc/todo_panel/test_models.py
 
 How can I get SQLAlchemy ``session`` object connected on ``test.db`` in 
 my ``test_models.py`` file ?
 
 I would like execute my test with nose (or better solution if exist).
 
 What is the good method ? The good pattern in repoze.bfg context ?
 
 Thanks for your help,
 Stephane


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


Re: [Repoze-dev] repoze.who testing on Pylons

2010-08-21 Thread Chris McDonough
Your messages are bouncing because you are not subscribed.

On Sat, 2010-08-21 at 09:41 -0700, waugust wrote:
 I could have sworn I posted a reply here...
 I'm afraid that I'm still stuck, regardless of the change.
 I'm not sure what I'm doing wrong here.  Do I have to protect the
 action or controller in order for identification to function during
 testing?
 Even though I made the changes:
 
  c.user = identity.get('user').username
 AttributeError: 'NoneType' object has no attribute 'get'
 
 On Aug 16, 3:48pm, Gustavo Narea m...@gustavonarea.net wrote:
  Hello, Wojtek.
 
  I've had a quick look at the auth_repozepylons template in Shabti and I
  think I've found the problem.
 
  The test case TestController doesn't seem to be setting 
  skip_authentication.
  Can you please modify it to make it look like this:
  
  class TestController(TestModel):
 
# Protected areas should be tested with authentication disabled:
application_under_test = 'main'
 
def __init__(self, *args, **kwargs):
  conf_dir = config['here']
  wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
   relative_to=conf_dir)
  self.app = TestApp(wsgiapp)
  url._push_object(URLGenerator(config['routes.map'], environ))
  TestCase.__init__(self, *args, **kwargs)
  
 
  Then go to tests/functional/test_auth_login.py and add the
  application_under_test attribute to TestLoginController, like this:
  
  class TestLoginController(TestController):
application_under_test = 'main_without_authn'
 
...
  
 
  Does it work now? If so, can you please report the bug 
  onhttps://bitbucket.org/gjhiggins/shabti/issues?status=new
 
  Cheers.
 
  - Gustavo.
 
  Wojtek said:
 
 
 
   Thanks for reply, Gustavo.
   I did check that, though I'm using the *shabti* templates and they are up
   to par.
   I guess my problem isn't with authentication so much as with
   identification, maybe?:
 
   In my controller I have 
   *request.environ.get('repoze.who.identity')['user']
   *and its just keeps coming up as 'None' on my tests (only)...
 
   sigh
 
   I've been at it for a couple of days now. I even went as far as doing
   another virtualenv and creating a new app and it persists.
 
   I really appreciate the help.
 
   On Sun, Aug 15, 2010 at 3:45 PM, Gustavo Narea m...@gustavonarea.net 
   wrote:
Hello,
 
Setting REMOTE_USER is the preferred method. It should make everything
work with no additional code.
 
If it doesn't work, the only reason I can think of would be that
skip_authentication is not set during the tests:
   http://code.gustavonarea.net/repoze.who-testutil/HowTo/Reconfiguring
 
HTH.
 
- Gustavo.
 
Chris said:
  Greetings,
 
  I'm using the shabti paster templates for a repoze auth'n'auth set 
  up
  on Pylons.
  The templates preconfigure the set up with repoze.who_testutil.
 
  I've been struggling trying to get these tests to run.
  The instructions for the testutil show that I just need to pass in
  the REMOTE_USER dictionary in the enviorn:
  response = self.app.get(url(controller='mycontroller',
  action='index', extra_environ={'REMOTE_USER':'tester'}))
 
  Someone else on the Pylons bored told me to just create a
  repoze.what.credentials dictionary with userid, groups, and
  premissions keys.
 
  I'm chocking here...
  On my controller I use the helper get_user to get a user instance
  which keeps showing as None in the error stack...
 
--
Gustavo Narea xri://=Gustavo.
 
| Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |
 
  --
  Gustavo Narea xri://=Gustavo.
  | Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |
  ___
  Repoze-dev mailing list
  repoze-...@lists.repoze.orghttp://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] repoze.bfg random intermittent server errors fetching static resources

2010-08-18 Thread Chris McDonough
Sorry, not here.  It works 100% of the time for us, at least in all the
apps we've deployed.

- C

On Wed, 2010-08-18 at 15:34 -0700, Iain Duncan wrote:
 Hi everyone, I have an app that I have set up to use the bfg resources
 facility for serving static files. I'm pretty sure I've done it right,
 because most of the time everything works.
 
 
 However, a lot of the time, seemingly random static request just get
 served up an internal server error 500 by bfg. I can't see why,
 sometimes I hit reload and it works. If I copy the url into another
 browser window, it *always* works. But very frequently a bunch of
 these static files get returned a 500.
 
 
 Does anyone else know what I'm on about? Does this happen to other
 people? It seems like counting on bfg to serve up static resources is
 unreliable, but I can't see where I might have done anything wrong.
 
 
 thanks
 iain
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] repoze.who testing on Pylons

2010-08-13 Thread Chris McDonough
Hi,

This message was discarded by the maillist because you're not
subscribed.  I'm just reposting it for you to the list, I'm afraid I
don't know much about repoze.who.testutil.

On Fri, 2010-08-13 at 19:30 -0700, waugust wrote:
 Greetings,
 
 I'm using the shabti paster templates for a repoze auth'n'auth set up
 on Pylons.
 The templates preconfigure the set up with repoze.who_testutil.
 
 I've been struggling trying to get these tests to run.
 The instructions for the testutil show that I just need to pass in the
 REMOTE_USER dictionary in the enviorn:
 response = self.app.get(url(controller='mycontroller', action='index',
 extra_environ={'REMOTE_USER':'tester'}))
 
 Someone else on the Pylons bored told me to just create a
 repoze.what.credentials dictionary with userid, groups, and
 premissions keys.
 
 I'm chocking here...
 On my controller I use the helper get_user to get a user instance
 which keeps showing as None in the error stack...


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


[Repoze-dev] Add your BFG sites to poweredsites.org

2010-08-12 Thread Chris McDonough
If you have a publicly accessible site that runs atop BFG, it'd be nice
to know.

The poweredsites.org site seems like a legit place to add them and
it's pretty painless.  I just did so for bfg.repoze.org itself.

http://bfg.poweredsites.org/

- C


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


[Repoze-dev] repoze.bfg 1.3a8 released

2010-08-08 Thread Chris McDonough
repoze.bfg 1.3a8 has been released.

Install it via:

   easy_install -i http://dist.repoze.org/bfg/dev/simple repoze.bfg

Or via PyPI.

This is a minor feature release.  The changelog follows.

1.3a8 (2010-08-08)
==

Features


- New public interface: ``repoze.bfg.exceptions.IExceptionResponse``.
  This interface is provided by all internal exception classes (such
  as ``repoze.bfg.exceptions.NotFound`` and
  ``repoze.bfg.exceptions.Forbidden``), instances of which are both
  exception objects and can behave as WSGI response objects.  This
  interface is made public so that exception classes which are also
  valid WSGI response factories can be configured to implement them or
  exception instances which are also or response instances can be
  configured to provide them.

- New API class: ``repoze.bfg.view.AppendSlashNotFoundViewFactory``.

  There can only be one Not Found view in any ``repoze.bfg``
  application.  Even if you use
  ``repoze.bfg.view.append_slash_notfound_view`` as the Not Found
  view, ``repoze.bfg`` still must generate a ``404 Not Found``
  response when it cannot redirect to a slash-appended URL; this not
  found response will be visible to site users.

  If you don't care what this 404 response looks like, and you only
  need redirections to slash-appended route URLs, you may use the
  ``repoze.bfg.view.append_slash_notfound_view`` object as the Not
  Found view.  However, if you wish to use a *custom* notfound view
  callable when a URL cannot be redirected to a slash-appended URL,
  you may wish to use an instance of the
  ``repoze.bfg.view.AppendSlashNotFoundViewFactory`` class as the Not
  Found view, supplying the notfound view callable as the first
  argument to its constructor.  For instance::

   from repoze.bfg.exceptions import NotFound
   from repoze.bfg.view import AppendSlashNotFoundViewFactory

   def notfound_view(context, request):
   return HTTPNotFound('It aint there, stop trying!')

   custom_append_slash =
AppendSlashNotFoundViewFactory(notfound_view)
   config.add_view(custom_append_slash, context=NotFound)

  The ``notfound_view`` supplied must adhere to the two-argument view
  callable calling convention of ``(context, request)`` (``context``
  will be the exception object).

Documentation
--

- Expanded the Cleaning Up After a Request section of the URL
  Dispatch narrative chapter.

- Expanded the Redirecting to Slash-Appended Routes section of the
  URL Dispatch narrative chapter.

Internal


- Previously, two default view functions were registered at
  Configurator setup (one for ``repoze.bfg.exceptions.NotFound`` named
  ``default_notfound_view`` and one for
  ``repoze.bfg.exceptions.Forbidden`` named
  ``default_forbidden_view``) to render internal exception responses.
  Those default view functions have been removed, replaced with a
  generic default view function which is registered at Configurator
  setup for the ``repoze.bfg.interfaces.IExceptionResponse`` interface
  that simply returns the exception instance; the ``NotFound`` and
  ``Forbidden`` classes are now still exception factories but they are
  also response factories which generate instances that implement the
  new ``repoze.bfg.interfaces.IExceptionResponse`` interface.


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


Re: [Repoze-dev] debug logger evilness?

2010-08-06 Thread Chris McDonough
Calling getLogger results in an *atexit* hook related to a handler being
registered for the current Python process.  It might also, depending on
its mood, print to stdout.  These things make it miserable to actually
unit test any application which calls getLogger.  See also
http://plope.com/Members/chrism/logging_blues 

That said, you can pass in a logger instance to the Configurator as a
debug logger (as the debug_logger parameter) if you need to replace it
to capture logging output of BFG itself during a unit test (more
likely a functional test really).

If you're currently using the debug logger for your own application, and
that's why you need to replace it within a unit test, maybe just don't
use it.  Just use getLogger and accept its evilness or construct your
own logger instance by hand.  No object within repoze.bfg.log is an API.
The debug logger is meant for internal use by BFG only.

On Fri, 2010-08-06 at 17:22 +0100, Chris Withers wrote:
 Hi All,
 
 Is there any reason why repoze.bfg.log:make_stream_logger manually 
 instantiates a logger rather than doing logging.getLogger(name)?
 
 It makes it harder than it needs to be to replace the handlers of the 
 logger for unit testing purposes :-/
 
 cheers,
 
 Chris
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


Re: [Repoze-dev] debug logger evilness?

2010-08-06 Thread Chris McDonough
On Fri, 2010-08-06 at 17:49 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  Calling getLogger results in an *atexit* hook related to a handler being
  registered for the current Python process.  It might also, depending on
  its mood, print to stdout.  These things make it miserable to actually
  unit test any application which calls getLogger.  See also
  http://plope.com/Members/chrism/logging_blues 
 
 You want LogCapture:
 http://packages.python.org/testfixtures/logging.html

That looks useful for things that do use getLogger and for people who
have problems mocking up loggers.  But FIWW, I don't really have a
problem mocking up the debug logger in the BFG unit tests and I can't
think up a case where I want to assert anything about what gets sent to
it except in its own unit tests.

 Admittedly, I hadn't noticed the atexit hook getting added, but I've 
 never been bitten by it..

I have.  It hurt bad.  See this scar above my eye on my forehead?
points...

- C

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


Re: [Repoze-dev] [Supervisor-users] What happened to the supervisord.org website?

2010-08-03 Thread Chris McDonough
On Tue, 2010-08-03 at 13:22 -0400, Arkady wrote:
 Sorry to bug you, but even the new version of the website is lacking:
 Shouldn't there be a big Download button somewhere on the front page? 

No download link is required really.  Supervisor is meant to be
installed primarily like any other Python program, via easy_install as
described in the docs.  If you're uncomfortable with that method of
installation, there are alternative installation methods described in
the docs (which, as you noted, one of which was broken, but isn't
anymore, thanks; http://supervisord.org/dist now works).

I rely on distribution packagers to perform alternative packaging for
specific platforms.  In particular, I don't want to be in the business
of providing some cross-platform tarball that tries to install itself on
arbitrary UNIX platforms.  I don't have the bandwidth to maintain such a
thing.

- C


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


Re: [Repoze-dev] [Supervisor-users] What happened to the supervisord.org website?

2010-08-03 Thread Chris McDonough
Gah.  Ignore this, sorry, I had to manually enter a CC-to-list address
(the OP sent it to me directly) and typed the wrong one (repoze-dev
rather than supervisor-users).

On Tue, 2010-08-03 at 13:55 -0400, Chris McDonough wrote:
 On Tue, 2010-08-03 at 13:22 -0400, Arkady wrote:
  Sorry to bug you, but even the new version of the website is lacking:
  Shouldn't there be a big Download button somewhere on the front page? 
 
 No download link is required really.  Supervisor is meant to be
 installed primarily like any other Python program, via easy_install as
 described in the docs.  If you're uncomfortable with that method of
 installation, there are alternative installation methods described in
 the docs (which, as you noted, one of which was broken, but isn't
 anymore, thanks; http://supervisord.org/dist now works).
 
 I rely on distribution packagers to perform alternative packaging for
 specific platforms.  In particular, I don't want to be in the business
 of providing some cross-platform tarball that tries to install itself on
 arbitrary UNIX platforms.  I don't have the bandwidth to maintain such a
 thing.
 
 - C
 
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


[Repoze-dev] repoze.bfg 1.3a7 released

2010-08-01 Thread Chris McDonough
repoze.bfg 1.3a7 has been released.  It is a minor feature release.

Install it via:

   easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg

Or via PyPI.

The changelog follows.

1.3a7 (2010-08-01)
==

Features


- The ``repoze.bfg.configuration.Configurator.add_route`` API now
  returns the route object that was added.

- A ``repoze.bfg.events.subscriber`` decorator was added.  This
  decorator decorates module-scope functions, which are then treated
  as event listeners after a scan() is performed.  See the Events
  narrative documentation chapter and the ``repoze.bfg.events`` module
  documentation for more information.

Bug Fixes
-

- When adding a view for a route which did not yet exist (did not yet
  exist meaning, temporally, a view was added with a route name for a
  route which had not yet been added via add_route), the value of the
  ``custom_predicate`` argument to ``add_view`` was lost.  Symptom:
  wrong view matches when using URL dispatch and custom view
  predicates together.

- Pattern matches for a ``:segment`` marker in a URL dispatch route
  pattern now always match at least one character.  See Backwards
  Incompatibilities below in this changelog.

Backwards Incompatibilities
---

- A bug existed in the regular expression to do URL matching.  As an
  example, the URL matching machinery would cause the pattern
  ``/{foo}`` to match the root URL ``/`` resulting in a match
  dictionary of ``{'foo':u''}`` or the pattern ``/{fud}/edit might
  match the URL ``//edit`` resulting in a match dictionary of
  ``{'fud':u''}``.  It was always the intent that ``:segment`` markers
  in the pattern would need to match *at least one* character, and
  never match the empty string.  This, however, means that in certain
  circumstances, a routing match which your application inadvertently
  depended upon may no longer happen.

Documentation
--

- Added description of the ``repoze.bfg.events.subscriber`` decorator
  to the Events narrative chapter.

- Added ``repoze.bfg.events.subscriber`` API documentation to
  ``repoze.bfg.events`` API docs.

- Added a section named Zope 3 Enforces 'TTW' Authorization Checks By
  Default; BFG Does Not to the Design Defense chapter.


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


Re: [Repoze-dev] Model-based vs. view-based security

2010-07-28 Thread Chris McDonough
On Wed, 2010-07-28 at 16:58 +0200, Free Ekanayaka wrote:
 Hi,
 
 I'm starting to explore Repoze.bfg and I find it great.

Thanks for letting us know!

 Reading the documentation I gather that the default security model is
 view-based, that means the authorization policy is basically defined
 and checked at the view level.
 
 If I understand it correctly, an __acl__ attribute on a context object
 is used to determine which permissions does a certain user or principal
 have on the object itself, and then a view for that context can define a
 permission which the user needs to have on the context object in order
 to access the view itself.
 
 I find it nice to have the authorization policy defined and checked at
 the view level. However comparing this approach with the model-based one
 of Zope 3 (that wraps context objects with a security proxy) I can see a
 few shortcomings that I'm not sure how to deal with:
 
 1) Let's say that I want to also expose my model via a REST API, and I
 want to use Twisted Web for that. Though I can probably reuse the
 __acl__ attributes on the model objects, I have to implement a new set
 of view-level authorization definitions for the API. On the other side
 using Zope3's security proxy, I would enforce my authorization policy
 both on Repoze.bfg's views and in the Twisted-based API transparently
 and in the same way.
 
 2) With the security proxy machinery I can have a view that
 conditionally displays certain HTML elements (like form fields)
 depending on the permissions that the accessing user has on the context
 object.
 
 3) Similarly to 2) I can also have a single view that processes a
 request with parameters for performing a set of modifications on certain
 context object. It might be that the accessing user doesn't have all the
 necessary permissions to perform the requested modifications, and the
 security proxy machinery would raise an Unauthorized, however if the
 accessing user is effectively requesting only modifications for which he
 has permissions, the request would succeed.
 
 Now, what would be the recommended approach to deal with such use-cases
 in Repoze.bfg?

BFG was developed by folks familiar with Zope2, which has a throwugh
the web security model which was the precursor to Zope 3's security
proxies.  At the time I started to write BFG, I had created many Zope 2
sites (along with my partners at Agendaless, and before that at Zope
Corp).  Over time, as we created these sites, we found authorization
checks during code interpretation useful in some projects.  But much of
the time, those authorization checks usually slowed down the development
velocity of projects that had no delegation requirements.  In
particular, if we weren't allowing untrusted users to write arbitrary
Python code to be executed by our application, the burden of through
the web security checks proved too costly.  I personally haven't
written an application on top of which untrusted developers are allowed
to write code in many years.

And since we tend to use the same toolkit for all web applications, it's
just never been a concern to be able to use  the same set of
restricted-execution code under two web different frameworks.

 Would it possibly make sense to implement some repoze.what plugin for
 supporting Zope 3's security proxies?

In general, given that Zope 3 security proxies are viral, it is possible
to override the BFG traverser (see
http://docs.repoze.org/bfg/1.3/narr/hooks.html#changing-the-traverser),
plugging in a different traverser which returns security-proxy-wrapped
objects.  This would have the effect of creating a more Zope3-like
environment without much effort.

repoze.what is unrelated to BFG.  See the Warning near the top of
http://docs.repoze.org/bfg/1.3/narr/security.html .

 Grok seems to have opted for a view-based security model as well, by
 default, an interesting reading that touches some of the concerns
 expressed above can be found here:
 
 http://faassen.n--tree.net/blog/view/weblog/2008/04/17/0
 
 Cheers!
 
 Free
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


Re: [Repoze-dev] Model-based vs. view-based security

2010-07-28 Thread Chris McDonough
Thanks for asking this question, by the way, I have added it (and a
variation on my answer) to the design defense documentation that is
present in BFG:

http://lists.repoze.org/pipermail/repoze-checkins/2010-July/009583.html

(The rendered version, which doesn't yet include the above addition is
available at http://docs.repoze.org/bfg/1.3/designdefense.html).

On Wed, 2010-07-28 at 12:09 -0400, Chris McDonough wrote:
 On Wed, 2010-07-28 at 16:58 +0200, Free Ekanayaka wrote:
  Hi,
  
  I'm starting to explore Repoze.bfg and I find it great.
 
 Thanks for letting us know!
 
  Reading the documentation I gather that the default security model is
  view-based, that means the authorization policy is basically defined
  and checked at the view level.
  
  If I understand it correctly, an __acl__ attribute on a context object
  is used to determine which permissions does a certain user or principal
  have on the object itself, and then a view for that context can define a
  permission which the user needs to have on the context object in order
  to access the view itself.
  
  I find it nice to have the authorization policy defined and checked at
  the view level. However comparing this approach with the model-based one
  of Zope 3 (that wraps context objects with a security proxy) I can see a
  few shortcomings that I'm not sure how to deal with:
  
  1) Let's say that I want to also expose my model via a REST API, and I
  want to use Twisted Web for that. Though I can probably reuse the
  __acl__ attributes on the model objects, I have to implement a new set
  of view-level authorization definitions for the API. On the other side
  using Zope3's security proxy, I would enforce my authorization policy
  both on Repoze.bfg's views and in the Twisted-based API transparently
  and in the same way.
  
  2) With the security proxy machinery I can have a view that
  conditionally displays certain HTML elements (like form fields)
  depending on the permissions that the accessing user has on the context
  object.
  
  3) Similarly to 2) I can also have a single view that processes a
  request with parameters for performing a set of modifications on certain
  context object. It might be that the accessing user doesn't have all the
  necessary permissions to perform the requested modifications, and the
  security proxy machinery would raise an Unauthorized, however if the
  accessing user is effectively requesting only modifications for which he
  has permissions, the request would succeed.
  
  Now, what would be the recommended approach to deal with such use-cases
  in Repoze.bfg?
 
 BFG was developed by folks familiar with Zope2, which has a throwugh
 the web security model which was the precursor to Zope 3's security
 proxies.  At the time I started to write BFG, I had created many Zope 2
 sites (along with my partners at Agendaless, and before that at Zope
 Corp).  Over time, as we created these sites, we found authorization
 checks during code interpretation useful in some projects.  But much of
 the time, those authorization checks usually slowed down the development
 velocity of projects that had no delegation requirements.  In
 particular, if we weren't allowing untrusted users to write arbitrary
 Python code to be executed by our application, the burden of through
 the web security checks proved too costly.  I personally haven't
 written an application on top of which untrusted developers are allowed
 to write code in many years.
 
 And since we tend to use the same toolkit for all web applications, it's
 just never been a concern to be able to use  the same set of
 restricted-execution code under two web different frameworks.
 
  Would it possibly make sense to implement some repoze.what plugin for
  supporting Zope 3's security proxies?
 
 In general, given that Zope 3 security proxies are viral, it is possible
 to override the BFG traverser (see
 http://docs.repoze.org/bfg/1.3/narr/hooks.html#changing-the-traverser),
 plugging in a different traverser which returns security-proxy-wrapped
 objects.  This would have the effect of creating a more Zope3-like
 environment without much effort.
 
 repoze.what is unrelated to BFG.  See the Warning near the top of
 http://docs.repoze.org/bfg/1.3/narr/security.html .
 
  Grok seems to have opted for a view-based security model as well, by
  default, an interesting reading that touches some of the concerns
  expressed above can be found here:
  
  http://faassen.n--tree.net/blog/view/weblog/2008/04/17/0
  
  Cheers!
  
  Free
  ___
  Repoze-dev mailing list
  Repoze-dev@lists.repoze.org
  http://lists.repoze.org/listinfo/repoze-dev
  
 
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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

[Repoze-dev] repoze.bfg 1.3a6 released

2010-07-25 Thread Chris McDonough
repoze.bfg 1.3a6 has been released.  This is a feature release.

Install it via:

  easy_install -i http://dist.repoze.org/bfg/1.3/simple repoze.bfg

Or via PyPI.

The documentation at http://docs.repoze.org/bfg/1.3 has been updated.

This release has a lot changes and two backwards incompatibilities.
Trivia: this release also runs exactly 1000 unit tests.

The changelog follows.

1.3a6 (2010-07-25)
==

Features


- New argument to ``repoze.bfg.configuration.Configurator.add_route``
  and the ``route`` ZCML directive: ``traverse``.  If you would like
  to cause the ``context`` to be something other than the ``root``
  object when this route matches, you can spell a traversal pattern as
  the ``traverse`` argument.  This traversal pattern will be used as
  the traversal path: traversal will begin at the root object implied
  by this route (either the global root, or the object returned by the
  ``factory`` associated with this route).

  The syntax of the ``traverse`` argument is the same as it is for
  ``path``. For example, if the ``path`` provided is
  ``articles/:article/edit``, and the ``traverse`` argument provided
  is ``/:article``, when a request comes in that causes the route to
  match in such a way that the ``article`` match value is '1' (when
  the request URI is ``/articles/1/edit``), the traversal path will be
  generated as ``/1``.  This means that the root object's
  ``__getitem__`` will be called with the name ``1`` during the
  traversal phase.  If the ``1`` object exists, it will become the
  ``context`` of the request.  The Traversal narrative has more
  information about traversal.

  If the traversal path contains segment marker names which are not
  present in the path argument, a runtime error will occur.  The
  ``traverse`` pattern should not contain segment markers that do not
  exist in the ``path``.

  A similar combining of routing and traversal is available when a
  route is matched which contains a ``*traverse`` remainder marker in
  its path.  The ``traverse`` argument allows you to associate route
  patterns with an arbitrary traversal path without using a a
  ``*traverse`` remainder marker; instead you can use other match
  information.

  Note that the ``traverse`` argument is ignored when attached to a
  route that has a ``*traverse`` remainder marker in its path.

- A new method of the ``Configurator`` exists:
  ``set_request_factory``.  If used, this method will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- The ``Configurator`` constructor takes an additional argument:
  ``request_factory``.  If used, this argument will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- The ``Configurator`` constructor takes an additional argument:
  ``request_factory`.  If used, this argument will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- A new method of the ``Configurator`` exists:
  ``set_renderer_globals_factory``.  If used, this method will set the
  factory used by the ``repoze.bfg`` router to create renderer
  globals.

- A new method of the ``Configurator`` exists: ``get_settings``.  If
  used, this method will return the current settings object (performs
  the same job as the ``repoze.bfg.settings.get_settings`` API).

- The ``Configurator`` constructor takes an additional argument:
  ``renderer_globals_factory``.  If used, this argument will set the
  factory used by the ``repoze.bfg`` router to create renderer
  globals.

- Add ``repoze.bfg.renderers.render``,
  ``repoze.bfg.renderers.render_to_response`` and
  ``repoze.bfg.renderers.get_renderer`` functions.  These are
  imperative APIs which will use the same rendering machinery used by
  view configurations with a ``renderer=`` attribute/argument to
  produce a rendering or renderer.  Because these APIs provide a
  central API for all rendering, they now form the preferred way to
  perform imperative template rendering.  Using functions named
  ``render_*` from modules such as ``repoze.bfg.chameleon_zpt`` and
  ``repoze.bfg.chameleon_text`` is now discouraged (although not
  deprecated).  The code the backing older templating-system-specific
  APIs now calls into the newer ``repoze.bfg.renderer`` code.

- The ``repoze.bfg.configuration.Configurator.testing_add_template``
  has been renamed to ``testing_add_renderer``.  A backwards
  compatibility alias is present using the old name.

Documentation
-

- The ``Hybrid`` narrative chapter now contains a description of the
  ``traverse`` route argument.

- The ``Hooks`` narrative chapter now contains sections about
  changing the request factory and adding a renderer globals factory.

- The API documentation includes a new module:
  ``repoze.bfg.renderers``.

- The ``Templates`` chapter was updated; all narrative that used
  templating-specific APIs within examples to perform rendering (such
  as the 

[Repoze-dev] [issue153] config.scan() and test dependencies

2010-07-02 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

I think having some skip parameter to scan (maybe a regex or something) is 
reasonable, but FWIW I never see this is because my package's tests typically 
don't import anything except unittest at module scope.  All the imports are 
done 
in the test methods themselves.  See 
http://palladion.com/home/tseaver/obzervationz/2008/unit_testing_notes-20080724 
for a rationale.

--
status: unread - chatting

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue153
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] BFG book available on international Amazon sites...

2010-07-01 Thread Chris McDonough
On Thu, 2010-07-01 at 06:59 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  In any case, I *think* if a person buys it from a particular localized
  Amazon site, they actually ship the local warehouse N copies of the
  book, so that the shipping times aren't quite so bad.  So buy one to
  seed the paper torrent wouldja? ;-)
 
 How about cutting a new version with all the corrections? ;-)

Possibly after 1.3 comes out.  The 1.2 version is more collectible
anyway. ;-)

- C


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


Re: [Repoze-dev] BFG book available on international Amazon sites...

2010-07-01 Thread Chris McDonough
On Thu, 2010-07-01 at 08:11 -0700, Steve Schmechel wrote:
 So what do you get with the used book, when you purchase it for more than 10 
 times the new book price?  Does it come packed in illegal drugs?
 
 How about the new book someone is selling for £1,200.18 (plus £2.75 for 
 delivery)?  And the seller has 179358 ratings 96% positive in the last 12 
 months?
 
 Either there is something really special in that deal, or I am charging much 
 to little for my services.  Maybe, I'll demand a 1000% raise tomorrow - that 
 should simply delight my employer.  :-)
 
 If that doesn't work I'll auction my copy of Chris's book on eBay starting at 
 $10,001.96 with *FREE* shipping.  That would make the Repoze book by far my 
 best investment for 2010!

I can beat that price, for the record.  /pm me ;-)

- C


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


[Repoze-dev] BFG book available on international Amazon sites...

2010-06-30 Thread Chris McDonough
Previously, the BFG book (http://bfg.repoze.org/book) was avaialble for
sale only via Amazon's US site.  It is available now on a number of
international Amazon sites, albeit not from very many of them in a
timely manner:

Amazon.de:
http://www.amazon.de/Repoze-Bfg-Web-Application-Framework/dp/0615345379/ref=sr_1_1?ie=UTF8s=books-intl-deqid=1277957024sr=8-1
(next day delivery, alright Germans!)

Amazon.fr:
http://www.amazon.de/Repoze-Bfg-Web-Application-Framework/dp/0615345379/ref=sr_1_1?ie=UTF8s=books-intl-deqid=1277957024sr=8-1
(ships in 1-2 months?  come on france!  you can do better than that!)

Amazon.co.uk:
http://www.amazon.co.uk/Repoze-Bfg-Web-Application-Framework/dp/0615345379/ref=sr_1_1?ie=UTF8s=booksqid=1277957259sr=8-1
(1-3 weeks.. you're barely better than france, england!)

Amazon.ca:
http://www.amazon.ca/Repoze-Bfg-Web-Application-Framework/dp/0615345379/ref=sr_1_1?ie=UTF8s=booksqid=1277957454sr=8-1
(10-14 days.. bah)

It's also available from a number of other places.  See
http://www.bookfinder.com/search/?isbn=0615345379title=author=lang=ensubmit=Begin+searchmode=textbookst=srac=qr

In any case, I *think* if a person buys it from a particular localized
Amazon site, they actually ship the local warehouse N copies of the
book, so that the shipping times aren't quite so bad.  So buy one to
seed the paper torrent wouldja? ;-)

- C


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


Re: [Repoze-dev] functional testing with @bfg_view

2010-06-29 Thread Chris McDonough
On Wed, 2010-06-30 at 12:02 +0700, Alex Marandon wrote:
 
 
 On 29 June 2010 04:44, Chris Withers ch...@simplistix.co.uk wrote:
 But now what's the right way to actually get the to render
 the html,
 preferably also testing the path dispatch to '/' at the same
 time?
 
 
 I'm not sure if it's the right way, but I use WebTest, a generic
 WSGI testing framework:  http://pythonpaste.org/webtest/
 
 
 The method described at
 http://docs.repoze.org/bfg/current/narr/unittesting.html#creating-integration-tests
  didn't work for me (ie: I'm still getting a dict, instead of a response 
 object). I believe it doesn't work with decorators scanning, only with what 
 is configured in the zcml file.

When you say scanning doesn't work, it's likely you're doing:

config.scan()

... in the test setup.  If so, you actually need to do:

config.scan('mypackage')

.. where mypackage is the name of the Python package holding the
application you're trying to test.

- C



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


Re: [Repoze-dev] functional testing with @bfg_view

2010-06-29 Thread Chris McDonough
On Wed, 2010-06-30 at 06:50 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  ... in the test setup.  If so, you actually need to do:
  
  config.scan('mypackage')
  
  .. where mypackage is the name of the Python package holding the
  application you're trying to test.
 
 That won't help, since the ViewIntegrationTests linked to my Alex still 
 call the view directly, which won't trigger any of the stuff that 
 venusian does, or any imperative configuration, or even anything 
 configured via zcml unless `my_view` happens to render its own template 
 inside the body of the function, which I'd guess most views avoid doing 
 as it makes them harder to unit test...

True.  I guess Alex' statement about works via ZCML only  made me
offer the above suggestion as a
hail-mary-aha-this-is-obvious-and-maybe-I-dont-need-to-think-very-hard-about-helping-here
 answer. ;-)  But alas, ZCML vs. scanning isn't the difference at all, so I'm 
not sure what worked via ZCML and what didn't work via scanning at all.

As far as integration testing of a view, you might be able to use the
render_view API if you can arrange for the context, request, and view
name to be right:
http://docs.repoze.org/bfg/1.3/api/view.html#repoze.bfg.view.render_view


- C


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


Re: [Repoze-dev] repoze.zodbconn connection handling

2010-06-25 Thread Chris McDonough
On Fri, 2010-06-25 at 12:55 -0600, Shane Hathaway wrote:
 On 06/25/2010 12:03 PM, Wichert Akkerman wrote:
  I am using repoze.zodbconn in a BFG application but I suspect it is not
  working as it should be: as soon as multiple requests come in at the
  same time I get a lot of locking errors and broken results:
 
  LockError: Couldn't lock
  '/Users/wichert/Work/code/buildout/blackbox/var/Data.fs.lock'
 
  The way I've setup repoze.zodbconn is
 
from repoze.zodbconn.finder import PersistentApplicationFinder
from myproject import appmaker
finder = PersistentApplicationFinder(settings[zodb.url], appmaker)
def get_root(request):
return finder(request.environ)
return get_root
 
 According to the docs[1], your code should look more like this:
 
from repoze.zodbconn.finder import PersistentApplicationFinder
from myproject import appmaker
finder = PersistentApplicationFinder(settings[zodb.url],
appmaker)
app = finder(request.environ)
return app
 
 OTOH, personally, I don't think this is a good pattern.  I think the 
 right idea is to open the connection in the WSGI stack [2].  That way, 
 other WSGI components can use the connection, and you can guarantee that 
 the connection gets closed.  repoze.zodbconn supports both patterns.

The problem Wiggy saw seems to have been related to a race condition,
which I've fixed in release 0.12
(http://pypi.python.org/pypi/repoze.zodbconn/0.12).

While it's probably trivial overhead, the issue with using the
connector middleware that adds a ZODB connection to the environment at
ingress is that not all requests actually need the connection.  For
example, image requests never need a ZODB connection.  In Wiggy's
application, there are a lot requests to the application which use a
relational database, but which never access ZODB.

This is a problem shared with other middleware like repoze.who, which
adds identification information to the request.  In the case of
repoze.who, it can add nontrivial processing time to inject
identification info into the environ, which can add inappropriate
performance penalty for requests for images, and other views which dont
require authentication information.

We've addressed this in repoze.who by giving r.who's middleware a mode
which injects only a factory into the environ instead of more eagerly
constructing identity information.  We can't really do that for
repoze.zodbconn#connector, or at least it doesn't make much sense to do
so, given that the entire purpose of opening it early is to be able to
close it easily.

- C


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


Re: [Repoze-dev] repoze.zodbconn connection handling

2010-06-25 Thread Chris McDonough
On Fri, 2010-06-25 at 15:58 -0400, Tres Seaver wrote:
  Then we could make PersistentApplicationFinder use 
  'repoze.zodbconn.connection_factory' from the environment.
 
 That looks lazy enough for my taste. ;)

+1

- C


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


Re: [Repoze-dev] config.scan() and test dependencies

2010-06-24 Thread Chris McDonough
On Thu, 2010-06-24 at 08:04 +0100, Chris Withers wrote:
 Hi All,
 
 How can I get config.scan() to exclude my test folders?
 My tests have package dependencies not normally needed, so the scan 
 fails with ImportErrors for those packages that are *only* test 
 dependencies...

Can't right now.

- C


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


Re: [Repoze-dev] config.scan() and test dependencies

2010-06-24 Thread Chris McDonough
On Thu, 2010-06-24 at 08:06 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  On Thu, 2010-06-24 at 08:04 +0100, Chris Withers wrote:
  Hi All,
 
  How can I get config.scan() to exclude my test folders?
  My tests have package dependencies not normally needed, so the scan 
  fails with ImportErrors for those packages that are *only* test 
  dependencies...
  
  Can't right now.
 
 Where should I put the feature request? ;-)

Bug tracker: http://bugs.repoze.org

- C


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


Re: [Repoze-dev] Adding Authorization doc patch

2010-06-23 Thread Chris McDonough
On Wed, 2010-06-23 at 20:08 +0700, Alex Marandon wrote:
 Hi,
 
 
 Here is a small patch for
 http://docs.repoze.org/bfg/current/tutorials/bfgwiki/authorization.html
 
 Changes:
 
 
  - point to the groupfinder function from the zcml file
  - use a group in example ACL , so that there is a point to the
 groupfinder function
  - user group:groupname syntax to define the group instead of
 group.groupname to be consistent with what's in the narrative doc at
 http://docs.repoze.org/bfg/current/narr/security.html

Thanks.. all these changes have been applied on the trunk and the
appropriate narrative changed.  Similar changes have been made to the
other wiki tutorial, which is based on SQLAlchemy.

- C



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


Re: [Repoze-dev] cogbin is back - please add/update keyword turbogears2 in your setup.py and upload to pypi.

2010-06-23 Thread Chris McDonough
I think this is maybe a little backwards.

Many, many repoze things will work in turbogears 2 (almost all repoze
middleware such as repoze.who and repoze.tm2  as well as libraries such
as deform, colander, venusian, etc).  But they'll also work fine in any
other WSGI framework too, so there's nothing particularly special about
them working in Turbogears 2, and adding a turbogears2 keyword might
make people think that they *don't* work in other WSGI frameworks.

Is there something else I can do?  Use some more neutral keyword?

On Wed, 2010-06-23 at 10:12 -0500, Lukasz Szybalski wrote:
 I know there are few tools from repoze that can be used in
 turbogears2. Could a person who maintains them add a keyword
 turbogears2 in the setup.py, so that next time you upload it to pypi
 it can show up our cogbin.
 
 Add this keyword to your setup.py keywords section.
 
 turbogears2
 
 Thanks,
 Lucas
 
 
 
 On Tue, Jun 22, 2010 at 1:45 PM, Lukasz Szybalski szybal...@gmail.com wrote:
  Hello,
 
  Got some new hardware and now cogbin is back. http://cogbin.lucasmanual.com/
 
 
  1. Cogbin is a tool that looks at the keywords of all packages in
  pypi, if the package contains keywords like turbogears or turbogears2
  , it will display it here: http://cogbin.lucasmanual.com/
 
  2. There are only 2 apps for tg2, please update your keywords section
  in your setup.py, and when you upload the new version, your
  application will show up in the list.
 
  Current keywords I'm looking at:
 
  python.templating.engines
  turbogears
  turbogears.application
  turbogears.command
  turbogears.extension
  turbogears.identity
  turbogears.widgets
  turbogears2
  turbogears2.application
  turbogears2.command
  turbogears2.identity
  turbogears2.widgets
 
  If there are any other I should check out please let me know.
 
  Would be nice if setup.py generated by devtools had turbogears2 in
  their keywords already added and not commented out.
 
 
  Updated Daily,
 
  Thanks,
  Lucas
 
 
 
 


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


Re: [Repoze-dev] repoze.folder API weirdness

2010-06-17 Thread Chris McDonough
On Thu, 2010-06-17 at 14:57 +0200, Wichert Akkerman wrote:
 On 6/17/10 14:53 , Chris McDonough wrote:
  On Thu, 2010-06-17 at 11:28 +0200, Wichert Akkerman wrote:
  I noticed something odd in repoze.folder: __setitem__ does not allow you
  to replace an existing item. This is a result from __setitem__ being an
  alias for add(). Is that a deliberate design decision? If not I'ld like
  to change it to allow replacing items.
 
  The folder API isn't meant to exactly mirror the dictionary API, so I
  don't consider this odd.  Most CMS-ish UI operations that call for
  adding a new item also call for aborting if an item by that name already
  exists, so we default to that behavior.
 
  But it probably doesn't matter much.  As long as the deletion sends (or
  doesn't) the proper ObjectRemoved, etc events, I'd be sort of +0 on
  being able to replace an existing item.  I think this would imply
  changing .add rather than changing __setitem__.  Please read the
  docstrings for .add and .remove before changing much; we need to retain
  the ability to add and remove an item with and without sending events.
  If we change things so doing an addition replaces, and if someone adds a
  new item that already exists, .add should call .remove with the
  send_events argument the same value as what was passed to .add.
 
 My suggestion would be to make __setitem__ always do remove and add with 
 events. If someone needs more control they can explicitly call add and 
 remove directly. Allowing add() to replace items feels counterintuitive 
 to me. To put this in code my proposal would be:
 
def __setitem__(self, key, item):
Set a child item, optionally replacing an existing item with
the same key. This will always fire object events. If you want to
block events use add() and remove() directly.

if key in self:
self.remove(key)
self.add(key, item)

Right now, the documentation says something like __setitem__ works like
add, but doesn't give you the control over sending events.  Or vice
versa.  So you can say to someone change the code so that you use add
instead of __setitem__ here with the send_events=False, and it won't
send events.  In fact, I just described it to a customer that way
yesterday.  If we change __setitem__ to do remove, but .add stays as is,
then the two operations become less isomorphic and harder to remember
and explain.

Let's just keep it simple.  The only reason .add exists is because
__setitem__ can't accept the send_events argument.  And while it may be
a poor name for something that also removes, so be it.  I'd rather that
the folder either didn't do replacement than for __setitem__ to not be
isomorphic with .add.

- C


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


Re: [Repoze-dev] repoze.org is offline??

2010-06-09 Thread Chris McDonough
It was indeed down; now it's back up.  Sorry for the downage.

- C

On Tue, 2010-06-08 at 18:40 -0500, Miuler wrote:
 hi, repoze es offline?? 
 
 
 http://downorisitjustme.com/res.php?url=repoze.org
 
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] Deform/Colander: allow empty non-String field in schema?

2010-06-09 Thread Chris McDonough
On Tue, 2010-06-08 at 00:55 -0400, Chris McDonough wrote:

 It would be useful if the folks for whom it mattered could give this new
 regime a roll before I merge it to the respective colander and deform
 trunks and make new releases of both.
 
 http://svn.repoze.org/deform/branches/default_overhaul/
 http://svn.repoze.org/colander/branches/default_overhaul/
 
 These packages must be used together; an older colander cannot be used
 with the branch deform; use setup.py develop of both using a virtualenv.
 The docs for both branches are more or less up to date and can be built
 via make clean html from within the docs directory of each.  The
 result can be viewed by opening .build/html/index.html within the docs
 directory.  The CHANGES.txt of each also has relatively useful notes
 about changes from the last set of releases.

I decided that a review process outside the normal release pattern isn't
worth it.

Therefore, I just released deform 0.3 and colander 0.7 to PyPI; these
include the work that was done in the default_overhaul branches.  The
docs at http://docs.repoze.org/colander and
http://docs.repoze.org/deform have been updated.

You'll want to pay attention to the changelogs for both packages
(rendered inside the docs) if you have issues after upgrading; there are
some backwards incompatibilities.

Feedback, as always, is appreciated.

- C


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


Re: [Repoze-dev] Deform/Colander: allow empty non-String field in schema?

2010-06-07 Thread Chris McDonough
On Fri, 2010-05-28 at 08:28 -0400, Chris McDonough wrote:
 I agree with how Tim just characterized this.  I'm still trying to
 figure out what the best way to spell it.
 
 My current idea is to:
 
 - Define a special null sentinel value.
 
 - Change the type definitions and widget definitions to do something 
   sensible when they see a null during serialization and
   deserialization. (e.g. n = SchemaNode(default=null)).
 
 - Add a required= flag to SchemaNode, e.g. field = SchenaNode(Integer(),
   required=True).
 
 - Decouple the meaning of default and required.


This isn't quite how it worked out.

Instead, the SchemaNode constructor grew a missing argument, which
represents the value to be used if a form deserialization returns a
colander.default sentinel.  If this missing argument is provided,
the node is not required.  If the missing argument is not provided, the
node is required.  The missing argument may be colander.null,
representing the null value.  For example:

import colander

class StandardFields(colander.MappingSchema):
manufacturer = SchemaNode(String(), missing='') # not required
obsolete_date = SchemaNode(Date(),missing=colander.null)
length = SchemaNode(Float(), missing=colander.null)
units_per_pack = SchemaNode(Integer(), missing=colander.null)

None of the above fields are required.  A field without a missing
value, however, is required.

Tge default argument to SchemaNode now means the initial serialization
value for values absent from the appstruct but present in the schema.

It would be useful if the folks for whom it mattered could give this new
regime a roll before I merge it to the respective colander and deform
trunks and make new releases of both.

http://svn.repoze.org/deform/branches/default_overhaul/
http://svn.repoze.org/colander/branches/default_overhaul/

These packages must be used together; an older colander cannot be used
with the branch deform; use setup.py develop of both using a virtualenv.
The docs for both branches are more or less up to date and can be built
via make clean html from within the docs directory of each.  The
result can be viewed by opening .build/html/index.html within the docs
directory.  The CHANGES.txt of each also has relatively useful notes
about changes from the last set of releases.

- C


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


Re: [Repoze-dev] problem with repoze.bfg.chameleon_genshi

2010-06-02 Thread Chris McDonough
Told to ChrisW on IRC:

mcdonc ChrisW: i think you're going to need to drop down a level on
the r.b.chameleon_genshi and replicate the problem in terms of raw
chameleon

[11:50] mcdonc i don't know whether it should be possible to have
?python blocks in there or not

[11:50] mcdonc and r.bfg.chameleon_genshi is just a tiny little
wrapper around c.genshi

[11:51] mcdonc usually if you create a patch in terms of the existing
chameleon tests, malthe is happy to take a look at it and pass judgment


On Wed, 2010-06-02 at 16:43 +0100, Chris Withers wrote:
 Hi All,
 
 I'm attempting to get the attached .genshi template working with 
 repoze.bfg.chameleon_genshi.
 
 The problem appears to be the ?python block at the top.
 
 Yes, I know, that code should be in view methods, and that's what I'll 
 do as a work around. However, should it work? Works with normal stock 
 genshi...
 
 I currently get:
 
 ExpatError: Unable to parse document; no start-tag found.: line 1, column 1
 
 cheers,
 
 Chris
 
 HTML document attachment (excel_table.genshi)
field
 numeric
 value
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] does chameleon.genshi support ?python blocks?

2010-06-02 Thread Chris McDonough
On Wed, 2010-06-02 at 17:02 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  mcdonc ChrisW: i think you're going to need to drop down a level on
  the r.b.chameleon_genshi and replicate the problem in terms of raw
  chameleon
 
 I'm actually so far from being a Genshi expert its not funny ;-)

No need to be an expert.  Read this for tips on how to use the raw
Chameleon interface to render Genshi templates:

http://repoze.org/viewcvs/chameleon/trunk/src/chameleon/genshi/template.txt?rev=8563view=markup

 
  [11:50] mcdonc i don't know whether it should be possible to have
  ?python blocks in there or not
 
 Malthe, can you comment?
 
 cheers,
 
 Chris
 


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


Re: [Repoze-dev] Deform/Colander: allow empty non-String field in schema?

2010-05-28 Thread Chris McDonough
On Fri, 2010-05-28 at 07:25 +0800, Tim Hoffman wrote:
 From the point of view of the form definition, I think you need to be
 able to define some type
 of sentinal value that indicates a field is empty, but valid if it is
 not required.
 
 I think it would be a mistake to assume that default implies either
 required or optional.
 It is quite feasible to have requirements where a default value is
 provided for a form field
 but that no value is ultimately required.  And its very common to have
 required fields
 with no obvious default value.
 
 So I would personally argue that having default value, and that a
 field is required or not be independent of each other.

I agree with how Tim just characterized this.  I'm still trying to
figure out what the best way to spell it.

My current idea is to:

- Define a special null sentinel value.

- Change the type definitions and widget definitions to do something 
  sensible when they see a null during serialization and
  deserialization. (e.g. n = SchemaNode(default=null)).

- Add a required= flag to SchemaNode, e.g. field = SchenaNode(Integer(),
  required=True).

- Decouple the meaning of default and required.

However, that leaves this corner case, which I'm having a difficult time
trying to reconcile:

  n = SchemaNode(Integer(), default=1, required=True)

I *think* this means that the first rendering of the form will display
a 1 in the field, but that an empty value will not be tolerated in any
resubmission thereafter.  However, I'm not sure if that definition
matches any sensible use of Colander outside its use as a schema system
for Deform, and it needs to, so I'm still chewing on it.

- C


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


Re: [Repoze-dev] Deform/Colander: allow empty non-String field in schema?

2010-05-27 Thread Chris McDonough
 We're doing a BFG app with a MongdoDB backend, and the Deform stuff seems
 perfect for us, really enjoying using it so far.

 But I can't figure out how to make a field in a schema optional if it's
 not a String.  (I've done this in Django model schemas where I can use the
 flag null=True and blank=True on a non-string type). My reading of the
 docs says that setting a field's

   default=...

 it makes a field non-required, and default='' is fine for String types,
 but not so helpful for Integer, Date and other nonStrings.  I've read doc
 mentioning flags:

   required=False
   allow_empty=True

 but allow_empty applies only to String and these seem to have no effect
 either.  I'm looking to do something like:

 class StandardFields(colander.MappingSchema):
 manufacturer= SchemaNode(String(), default='') # not
 required
 obsolete_date   = SchemaNode(Date(),required=False,
 allow_empty=True)
 length  = SchemaNode(Float(),   required=False,
 allow_empty=True)
 units_per_pack  = SchemaNode(Integer(), required=False,
 allow_empty=True)

 but find these don't work: my fields are required to be set.  Supplying a
 default value to indicate a non-required field, e.g.:

 units_per_pack  = SchemaNode(Integer(), default=0)

 also feels wrong, since this will set the actual value to 0 upon storage
 to the DB.

This is an area that I'm not 100% confident about yet, so I'm glad
you're stressing it a bit.

FTR, this definitely won't work:

   SchemaNode(Integer(), required=False, allow_empty=True)

Because a SchemaNode does nothing with either the ``required`` nor the
``allow_empty`` arguments.  Instead, you probably meant to be passing
these kwargs to the data type constructor (Integer()).  I just made
a change to Colander that will cause it to throw a TypeError if bogus
keyword arguments are fed to the SchemaNode constructor, hopefully
preventing future confusion about this.

That said, although the ``colander.String`` type accepts an
``allow_empty``, there isn't any data type constructor that accepts a
``required`` argument.  The ``required`` attribute of a SchemaNode is
a computed property, derived from whether or not the node was given a
default value, but types themselves aren't required or not-required,
and neither a SchemaNode nor any particular type (Integer, String,
etc) takes ``required`` as a valid kw argument.

 I am probably missing something in the docs. Perhaps I need a different
 approach for non-required fields, like making the schema a String but
 having a validator ensure they're my desired type if any value is provided
 on the form -- this seems a round-about way to do things.

I don't think you want to change the type.  I think this might be a
deficiency in Colander or Deform, but I'd like to understand a little
better before I make any particular change.  So I'll try to state the
requirements and the current state of affairs to make sure I make the
right change:

  You want to make a field in a form not-required.  This implies
  that you don't want a little red asterisk next to the field title
  when the form is rendered, and when the form is submitted, you don't
  want the form to be re-rendered with an error message if no value is
  placed into the field representing the value.  Instead, you want the
  form submission to be considered valid, and the data returned from
  the ``validate`` method of the form to contain a placeholder
  (default) value for that particular field.  The placeholder value
  returned by ``validate`` won't necessarily be the same natural type
  as the field data type.  For instance, you might want the
  placeholder value to be ``None``, while the type is an Integer.

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


[Repoze-dev] [issue147] Deform default form action . submits to parent folder

2010-05-27 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks, I've changed it to use '' rather than '.' on the trunk.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue147
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] routing exception when run as wsgi application

2010-05-27 Thread Chris McDonough
Hi,

That doesn't appear to be the full traceback.  The most important bit is
at the end.  Could we see that part?

- C


On Wed, 2010-05-26 at 10:02 +0800, Yuan HOng wrote:
 Hi,
 
 I have an application with the following routing configuration:
 
 route
 path=wishlist
 name=wishlistjson
 header=Content-Type:application/json;*
 xhr=true
 factory=.order.wishlistview.wishlist_factory
 view=.order.wishlistview.WishlistJSONView
 view_renderer=json /
 
 route
 path=wishlist
 name=wishlist
 xhr=true
 factory=.order.wishlistview.wishlist_factory
 view=.order.wishlistview.WishlistView
 view_renderer=order/wishlist.pt /
 
 The same url path is used for both JSON request and normal ajax html
 load. The configuration works fine when run with paster. However when
 run with mod_wsgi + apache2, I got the follow exception in the Apache
 error log:
 
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] mod_wsgi
 (pid=1818): Exception occurred processing WSGI script
 '/home/hong/hm.web/trunk/hm.web.wsgi'.
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] Traceback (most
 recent call last):
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/Beaker-1.5.3-py2.6.egg/beaker/middleware.py,
  lin
 e 152, in __call__
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] return
 self.wrap_app(environ, session_start_response)
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py
 , line 23, in __call__
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] result =
 self.application(environ, save_status_and_headers)
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/repoze.bfg-1.3a3-py2.6.egg/repoze/bfg/router.py,
  line 76, in __call__
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] info =
 self.routes_mapper(request)
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/repoze.bfg-1.3a3-py2.6.egg/repoze/bfg/urldispatch
 .py, line 54, in __call__
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] if preds and
 not all((p(None, request) for p in preds)):
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/repoze.bfg-1.3a3-py2.6.egg/repoze/bfg/urldispatch
 .py, line 54, in genexpr
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] if preds and
 not all((p(None, request) for p in preds)):
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1]   File
 /home/hong/hm.web/lib/python2.6/site-packages/repoze.bfg-1.3a3-py2.6.egg/repoze/bfg/configurati
 on.py, line 1680, in header_predicate
 [Wed May 26 09:12:59 2010] [error] [client 127.0.1.1] return
 header_val.match(val) is not None
 
 Since it is not possible to use pdb with mod_wsgi, I don't know how to
 further trace and fix the situation.
 
 -- 
 Hong Yuan
 
 大管家网上建材超市
 装修装潢建材一站式购物
 http://www.homemaster.cn
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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


Re: [Repoze-dev] repoze.org doesn't seem to be responding (at least from Australia)

2010-05-23 Thread Chris McDonough
The box which hosts:

http://repoze.org
http://svn.repoze.org
http://docs.repoze.org
http://bfg.repoze.org

.. is currently down hard (no ping response) and the remote reboot
system built in to it isn't working.  We've aksed the data center to
look into it.

On Sun, 2010-05-23 at 11:35 +0200, Charlie Clark wrote:
 Am 23.05.2010, 11:28 Uhr, schrieb Tim Hoffman zutes...@gmail.com:
 
  Hi
  Subject says it all.. Anyone else experience it or is it just me
 
 Invisible here as well. Maybe they've installed Plone? ;-)
 
 Charlie


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


Re: [Repoze-dev] repoze.org doesn't seem to be responding (at least from Australia)

2010-05-23 Thread Chris McDonough
On Sun, 2010-05-23 at 09:40 -0400, Chris McDonough wrote:
 The box which hosts:
 
 http://repoze.org
 http://svn.repoze.org
 http://docs.repoze.org
 http://bfg.repoze.org

... and lists.repoze.org, making this message useless. ;-)

It appears to be back up now, however.

Thanks Tres!

- C


 
 .. is currently down hard (no ping response) and the remote reboot
 system built in to it isn't working.  We've aksed the data center to
 look into it.
 
 On Sun, 2010-05-23 at 11:35 +0200, Charlie Clark wrote:
  Am 23.05.2010, 11:28 Uhr, schrieb Tim Hoffman zutes...@gmail.com:
  
   Hi
   Subject says it all.. Anyone else experience it or is it just me
  
  Invisible here as well. Maybe they've installed Plone? ;-)
  
  Charlie
 
 
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev
 


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


Re: [Repoze-dev] repoze.org doesn't seem to be responding (at least from Australia)

2010-05-23 Thread Chris McDonough
On Mon, 2010-05-24 at 00:06 +0800, Tim Hoffman wrote:
 Looks like its dead again

Different problem this time; I had to restart Apache.  No idea why.

- C


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


[Repoze-dev] what.repoze.org

2010-05-16 Thread Chris McDonough
Hi Gustavo,

Looks like http://what.repoze.org returns a 403 forbidden error?

- C


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


[Repoze-dev] [issue145] repoze.who.classifiers - too strict content-type handling

2010-05-11 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks Lorenzo!  Your patch is applied to the trunk and will be present in the 
next 
2.X release.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue145
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Deform 0.1 released

2010-05-10 Thread Chris McDonough
On Mon, 2010-05-10 at 12:55 +0200, Charlie Clark wrote:
 Am 09.05.2010, 21:23 Uhr, schrieb Chris McDonough chr...@plope.com:
 
  Yes.  I should just remove the definitions in the glossary because they
  are actually defined better in the chapter I linked to.
 
 Looking much better now. In the Say What? section would it be sensible to  
 trumpet the idea of interfaces/specification which allows Colander and  
 Peppercorn to work together and presumably allows either of them to be  
 replaced if required? Just to say they are unrelated is incorrect as they  
 are related by domain but not interdependent.

That's a good idea.  But I'm going to categorize swappability as not
worth it right now, as then the meta-features might start to overshadow
the non-meta features, as is the case in a lot of Zope software.  It's
also a lot of work to make it actually pluggable, but not so much work
to make the interactions small so that people can fork it as necessary
if they don't like one of the components.

  Looking at the data trip I am vaguely reminded of mathematical
  transformations and wonder if that metaphor might not be useful in this
  context - putting the various representations/structures in the CAST
  quadrants. OTOH I never really understood it back then!
 
  Would we have 4 quadrants? Storage, Application, Network and Browser?
  No idea, I about flunked math.
 
 I think I should have done as well but we spent more than half of our time  
 doing past papers so even the monkeys in my class had a fair chance of  
 passing! The improved definitions make this less relevant but essentially  
 we have transitions or changes of state where the fields themselves are  
 transformed/adapted as required. This makes Colander and Peppercorn state  
 managers.
 
 FWIW from memory CAST related to signedness in trig functions:
 
 C | A
 -
 S | T
 
 Anything similar would lend itself to a graphical reminder of the relevant  
 state.


  And finally form controls refers to A sequence of form fields. I  
  find
  this definition misleading but possibly only because it is too brief. I
  think form controls were the representation of the fields by the  
  browser,
  but that this definition comes from GUI-programming as isn't directly
  relevant here.
 
  The distinction I'm trying to make is the raw data given to us as the
  result of a form submission (currently controls vs. the data that
  peppercorn returns (pstruct)).
 
 See above - the fields change state but stay fields. This is a very fiddly  
 area and something I'm still not 100% on despite Philip von W's extensive  
 coverage of zope.formlib in his excellent book.

I'm going to leave it as-is for now but if you feel like making direct
changes to the docs along these lines, I wouldn't complain much.

   But that wouldn't fit in the sentence Deform passes a set
  of form controls to the parse method. Why doesn't it just pass the set  
  of
  form fields?
  Because we use the word field elsewhere.  I was trying to not overlap
  the vocabulary.  I probably failed in places.
 
  Sorry, if this is all to picky at the level of the language. I'll try  
  and
  provide some more useful feedback with a test application this week as
  this suits my needs for my planned port of begeistert.org to BFG.
 
  Cool.
 
 Well, hardly a headline website but one that I've not yet found a really  
 adequate blueprint for.
 
 Regarding the demos:
 
 http://deformdemo.repoze.org/
 
 It might be an idea to extend them for more adventurous use cases as in  
 z3c.form which has an address book and even a spreadsheet. I'd personally  
 also like to see how images would be handled with previews in edit forms  
 and not having them wiped if nothing new is uploaded. From the doc it  
 looks like the support for this reasonably common use case (and something  
 that requires hacking in zope.formlib) is in deform. This is something I'd  
 like to work on in any sprint.
 
 I'd prefer dates not to be in parts as input type=date is in HTML and  
 already nicely supported by Opera. More importantly a single text field is  
 also used by the various JS equivalents. Not sure, however, if there is an  
 easy way to detect this but the parts solution could be offered as an  
 alternative widget (using select for day and month and datalist for the  
 year).

Yes, obviously more and more complex widgets are necessary.  The
TODO.txt in the package outlines some of the more desirable ones.

- C


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


Re: [Repoze-dev] does BFG have some cache mechanism or cache middleware?

2010-05-10 Thread Chris McDonough
On Mon, 2010-05-10 at 21:46 +0100, Chris Withers wrote:
 Chris McDonough wrote:
  Please keep correspondence on the list.
  
  On Sun, 2010-05-09 at 22:59 +0800, Litao Wei wrote:
  Does BFG have other cache solution except Beaker?
  
  Sorry, the question doesn't make much sense if asked literally.
  Caching isn't a problem that only BFG has, and BFG doesn't try to solve
  it.
 
 Chris,
 
 What do you use when you need caching when developing a BFG app?

Frankly our current BFG-using customers are coming from Plone and moving
from Plone has given them so much headroom that we haven't needed to do
much caching (the performance bar was pretty low).

But on those projects, when I do need caching, I'll put stuff in RAM.
For this, I will use repoze.lru, as it expires things during normal
usage: http://pypi.python.org/pypi/repoze.lru

 How about browser sessions?

repoze.session or Beaker

- C


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


Re: [Repoze-dev] Deform 0.1 released

2010-05-09 Thread Chris McDonough
Hi Charlie,

Thanks for checking it out...

On Sun, 2010-05-09 at 15:00 +0200, Charlie Clark wrote:
 Am 09.05.2010, 07:50 Uhr, schrieb Chris McDonough chr...@plope.com:
 
  This piece of software will be an important piece of any new CMS-ish
  systems I develop going forward, so it's important to me that I get it
  right.  Therefore, as always, and even more so, feedback on the
  documentation and demo software is appreciated.  Tryouts are even more
  appreciated.
 
 Hi Chris,
 
 just flipping through the documentation and things are looking good. I  
 like the fact that schemas avoid the confusion that Zope interfaces as  
 schemas can cause. Nevertheless, it can be convenient to be able to tie  
 them together.

I'll definitely be working on a system at some point that generates
forms from the definition of a content type.  I don't know if those
definitions will be done in terms of a Zope interface or not yet.  So at
this point my attitude is it can be convenient to generate forms from
content, which may or may not turn out to be the same thing as it can
be convenient to generate forms from Zope interfaces.

 As with all libraries of this kind the necessary abstraction requires some  
 new concepts or terminologies. I think I understand and like the  
 appstruct, cstruct and pstruct things (if not the names) but only working  
 with them will let me know. However, the definition of pstruct is either  
 incorrect or misleading:
 
 pstruct
 Data deserialized by Peppercorn to a representation suitable for  
 consumption by a deform deserializer. Usually, when used in deform, a  
 cstruct is composed entirely of lists, dictionaries, strings, and file  
 objects.
 
 I guess it should be pstruct in the second sentence.

Yes.  Fixed, thanks.

  What happens to  
 data going through a form and back is key to understanding what any form  
 library has to do.

There's a chapter about that:
http://docs.repoze.org/deform/serialization.html

Further critical eye on documentation appreciated.

Thanks!

- C


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


Re: [Repoze-dev] does BFG have some cache mechanism or cache middleware?

2010-05-09 Thread Chris McDonough
Please keep correspondence on the list.

On Sun, 2010-05-09 at 22:59 +0800, Litao Wei wrote:
 Does BFG have other cache solution except Beaker?

Sorry, the question doesn't make much sense if asked literally.
Caching isn't a problem that only BFG has, and BFG doesn't try to solve
it.

If you're asking does the Python web community have any cache solution
except Beaker, then the answer is I'm not sure; there doesn't seem to
be much competition:
http://stackoverflow.com/questions/1427255/is-there-a-python-caching-library

- C


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


Re: [Repoze-dev] Deform 0.1 released

2010-05-09 Thread Chris McDonough
On Sun, 2010-05-09 at 17:10 +0200, Charlie Clark wrote:
  I guess it should be pstruct in the second sentence.
  Yes.  Fixed, thanks.
 
 This leads to the following definitions:
 
 Usually, when used in deform, a pstruct is composed entirely of lists,  
 dictionaries, strings, and file objects.
 Usually, when used in deform, a cstruct is composed entirely of lists,  
 dictionaries, strings, and file objects.
 
 Clearly additional explanation is required otherwise pstruct and cstruct  
 seem equivalent where they may only be analogous.

Yes.  I should just remove the definitions in the glossary because they
are actually defined better in the chapter I linked to.

 Looking at the data trip I am vaguely reminded of mathematical  
 transformations and wonder if that metaphor might not be useful in this  
 context - putting the various representations/structures in the CAST  
 quadrants. OTOH I never really understood it back then! ;-)
 
 Would we have 4 quadrants? Storage, Application, Network and Browser?

No idea, I about flunked math.

 Another area where I find the semantics getting in the way:
 
 For each schema node in the schema provided by the application developer,  
 Deform creates a field. This happens recursively for each element in the  
 schema. As a result, a tree of fields is created, mirroring the nodes in  
 the schema.
 
 Elements and nodes are interchangeable? If so I would suggest sticking  
 with one term in general and using metaphors consistently: graphs have  
 nodes, trees have leaves and compounds are made up of elements. So that a  
 tree of fields is created which mirrors the tree of elements in the  
 schema or some such as I'm not too happy with that either. I think the  
 important thing is the ability to nest elements of the schema.

I've replaced all uses of element with node.

 
 And finally form controls refers to A sequence of form fields. I find  
 this definition misleading but possibly only because it is too brief. I  
 think form controls were the representation of the fields by the browser,  
 but that this definition comes from GUI-programming as isn't directly  
 relevant here.

The distinction I'm trying to make is the raw data given to us as the
result of a form submission (currently controls vs. the data that
peppercorn returns (pstruct)).

  But that wouldn't fit in the sentence Deform passes a set  
 of form controls to the parse method. Why doesn't it just pass the set of  
 form fields?

Because we use the word field elsewhere.  I was trying to not overlap
the vocabulary.  I probably failed in places.

 Sorry, if this is all to picky at the level of the language. I'll try and  
 provide some more useful feedback with a test application this week as  
 this suits my needs for my planned port of begeistert.org to BFG.

Cool.

- C


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


[Repoze-dev] Deform 0.1 released

2010-05-08 Thread Chris McDonough
Deform is a new Python form generation package.  Its first release, 0.1,
is now on PyPI:

   http://pypi.python.org/pypi/deform/0.1

It can be installed via:

   easy_install deform

See the docs:

   http://docs.repoze.org/deform

And the demo:

   http://deformdemo.repoze.org

This piece of software will be an important piece of any new CMS-ish
systems I develop going forward, so it's important to me that I get it
right.  Therefore, as always, and even more so, feedback on the
documentation and demo software is appreciated.  Tryouts are even more
appreciated.

- C


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


Re: [Repoze-dev] Bug(s) when not using paste?

2010-05-06 Thread Chris McDonough
  Sure.  If you provide a reproducible test case, I can try to look at it.
 
 Where can I find tests in the same area already?
 (ie: what file(s) would you like me to provide a patch against)

Just create a tarball of an app that fails and attach it to a bug at
http://bugs.repoze.org

- C


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


Re: [Repoze-dev] BFG and GAE

2010-05-06 Thread Chris McDonough
On Thu, 2010-05-06 at 11:08 -0300, Fernando Correa Neto wrote:

 It may work 100% correct on the first time only though.
 While playing with it, I tried to create another bfg on gae project
 and for my surprise it didn't work because appengine-monkey patched my
 system's python distutils putting a hardcoded value for [install] in
 my distutils.cfg (which happens to be installed in my $HOME/bin).
 
 
 With that said, I believe appengine-monkey is not the best way to get
 BFG on GAE and it would be better if people that have a sane process
 of achieving this tried to document and hopefully advertise that
 approach.

No disagreement here.  When I say it's the best way, I mean it's a way
that is documented and that is known to work.  If there's another better
way that is also documented and works, we should use that.  Would you be
willing to take on the task of figuring out what that is and documenting
it ala the existing tutorial.

- C




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


Re: [Repoze-dev] imperative configuration prevents application extension?

2010-05-06 Thread Chris McDonough
On Thu, 2010-05-06 at 10:36 -0400, Chris Rossi wrote:
 On Thu, May 6, 2010 at 4:14 AM, Charlie Clark
 charlie.cl...@clark-consulting.eu wrote:
  Am 06.05.2010, 10:10 Uhr, schrieb Chris Withers ch...@simplistix.co.uk:
 
  This is spot on, and would, in theory, allow an app to override a
  library that overrides a framework.
 
  Cue lots of Jim like wooah! comments and it's all Chris' fault in the
  code! ;-)
 
 I hate to just make more work for Chris M.  I'm happy to add this to
 my todo list.  I have a lot on my plate right now, so don't expect a
 timely implementation, but I'll try to get to it . . . . sometime.

I'm actually not 100% confident that I understand the syntax, so I don't
think I could implement it yet anyway.

With ovverides='some.funcion.or.method', is the function or method
being overridden assumed to have a view configuration attached to it
that matches the overriding view configuration?  If so, that's a little
weird.  What if it has different view configuration arguments or or no
view configuration arguments at all?

A good number of view configuration overrides as performed via ZCML
don't require creatign separate view callable (like changing the
rendererer), so constructing one just to be able to decorate it, then
delegating to the original, seems a little suspect.

I'm also not sure that this can be advertised as an overrides strategy
100% comparable to ZCML unless all the various ZCML directives get
Python declarative equivalents.

So.. yeah, I think there's a cool idea lurking in here, but I'm not sure
we found it yet.


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


Re: [Repoze-dev] Folder event subscriber not called

2010-05-05 Thread Chris McDonough
On Wed, 2010-05-05 at 07:30 -0700, Sam Brauer wrote:
  From: Chris McDonough chr...@plope.com
  To: Sam Brauer sampbra...@yahoo.com
  Cc: repoze-dev@lists.repoze.org
  Sent: Tue, May 4, 2010 9:02:35 PM
  Subject: Re: [Repoze-dev] Folder event subscriber not called
 
  Hi Sam,
 
  Modify your run.py so that its app function calls hook_zca ala:
 
  def app(global_config, **settings):
   This function returns a WSGI application.
  
  It is usually called by the PasteDeploy framework during 
  ``paster serve``.
  
  zodb_uri = settings.get('zodb_uri')
  zcml_file = settings.get('configure_zcml', 'configure.zcml')
  if zodb_uri is None:
  raise ValueError(No 'zodb_uri' in application configuration.)
 
  finder = PersistentApplicationFinder(zodb_uri, appmaker)
  def get_root(request):
  return finder(request.environ)
  config = Configurator(root_factory=get_root, settings=settings)
  config.begin()
  config.hook_zca()
  config.load_zcml(zcml_file)
  config.end()
  return config.make_wsgi_app()
  
  The repoze.folder code isn't dependent on BFG; it's actually general
  enough to be used in any ZODB application.  Therefore it uses the
  global ZCA API to send events.  When you call config.hook_zca(), this
  tells BFG to replace the normal lookup for a Zope global registry with
  a lookup which returns the ZCA registry that BFG uses.
  
  After I added this call, I tested your code, and saw your event sent to
  my console.
  
  See http://docs.repoze.org/bfg/1.2/narr/zca.html for more info.
 
 Chris,
 That call to hook_zca() was indeed the missing piece.  Thank you!
 I think it would have taken me a very long time to have figured that out on 
 my own, and I can imagine that this might stump other new users as well.

Yes.

 
 May I suggest a couple of places in the documentation (which is 
 extraordinary, btw) where this might be mentioned?
 It could be noted in the Using Events chapter of the docs 
 (http://docs.repoze.org/bfg/1.2/narr/events.html).
 Also if you were to expand the example in the tutorial on using 
 repoze.catalog (http://docs.repoze.org/bfg/1.2/tutorials/catalog/index.html) 
 such that it included hooking up subscribers to index/unindex in response to 
 folder add/remove events, that would be another good place to mention it.

I'd rather make a r.b.folder implementation that used the BFG API when
sending events and demonstrate using that in a tutorial.  Explaining
what hook_zca does in general is hard; in context it's mostly
impossible.

- C


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


Re: [Repoze-dev] BFG and GAE

2010-05-05 Thread Chris McDonough
On Wed, 2010-05-05 at 15:10 +, Alex Clark wrote:
 Hi all,
 
 I am just going to blurt this out because I am thinking about it. At last 
 night's
 Python Meetup Tres mentioned something about their being various ways to use
 BFG on GAE… which makes me wonder: what would it take to get GAE support
 from the top down?

I assume by top down, you mean the principals of BFG consider it a
preferred deployment platform.

 I'm sure I already know the answer (well, I'll guess anyway): there is
 no immediate Agendaless (or any other big BFG shop) customer need for it,
 so it's not going to happen until there is.
 
 Fair enough (we all know/understand how that works).
 
 Which brings me to an actual question: is marketing BFG on GAE even
 desirable by the community? In other words, is making it work on 
 a platform that has wide-spread adoption like GAE (I assume it has
 widespread adoption) something folks are interested in as a way to 
 spread the word and inject new developers/users into the project?
 
 Or am I just blinded by shiny toys too much.
 
 I suspect the latter ;-)
 
 However I'll mention I see guys like philikon (http://i-luuv.appspot.com)
 and davisagli (http://buildthreat.appspot.com/) building cool apps on GAE 
 and I can't help but wonder what it would be like if the BFG/GAE story was 
 complete and in place.

I consider it useful for BFG to run on the widest variety of platforms
possible.  It should run within reason on an arbitrary system
independent of Python version (2.4, 2.5, 2.6, 2.7.. although not 3.X
yet), Python implementation (CPython/GAE/Jython... and untested but
hopefully IronPython), and operating system (UNIX/Windows/GAE).

This is both a practical and a marketing issue.  On the practical side,
being able to use the tool in many contexts is useful (e.g. alongside
Plone 3 in a Python 2.4 deployment, or on GAE for a simple app).  On the
marketing side, we have spikes in interest and we gain new users
whenever we put BFG into one of these contexts (e.g. a blog entry BFG
on Jython, or BFG on GAE etc).

So to the extent that it helps market BFG, I'm all for better GAE
support, and I would *love* to see people blog about putting BFG apps on
GAE and other alternate platforms.  There's only a single caveat: adding
support for one platform cannot detract from the portability of BFG onto
other platforms.  Other than that, I'd love to see add-ons for BigTable
bindings, authentication, etc that targeted GAE specifically, as well as
IronPython, Jython, etc.

Wrt GAE specifically, from a personal perspective, I like the idea of
its easy deployment, but the kinds of work Agendaless does doesn't
really lend itself to deployment on GAE due to limitations of the
platform.  So business-wise it will probably not become a preferred
deployment platform for *Agendaless*. As a result, it will really need
to be someone else who takes up the mantle of making BFG better on
GAE.  That said, this isn't an I don't care, this is an I care, but
someone else is going to have to care more.

- C


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


[Repoze-dev] [issue144] Small typo on Unit and Integration Testing chapter

2010-05-04 Thread Chris McDonough

Chris McDonough chr...@plope.com added the comment:

Thanks teix, fixed.

--
status: unread - resolved

__
Repoze Bugs b...@bugs.repoze.org
http://bugs.repoze.org/issue144
__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Folder event subscriber not called

2010-05-03 Thread Chris McDonough
On Mon, 2010-05-03 at 23:33 -0400, Chris McDonough wrote:
 On Mon, 2010-05-03 at 12:55 -0700, Sam Brauer wrote:
  Hi there!  I'm a long-time Zope 2 user finally trying to do a demo project 
  with Repoze.bfg.  
  First
  off, congratulations to everyone developing Repoze!  You've really
  cherry picked the best concepts from Zope and packaged them in a lean
  modern framework.
  
  My demo project was going along very well
  until I tried to wire up some subscribers for repoze.folder events; my
  subscriber callbacks don't seem to be firing.  After trying a few days
  to figure out the problem, I think I need to ask for help.  I've tried
  to come up with a small example to demonstrate the problem, and I'd be
  very grateful for any help.  I feel like I'm missing something that
  should be obvious.
  
 
 Hi Sam,
 
 The events sent by repoze.folder are object events, which are events
 dispatched based on *two* interfaces (the context interface and the
 event interface).  Here's an example from KARL:
 
   subscriber
   for=repoze.lemonade.interfaces.IContent
repoze.folder.interfaces.IObjectAddedEvent
   handler=.subscribers.index_content/
 
 Hopefully this helps, 

Sorry, I should have also provided the subscribers.index_content
function so you could see its argument list:

def index_content(obj, event):
 Index content (an IObjectAddedEvent subscriber) 
catalog = find_catalog(obj)
if catalog is not None:
for node in postorder(obj):
if is_content(obj):
path = model_path(node)
docid = getattr(node, 'docid', None)
if docid is None:
docid = node.docid = catalog.document_map.add(path)
else:
catalog.document_map.add(path, docid)
catalog.index_doc(docid, node)


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


  1   2   3   4   5   >