Re: [Repoze-dev] [issue117] chapter 3

2012-11-12 Thread Chris Withers

On 12/11/2012 12:55, Tres Seaver wrote:

That was a huge pile of attachment spam on the bug tracker:  we
need to clean that crap out, and figure out how to defeat it.
Anybody know how to fix that in Roundup?


Only allow posting from logged in users?


The spammy attachments were added by a logged-in user.


Ugh.

I've wired in akismet for this kind of thing before, it helps with a 
percentage...


Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
https://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [issue117] chapter 3

2012-11-12 Thread Chris Withers

On 09/11/2012 23:02, Tres Seaver wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/09/2012 10:11 AM, Chris Withers wrote:

spam much? ;-)


That was a huge pile of attachment spam on the bug tracker:  we need to
clean that crap out, and figure out how to defeat it.  Anybody know how
to fix that in Roundup?


Only allow posting from logged in users?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
https://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [issue117] chapter 3

2012-11-09 Thread Chris Withers

spam much? ;-)

On 09/11/2012 14:45, admin wrote:


System message:


__
Repoze Bugs

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

__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
__


--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
https://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [modwsgi] Re: weird intermittent error with apache2 and mod_wsgi

2011-06-28 Thread Chris Withers

On 27/06/2011 17:31, Tres Seaver wrote:

"Let me google that for you":

- - http://mail.zope.org/pipermail/zodb-dev/2009-June/012607.html

- -
http://mediacore.com/blog/hosting-multiple-wsgi-applications-with-apache/

- - http://trac.edgewall.org/ticket/3371


Adding:

WSGIApplicationGroup %{GLOBAL}

...to my httpd.conf before the virtualhosts section made no difference.
Still works fine for a while, then starts randomly and inconsistently 
spitting exceptions, this time:


mod_wsgi (pid=22471): Exception occurred processing WSGI script 
'/...mod_wsgi'.

Traceback (most recent call last):
  File "...bin/mod_wsgi", line 34, in 
from aircon.web import make_app
  File "...aircon/web.py", line 7, in 
from repoze.bfg.configuration import Configurator
ImportError: No module named bfg.configuration

I must stress again, this is intermittent, it'll work for a while, then 
fail for a few requests, then more so until Apache is restarted.


(bfg.configuration is most certainly there and on the python path...)

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] weird intermittent error with apache2 and mod_wsgi

2011-06-27 Thread Chris Withers

Hi All,

Apologies for the cross post, but this problem is occurring with a 
repoze.bfg app running on apache using mod_wsgi, and the exception is 
suggesting something zope.interface related...


So, firstly, it only happens intermittently, and I haven't been able to 
figure out any pattern to the exceptions. It didn't used to happen at 
all (this app has been happily running for a year or so now) but I can't 
think of anything that's changed on the machine in question that might 
cause this. Restarting Apache does appear to cure it for a bit...


The exception is as follows:

File "aircon/bin/mod_wsgi", line 34, in 
  from aircon.web import make_app
File "aircon/aircon/web.py", line 2, in 
  from aircon.config import system,Session
File "aircon/aircon/config.py", line 1, in 
  from gb50 import System
File "aircon/aircon/gb50.py", line 33, in 
  class System:
File 
"zope.interface-3.6.1-py2.6-linux-i686.egg/zope/interface/advice.py", 
line 141, in advise

  return callback(newClass)
File 
"zope.interface-3.6.1-py2.6-linux-i686.egg/zope/interface/declarations.py", 
line 471, in _implements_advice

  classImplements(cls, *interfaces)
File 
"zope.interface-3.6.1-py2.6-linux-i686.egg/zope/interface/declarations.py", 
line 447, in classImplements

  spec = implementedBy(cls)
File 
"zope.interface-3.6.1-py2.6-linux-i686.egg/zope/interface/declarations.py", 
line 287, in implementedByFallback

  spec = cls.__dict__.get('__implemented__')
 2011] [error] [client 93.89.128.162] RuntimeError: class.__dict__ not 
accessible in restricted mode


the section of gb50.py looks like:

from aircon.interfaces import ISystem,IUnit
from zope.interface import implements

class System:

implements(ISystem)

...

The interface is:

from zope.interface import Interface,Attribute

class ISystem(Interface):
...

Anyone seen anything like this before or have any ideas?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] deform and sanitizing html fields

2011-04-26 Thread Chris Withers

Hi All,

Apologies for the cross post, which is the "right" list for deform?

I see deform.widget.RichTextWidget but only in the context of 
colander.String in the schema.


What's the best way to only allow a certain subset of html tags and zero 
javascript to be used? I don't see anything in 
deform.widget.RichTextWidget or colander.String that provides for this.

Has anyone implemented this for deform/colander in another package?

Related: what the "right" way to handle such a field which strips out 
bad html and/or fixes it without actually raising a validation error?

Would that be a new field type or is there some other way I should do this?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

On 02/03/2011 02:36, Shane Hathaway wrote:

Can we expect a 1.3.x release that fixes this, or is 2.0 the only way
forward? I'm seeing some regressions in 2.0, like the fact that "|" in
expressions doesn't seem to be supported anymore. (I need to replace
those anyway, so I'm not complaining--they are greedy exception
handlers.)


Also, a quirky behavior of the reference TAL implementation is if you
use unknown attribute names in the "tal" namespace, those attributes get
stripped from the output. It's a useful feature; it allows me to write
comments about a tag. I always spell the comment attributes as
"tal:comment". Chameleon 2.0-rc2 raises an exception on my "tal:comment"
attributes, while 1.3 ignored them. Can we have tal:comment or the
original behavior back?


Interesting, I use this technique a lot, and I didn't experience this 
problem with my brief test of 2.0-rc2.


I agree that if this really has changed, the original behaviour should 
come back. It's a bit of a non-starter otherwise :-S


cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

On 01/03/2011 13:56, Chris Withers wrote:

On 01/03/2011 13:52, Malthe Borch wrote:

On 1 March 2011 14:49, Chris Withers wrote:

Which version is this?


1.3.0-rc1


If you have the time, can you try the same thing in 2.0-rc2?


Exactly the same behaviour.


Sorry, jumped the gun here. I changed the wrong versions.cfg ;-)

This appears to work correctly in 2.0-rc2.
I'm nervous on the added dependencies of distribute and ordereddict :-(
Oh, and why is unittest2 being installed even when I'm not testing?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

On 01/03/2011 13:52, Malthe Borch wrote:

On 1 March 2011 14:49, Chris Withers  wrote:

Which version is this?


1.3.0-rc1


If you have the time, can you try the same thing in 2.0-rc2?


Exactly the same behaviour.

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

On 01/03/2011 13:48, Malthe Borch wrote:

On 1 March 2011 14:19, Chris Withers  wrote:

So, it's quoting the tags but not the entities. Bug, no?


Yes, it certainly seems so.

Which version is this?


1.3.0-rc1





That should include the content in ``pager`` as-is. What do you get?


Exactly that...

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

On 01/03/2011 13:13, Malthe Borch wrote:

On 1 March 2011 12:00, Chris Withers  wrote:



...doesn't appear to quote the html in the "pager" variable.
This is different from normal zpt, why the change?


It should definitely escape it in exactly the same way.


Well, I'd expect the above to be escaped.

...and it partially is:

html = '» bar'


gives:

» <b>bar</bar>


So, it's quoting the tags but not the entities. Bug, no?


Also, as a corollary, the following appears to be a no-op:



Am I right?


Yes, but that's firstly because you need to use ``tal:attributes``,
secondly because there is no "structure" keyword for attributes. It is
simply not allowed to *not* escape an attribute value.


Sorry, that was just a typo on my part, should have read:



cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev



[Repoze-dev] chameleon zpt: structure or not?

2011-03-01 Thread Chris Withers

Hi All,

I hope this is the right list, if not, what's the right list for 
Chameleon questions?


Anyway, the following:



...doesn't appear to quote the html in the "pager" variable.
This is different from normal zpt, why the change?

Also, as a corollary, the following appears to be a no-op:



Am I right?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] good error traceback middlewear?

2010-10-07 Thread Chris Withers
Hey All,

Anyone know of any good error-ish middlewear for production use that:

- gives good traceback output

- logs the exception to the python logging framework

cheers,

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


[Repoze-dev] REMOTE_USER authentication policy variant

2010-09-20 Thread Chris Withers
Hi All,

I was wondering if one of these existed already so thought I'd ask here 
before I wrote one...

So, we have a front end server running Apache, on Windows, doing NTLM 
auth (yay! go suckiness!). It proxies requests through to one of our 
back end servers, setting a header in the process:


Order deny,allow
Allow from all
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule . - [E=RU:%1]
RequestHeader set X-Forwarded-User %{RU}e


So, I need to turn the 'X-Forwarded-User' request header into the BFG 
user id. Anyone done an authentication policy that does this yet?

cheers,

Chris

PS: Yes, this would be insecure, were the backend servers not all 
firewalled off to only accept requests from the front end ;-)
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg concurrency problem with SqlAlchemy, SOLVED

2010-08-18 Thread Chris Withers
Iain Duncan wrote:
> I was erroneously trying to re-create mappers on each request when my 
> abstract model was being created. I had reasons for this that I won't 
> detail here, but suffice it to say it was a terrible idea because 
> mappers in SA are globa, so if you make a call to clear_mappers in one 
> thread you kill them in another concurrently requesting threadl. I need 
> to make a utility that globally makes my mappers at server startup and 
> leave them alone.

Yes, you generally do this in something akin to a models.py and the code 
gets executed at import time.

I am curious how you got to a position where you thought you needed to 
dynamically define mappers. Care to share?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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 Withers
Iain Duncan wrote:
> FWIW, I can sit there and hit reload, and get totally different 
> responses randomly, sometimes my bfg methods return what they are 
> supposed to, and others I get the 500s.  
> 
> Could there be a connection with using resource directory overloads in 
> the zcml?

It would be good to see the exceptions that are logged on the server 
side that match those 500s...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] debug logger evilness?

2010-08-09 Thread Chris Withers
Chris McDonough wrote:
>> 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.

I just wrote it as an easy way to check what messages were logged...

>> 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?
> ...

Ah, always wondered what that was ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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 Withers
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

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

> 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).

Yep, certainly functional tests...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] debug logger evilness?

2010-08-06 Thread Chris Withers
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] default view permission

2010-07-31 Thread Chris Withers
Hi All,

I asked previously whether there was any way to make views non-public by 
default. The answer was no.

So, I was wondering, if I came up with a patch, would it get applied?
I was thinking of adding a method to the configurator, something like:

configurator.set_default_permission('view')

Would it need a zcml variant too?

Implementation-wise, I'd look for the lowest point in the stack where a 
permission comes through as None and interject the specified default 
there. I'm hoping that won't be much of a change.

What's the feeling on this? Any pointers as to where the relevant tests 
and code would be?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


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

2010-07-02 Thread Chris Withers
Chris Witehrs wrote:
> New submission from Chris Witehrs :

Wow, I cannot even spell my own name.
Shoot me.

Chris

___
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-30 Thread Chris Withers
Alex Marandon wrote:
> 
> 
> On 29 June 2010 04:44, Chris Withers  <mailto: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/

FWIW, this his the spot with me...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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-06-30 Thread Chris Withers
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? ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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 Withers
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...

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] functional testing with @bfg_view

2010-06-28 Thread Chris Withers
Hi All,

I have a view that starts like this:

@bfg_view(renderer='templates/control.pt')
class Control:

 def __init__(self,request):
 self.request = request

 def __call__(self):
 ...
 return dict(
 ...
 )


I'd like to do a functional test, in particular checking that the 
template has no syntax errors in it and contains the data it should do 
by checking for strings in the returned response.

I got this far:

class TestView(TestCase):

 def setUp(self):
 self.request = testing.DummyRequest()
 self.config = Configurator()
 self.config.begin(request=self.request)
 self.config.scan(myapp)

 def tearDown(self):
 self.config.end()


 def test_render(self):
 view = Control(self.request)

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?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] static views and @@

2010-06-24 Thread Chris Withers
Paul Everitt wrote:
>> I can't remember seeing any use of @@ in BFG docs. Where did you see that?
> 
> http://docs.repoze.org/bfg/current/narr/traversal.html#traversal-chapter
> 
> """
> The traversal algorithm exposes two special cases:
> 
> [snip[

Yep, and in my case, I can to this from the warning box at the bottom of:

http://docs.repoze.org/bfg/1.3/narr/static.html#advanced-serving-static-resources-using-a-view-callable

So, what's the deal? Is the bug with the docs or with BFG 1.3 or am I 
doing something wrong?

cheers,

Chris

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


[Repoze-dev] static views and @@

2010-06-24 Thread Chris Withers
Hi All,

I've registered a static view with:

 config.add_static_view('static','mypackage:templates/static')

Which, if I read the docs, means I should be able to build urls such as:

/@@static/some.css

However, the above 404s.

If I change is to:

/static/some.css

...it works.

What am I doing wrong?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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 Withers
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? ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


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

2010-06-24 Thread Chris Withers
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...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] methodName and repoze.bfg.xmlrpc

2010-06-11 Thread Chris Withers
Chris McDonough wrote:
>> If so, what needs to happen for methodName to work?
>> (I might be able to get the time to do any work that needs doing...)
> 
> The task involves answering that question, I don't know.

Okay, so I've done a:

svn+ssh://rep...@svn.repoze.org/svn/repoze.bfg.xmlrpc/branches/chrisw_multimethod

...that provides a base class for a normal BFG view class that provides 
multi-method XML-RPC support.

This feels like the way to go for me. As a side benefit, it means you 
can unit test your XML-RPC methods without having to marshal and 
de-marshal stuff in tests.

If you like, can you merge to trunk and release? (I'm happy to do the 
merge and release prep if you prefer, just gimme a prod)

cheers,

Chris

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


[Repoze-dev] ZCA registries

2010-06-04 Thread Chris Withers
Hi All,

Firsly, a few comments on the book chapter relating to this:

- The example on page 233 and the first one on page 234 both import 
getGlobalSiteManager even though it's not used in the example.

- The example on page 235 calls hook_zca() even though I believe this 
has the opposite effect to the documented one.

So, the problem I have is that I have a couple of packages that register 
utilities with the ZCA. Those utilities are then looked up in 
application code.

The registrations are all ensured to take place after config.begin() and 
before config.end().

However, the application code is not always inside the handling of a BFG 
request. Some code also runs when the application recieves incoming 
stomp messages. I originally had this code create a fake http request 
and fire that at Twisted's WSGI server. However, that sucked in some 
fairly fundamental ways. So, that code no longer runs inside a "bfg 
request".

I originally followed ChrisM's IRCadvice on this; just used the registry 
attached to the config or the request. But, that made my packages 
dependent on repoze.bfg, when they had no other need to be.

So, I dropped back to using getSiteManager().registerUtility and 
getSiteManager().getUtility and used hook_zca as recommended in the docs.

The problem here was that while the registrations were done in the 
app-specific registry, this registry had been popped off the threadlocal 
stack by the time my stomp message code was called.

So, I either had to teach the stomp message code about the BFG registry 
stack, and then mimic the BFG code that pushes the config's registry 
onto the stack for the duration of the handling of the message. That 
would once again make my packages dependent on repoze.bfg for artificial 
reasons, even more so this time!

So, I went for the recipe in 26.1.3 in the book. However, this still has 
the same problem because of the hook_zca call; during configuration, the 
ZCA global registry is used, but without the aforementioned teaching and 
mimicking, I now have the *repoze.bfg.registry* global registry on the 
stack (which still doesn't have my registrations) when my stomp handling 
application code is called.

So, I currently do this during app setup:

def app(global_config, **settings):
 registry = getGlobalSiteManager()
 config = Configurator(registry=registry)
 config.setup_registry(settings=settings)

 config.begin()
 ... do registrations...
 config.end()

 return config.make_wsgi_app()

(note the absence of hook_zca)

This appears to work, but is it "right"? Am I going to get bitten by 
"something weird" later down the line?

cheers,

Chris

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


Re: [Repoze-dev] problems running chameleon tests

2010-06-03 Thread Chris Withers
Malthe Borch wrote:
> On 3 June 2010 12:37, Chris Withers  wrote:
>> How do you run the tests?
> 
> python setup.py nosetests

Ah, okay, didn't know about that. That works fine.

It was the following that caused the problems:

python setup.py test

I'll use your suggestion from now on, no need for a 'test' extra_requires.

cheers,

Chris

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


Re: [Repoze-dev] problems running chameleon tests

2010-06-03 Thread Chris Withers
Malthe Borch wrote:
> Really that's odd;

How do you run the tests?

> we can definitely add a [test] on next release; or
> please go ahead and commit it if you can.

Hmm, it occurs to me that even if the [test] extra_requires was there, I 
don't know how to feed that into:

python setup.py develop

Any ideas?

Chris

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


Re: [Repoze-dev] problems running chameleon tests

2010-06-02 Thread Chris Withers
Malthe Borch wrote:
> This has to do with lxml; it currently worksforme, but I don't know
> why. Try Stephan's static build and see if it fares any better,
> possibly using otool -L to confirm bindings.

Actually, the tests only run if you have *all* the stuff in the 
test_require ;-)

...its' a shame there isn't a chameleon[test] to install when you want 
to run tests, python setup.py test appears to install all the tests 
dependencies for each test run :-(

Chris

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


Re: [Repoze-dev] [chameleon bug] bugtracker url wrong in docs.

2010-06-02 Thread Chris Withers
Wichert Akkerman wrote:
> On 2010-6-2 23:02, Chris Withers wrote:
>> Chris Withers wrote:
>>> On the off chance you meant a bug tracker, I'll post both of these
>>> bugs there.
>>
>> And the docs for the bug tracker are wrong...
>>
>> https://code.launchpad.net/chameleon is a ruby-based blogging project...
> 
> A 5 second search on launchpad would have pointed you to 
> https://bugs.launchpad.net/chameleon-template-engine . 

First hit for me was:

https://launchpad.net/chameleon.genshi

Is that related? A fork? Something else?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug] bugtracker url wrong in docs.

2010-06-02 Thread Chris Withers
Chris Withers wrote:
> On the off chance you meant a bug tracker, I'll post both of these bugs 
> there.

And the docs for the bug tracker are wrong...

https://code.launchpad.net/chameleon is a ruby-based blogging project...

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [chameleon bug]

2010-06-02 Thread Chris Withers
Wichert Akkerman wrote:
> On 2010-6-2 20:38, Chris Withers wrote:
>> What tracker should I put this in?
> 
> Please see http://chameleon.repoze.org/docs/latest/ which documents this.

Documents what? I see no reference to http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [chameleon bug]

2010-06-02 Thread Chris Withers

Hi All,

With the reference implementation of genshi you can do the following:

>>> from genshi.template import MarkupTemplate
>>> tmp = MarkupTemplate("""\
... 
... http://genshi.edgewall.org/";>
...   
... This is replaced.
...   
... 
... """)
>>> stream = tmp.generate()
>>> print stream.render('xhtml')

  
A Genshi Template
  


The same doesn't work in chameleon.genshi.

The attached patch adds a failing test that demonstrates this.

What tracker should I put this in?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
Index: src/chameleon/genshi/language.txt
===
--- src/chameleon/genshi/language.txt   (revision 9494)
+++ src/chameleon/genshi/language.txt   (working copy)
@@ -13,6 +13,23 @@
   ... result = func(**kwargs)
   ... return mt.process(result)
 
+>> print render("""\
+  ... 
+  ... http://genshi.edgewall.org/";>
+  ...   
+  ... This is replaced.
+  ...   
+  ... """)
+  
+
+  A Genshi Template
+
+  
+
 py:if
 
   >>> print render("""\
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [chameleon bug] py:choose not working

2010-06-02 Thread Chris Withers

Hi All,

With the reference implementation of genshi you can do the following:
>>> from genshi.template import MarkupTemplate
>>> tmp = MarkupTemplate("""\
... http://www.w3.org/1999/xhtml";
...  xmlns:py="http://genshi.edgewall.org/";>
...   
... 0
... 1
...   
... """)
>>> stream = tmp.generate()
>>> print stream.render('xhtml')
http://www.w3.org/1999/xhtml";>
1


The same doesn't work in chameleon.genshi.

The attached patch adds a failing test that demonstrates this.

What tracker should I put this in?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
Index: src/chameleon/genshi/language.txt
===
--- src/chameleon/genshi/language.txt   (revision 9494)
+++ src/chameleon/genshi/language.txt   (working copy)
@@ -113,6 +113,19 @@
 
   
 
+  >>> print render("""\
+  ... http://www.w3.org/1999/xhtml";
+  ...  xmlns:py="http://genshi.edgewall.org/";>
+  ...   
+  ... 0
+  ... 1
+  ...   
+  ... """)
+  http://www.w3.org/1999/xhtml";>
+  1
+  
+
+
 py:for
 
   >>> print render("""\
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] problems running chameleon tests

2010-06-02 Thread Chris Withers
So, in an effort to create some tests for the chameleon.genshi problems 
I'm having, I thought I'd run the current tests.

On MacOSX this appears to fail for trunk right now.

What am I doing wrong?

Chris

serato:chameleon chris$ svn info
Path: .
URL: http://svn.repoze.org/chameleon/trunk
Repository Root: http://svn.repoze.org
Repository UUID: 8f1d8bf8-68d2-4fbe-a113-2afb08c80ed9
Revision: 9494
Node Kind: directory
Schedule: normal
Last Changed Author: Wichert Akkerman 
Last Changed Rev: 9493
Last Changed Date: 2010-06-02 13:13:34 +0100 (Wed, 02 Jun 2010)

serato:chameleon chris$ nose --version
-bash: nose: command not found
serato:chameleon chris$ ~/virtualenvs/repoze.bfg/bin/nosetests
.F...FFF.F.F..E
==
ERROR: Failure: ImportError (No module named lxml.builder)
--
Traceback (most recent call last):
   File 
"/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/loader.py",
 
line 382, in loadTestsFromName
 addr.filename, addr.module)
   File 
"/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py",
 
line 39, in importFromPath
 return self.importFromDir(dir_path, fqname)
   File 
"/Users/chris/virtualenvs/repoze.bfg/lib/python2.6/site-packages/nose-0.11.3-py2.6.egg/nose/importer.py",
 
line 86, in importFromDir
 mod = load_module(part_fqname, fh, filename, desc)
   File 
"/Users/chris/LocalSVN/chameleon/src/chameleon/tests/test_i18nize.py", 
line 3, in 
 from lxml.builder import ElementMaker
ImportError: No module named lxml.builder

==
FAIL: Doctest: template.txt
--
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py", 
line 2152, in runTest
 raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for template.txt
   File 
"/Users/chris/LocalSVN/chameleon/src/chameleon/core/template.txt", line 0

--
File "/Users/chris/LocalSVN/chameleon/src/chameleon/core/template.txt", 
line 73, in template.txt
Failed example:
 print result
Expected:
 http://www.w3.org/1999/xhtml";>
   http://test/ns";>
 Hello, world!
   
 
Got:
 http://www.w3.org/1999/xhtml";>
 
   http://test/ns";>
 Hello, world!
   
 None
 


==
FAIL: Doctest: i18n.txt
--
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py", 
line 2152, in runTest
 raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for i18n.txt
   File "/Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt", 
line 0

--
File "/Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt", 
line 16, in i18n.txt
Failed example:
 from zope.i18n.simpletranslationdomain import SimpleTranslationDomain
Exception raised:
 Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py", 
line 1248, in __run
 compileflags, 1) in test.globs
   File "", line 1, in 
 from zope.i18n.simpletranslationdomain import 
SimpleTranslationDomain
 ImportError: No module named i18n.simpletranslationdomain
--
File "/Users/chris/LocalSVN/chameleon/src/chameleon/genshi/i18n.txt", 
line 17, in i18n.txt
Failed example:
 td = SimpleTranslationDomain("test", {
 ("de", "test_msgid") : u"Mock translation of 'test_msgid'.",
 ("de", "msg_id")  : u"Mock translation of 'msg_id'.",
 ("de", "tid"): u"Mock translation of 'tid'.",
 ("de", "aid"): u"Mock translation of 'aid'.",
 ("de", "Default"): u"Mock translation of 'Default'.",
 ("de", "bananas"): u"Mock translation of ${count} bananas.",
 ("de", "two_bananas"): u"Ich will ${bananas} Bananen und 
${apples} \xc4pfels.",
 ("de", "month_may")  : u"Mai",
 ("de", "® <") : u"German ® <",
 ("de", "The Dutch")  : u"Die Hollander",
 ("de", "missing_id") : u"missing_id",
 ("nl", "size_advise"): u"${retailer} adviseert u ${size}.",
 ("nl", "size_advise_suggestion"): u"maat ${size}",
 })
Exception raised:
 Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/

[Repoze-dev] does chameleon.genshi support

2010-06-02 Thread Chris Withers
Chris McDonough wrote:
>  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 ;-)

> [11:50]  i don't know whether it should be possible to have
> http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


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

2010-06-02 Thread Chris Withers

Hi All,

I'm attempting to get the attached .genshi template working with 
repoze.bfg.chameleon_genshi.


The problem appears to be the 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

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk
Title: ${title}






field





numeric
value







___
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-06-01 Thread Chris Withers
Chris McDonough wrote:
>>> 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

Hmm, just been trying to reproduce this and can't.
I phail.

Still, yay for not having a bug to fix...

Chris

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


Re: [Repoze-dev] [ZODB-Dev] Problem with handling of data managers that join transactions after savepoints

2010-05-11 Thread Chris Withers
Jim Fulton wrote:
>>> I plan to implement A soon if there are no objections.
>>>
>>> Unless someone somehow convinced me to do D, I'll also add an
>>> assertion in the Transaction.join method to raise an error if a
>>> data manager joins more than once.
>> Option A sounds sensible. It also means I won't have to change
>> anything in the zope.sqlalchemy data manager.
> 
> Very cool. I was hoping non-ZODB-data-manager authors
> were paying attention. :)
> 
> If anyone knows of any other, I would appreciate someone forwarding
> this thread to them.

zope.sendmail and MaildropHost have data managers.
I've seen some file-based things that was a data manager and a few 
others in people's BFG stacks, maybe they can pipe up and/or let the 
others of those wsgi components know.

I'm also likely about to write one, but I'm dumb, so can't comment 
meaningfully on the options ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk

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


[Repoze-dev] making chameleon.genshi a first-class option for template rendering

2010-05-11 Thread Chris Withers
Hi All,

I mistakenly thought that genshi was a "first class" option as a 
templating language for BFG.

Chris disuaded me of that belief, but I'd like to know what needs to be 
written for Genshi to be settable as the "default template language" for 
a BFG app.

What components need to be written?
How would I set them as "default"?

(yes, I am volunteering to do the work...)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
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 Withers
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?
How about browser sessions?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
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 Withers
Chris McDonough wrote:
>>> app = get_app('some_config_file.ini', 'myapp')
>> Fair enough, but it's the .ini that the powers that be don't want here ;-)
> 
> Why not?

Believe it or not, they're fairly allergic to anything other than Python 
and Genshi, even for config, which is a little distressing...

>> I'm calling it from within the module called run.py in the right package 
>> (as per the demo). Should I report it as a bug that the wrong package is 
>> picked as the base?
> 
> 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)

cheers,

Chris

___
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 Withers
Chris Rossi wrote:
> FWIW, I can imagine something spelled sort of like:
> 
> @bfg_view(name='something', overrides='baseapp.views.someview')
> def my_view(request):

+lots

Yeah, I hadn't replied 'cos I couldn't think of how to spell what I was 
after.

This is spot on, and would, in theory, allow an app to override a 
library that overrides a framework.

cool :-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
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-04 Thread Chris Withers
Chris McDonough wrote:
> On Fri, 2010-04-30 at 19:13 +0100, Chris Withers wrote:
>> Hi All,
>>
>> Because I need to use the Twisted WSGI server for my app and so can't 
>> use Paste, 
> 
> While it's obviously useful to not require PasteDeploy, this itself is
> not true.  You can use something like:
> 
> from repoze.bfg.paster import get_app
> 
> app = get_app('some_config_file.ini', 'myapp')

Fair enough, but it's the .ini that the powers that be don't want here ;-)

>> exceptions.NotImplementedError: Can't perform this operation for 
>> unregistered loader type
>>
>> Why does BFG guess wrong here and how can I correct BFG's notion of what 
>> the current package is?
> 
> config = Configurator(package=some.package, ...)
> 
> ... might be the right solution, depending on how you're calling it.
> 
> http://docs.repoze.org/bfg/1.3/api/configuration.html#repoze.bfg.configuration.Configurator

"If None is passed (the default), the package is assumed to be the 
Python package in which the caller of the Configurator constructor lives."

I'm calling it from within the module called run.py in the right package 
(as per the demo). Should I report it as a bug that the wrong package is 
picked as the base?

cheers,

Chris

___
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-04 Thread Chris Withers
Chris McDonough wrote:
> On 04/29/2010 07:32 AM, Chris Withers wrote:
>> Chris McDonough wrote:
>>> No. You can always override an individual registration (obtained via
>>> imperative configuration, a scan, or via ZCML) with a subsequent
>>> imperative registration.
>>
>> Okay, but how would I override a decorator with another decorator?
> 
> You won't.

Hmmm, that sure would be nice though ;-)

>> What happens if a scan finds two decorators for the same thing?
> 
> Each adds some configuration.  Neither cancels each other out.

I don't follow.

@bfg_view(name='something')
def my_view1(request):
 ...

@bfg_view(name='something')
def my_view2(request):
 ...

Which function gets called when I go to:

http://whatever/something

?

Chris

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


[Repoze-dev] methodName and repoze.bfg.xmlrpc

2010-05-04 Thread Chris Withers
Hi All,

I assume the docs about methodName being ignored at:

http://docs.repoze.org/xmlrpc/#repoze-bfg-xmlrpc-usage

...are still correct?

If so, what needs to happen for methodName to work?
(I might be able to get the time to do any work that needs doing...)

Chris


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


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

2010-04-30 Thread Chris Withers
Hi All,

Because I need to use the Twisted WSGI server for my app and so can't 
use Paste, I'm running into some issues. Here's my run.py, adapted from 
the routes alchemy template:

"""
from repoze.bfg.configuration import Configurator
from repoze.tm import make_tm
from twisted.web.wsgi import WSGIResource
from twisted.web.server import Site
from twisted.internet import reactor

def app(global_config, **settings):
 import demo
 config = Configurator(settings=settings)
 config.begin()
 config.scan(demo)
 config.add_static_view('static','demo:templates/static')
 config.end()
 return config.make_wsgi_app()

def main():

 wsgi = WSGIResource(reactor, reactor.getThreadPool(),
 # wsgi middlewear
 make_tm(
 app(None,
 # from settings.ini
 reload_templates = True,
 debug_authorization = False,
 debug_notfound = False,
 ),
 None),
 )
 factory = Site(wsgi, 'server.log')
 reactor.listenTCP(8080, factory)
 reactor.run()

if __name__=='__main__':
 main()
"""

The first bug is that when run with "python -m demo.run", config.scan() 
guesses the wrong package by default. I'm guessing that's a bug, but as 
you can see, easy to work around.

The second bug is with add_static_view which seems to suffer from the 
same problem. Unless I put the "demo:" in front, it guesses the wrong 
package again and I get the following when I try to access the static view:

   File 
"bfgenv/lib/python2.5/site-packages/repoze.tm2-1.0a5-py2.5.egg/repoze/tm/__init__.py",
 
line 23, in __call__
 result = self.application(environ, save_status_and_headers)
   File 
"bfgenv/lib/python2.5/site-packages/repoze.bfg-1.2-py2.5.egg/repoze/bfg/router.py",
 
line 130, in __call__
 response = view_callable(context, request)
   File 
"bfgenv/lib/python2.5/site-packages/repoze.bfg-1.2-py2.5.egg/repoze/bfg/view.py",
 
line 227, in __call__
 return request_copy.get_response(self.app)
   File "build/bdist.linux-x86_64/egg/webob/request.py", line 919, in 
get_response

   File "build/bdist.linux-x86_64/egg/webob/request.py", line 887, in 
call_application

   File 
"bfgenv/lib/python2.5/site-packages/repoze.bfg-1.2-py2.5.egg/repoze/bfg/static.py",
 
line 35, in __call__
 if not pkg_resources.resource_exists(self.package_name, resource):
   File 
"bfgenv/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py",
 
line 871, in resource_exists

   File 
"bfgenv/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py",
 
line 1170, in has_resource

   File 
"bfgenv/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py",
 
line 1218, in _has

exceptions.NotImplementedError: Can't perform this operation for 
unregistered loader type

Why does BFG guess wrong here and how can I correct BFG's notion of what 
the current package is?

cheers,

Chris

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


Re: [Repoze-dev] providing utilities

2010-04-29 Thread Chris Withers
Chris McDonough wrote:
> You could do:
> 
> def app(global_config, **settings):
> config = Configurator(settings=settings)
> config.begin()
> config.registry.provideUtility(factory(), ISomething)
> config.scan()
> config.end()
> return config.make_wsgi_app()
> 
>> ...or do I have to do something to make sure I register in the right
>> registry?
> 
> During the configuration stage, the "current" global registry is defined 
> as whatever registry is attached to the configurator between the begin() 
> and end() calls.



In a wsgi app, is the app function above executed once per process or 
once per thread?

> Preferably, don't do that at all, and you'll wind up putting 
> registrations into the Zope global registry, which your app can use 
> independently.

...right, but if I do that configuration inside app(), and it gets 
executed once per thread, won't I be re-doing the global registrations 
unnecessarilly? (I don't know if that has bad consequences...)

Chris

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


Re: [Repoze-dev] threadpooling things

2010-04-29 Thread Chris Withers
Chris Rossi wrote:
> This currently lives in a specific project but I have considered
> pulling it out and making it more general:
> 
> http://bfg.repoze.org/pastebin/715

Any reason you don't just use SQLAlchemy?

Chris

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


[Repoze-dev] threadpooling things

2010-04-29 Thread Chris Withers
Not strictly speaking a repoze question, but the people who live here 
have likely bumped into this, and I value your wise opinions :-)

So, SQLAlchemy takes care of having one session per thread and a 
connection pool for you, however what about resources where that's not 
the case.

For me, it's a stomp client for sending stomp messages, but I guess it 
could be an ftp connection, etc.

Are there any tools around for managing one connection per thread and/or 
connection pooling in an abstract way that I could re-use?

cheers,

Chris

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


Re: [Repoze-dev] bfg_alchemy template and handle_teardown

2010-04-29 Thread Chris Withers
Chris McDonough wrote:
>> As far as I know this is unnecessary. It's not in the repoze.cluegun
>> app, nor in the app I worked on at Jarn. Are there any problems when
>> you remove it?
> 
> No idea.  Withers, can you confirm?

With the current setup, we end up doing both a .remove() in the 
subscriber and then a .close() in the transaction.

At worst, one of those two needs to be done.

So, at worst, zope.sqlalchemy should be configurable as to whether 
.close or .remove is called, but hopefully (pending confirmation from 
Michael Bayer) just a .close should be fine and the code in the template 
can just go away :-)

cheers,

Chris

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


[Repoze-dev] providing utilities

2010-04-29 Thread Chris Withers
Hi All,

What's the "correct" way to provide utilities in BFG imperatively?

My guess would be:

from repoze.bfg.configuration import Configurator
from somewhere import ISomething
from zope.component import provideUtility

def factory():
 return ...yada...

def app(global_config, **settings):
 config = Configurator(settings=settings)
 config.begin()
 ...yada...
 provideUtility(factory(),ISomething)
 config.scan()
 config.end()
 return config.make_wsgi_app()

...or do I have to do something to make sure I register in the right 
registry?

cheers,

Chris

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


Re: [Repoze-dev] [sqlalchemy] Re: session lifecycle and wsgi

2010-04-29 Thread Chris Withers
Laurence Rowe wrote:
> On Apr 28, 4:38 pm, Chris Withers  wrote:
>> Laurence Rowe wrote:
>>> Chris,
>>> This is what the combination of repoze.tm2/transaction and
>>> zope.sqlalchemy does for you. You don't have to do anything special
>>> other than that.
>> It doesn't do the .remove().
>> BFG currently has a bit of horribleness to make that work.
>> I'd like to get rid of it or make it less horrible...
> 
> Can you point me at where it does that please.

http://svn.repoze.org/repoze.bfg/trunk/repoze/bfg/paster_templates/routesalchemy/+package+/run.py_tmpl

...the handle_teardown function.

I no longer believe this is necessary, pending absolute confirmation 
from Michael in the "Re: [sqlalchemy] session lifecycle and wsgi" thread.

It's certainly not necessary to do the close() *and* the remove() ;-)

cheers,

Chris

___
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-04-29 Thread Chris Withers
Charlie Clark wrote:
>> Decorators are a little harder 'cos you can't safely rely on the "last
>> one wins" philosophy so you end up needing some kind of ordering, or
>> raising an exception if "something" is defined more than once, which
>> precludes one package customising stuff from another if they both use
>> decorators - which is what I'm ideally aiming for :-/
> 
> Which is one of the reasons why declarative configuration has its place.

decorators *are* declarative configuration...

Chris

___
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-04-29 Thread Chris Withers
Chris McDonough wrote:
> No.  You can always override an individual registration (obtained via 
> imperative configuration, a scan, or via ZCML) with a subsequent 
> imperative registration.  

Okay, but how would I override a decorator with another decorator?
What happens if a scan finds two decorators for the same thing?

> But at the end of the day, it kinda doesn't matter.  The framework just 
> provides mechanism; it's really the application developer's 
> responsibility to chunk things appropriately so they can be reused, 
> extended, or omitted.  

So why the big warnings in the book?

> A poor developer can make that hard even if he 
> uses ZCML as a registration mechanism: he might put all of the 
> registrations in a single ZCML file so that someone who wants to take 
> only some of the registrations must effectively take all of them or none 
> of them.  

Isn't that what people generally do with zcml and why zcml's overrides 
ability exists?

> Obviously something similar could also be done with decorators (just 
> comment out the "scan" and either do imperative config or ZCML in its 
> place).  But with ZCML you can usually just cut, paste, and change.  If 
> ZCML was not in the picture, you're often probably going to need to 
> think about converting decorator based registrations into imperative 
> analogues or ZCML instead of cut-paste-change.

It's something that's always bugged me and neither zcml nor anything 
else I've seen allow; the idea of turning off an existing piece of 
configuration.

Decorators are a little harder 'cos you can't safely rely on the "last 
one wins" philosophy so you end up needing some kind of ordering, or 
raising an exception if "something" is defined more than once, which 
precludes one package customising stuff from another if they both use 
decorators - which is what I'm ideally aiming for :-/

What ideas do people have in these areas?

Chris


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


[Repoze-dev] "membership" for BFG and composing multiple apps

2010-04-28 Thread Chris Withers
Final one of my trio for this evening...

Is there anything like the ol' CMFMembership for BFG?
(important bits for me:
  - where to store/get user info from
  - cookie authentication
  - login and logout forms
  - password reminder and reset forms and functionality)

If there is such a beastie, how do I plug it in to my existing app setup?

If I wanted to write such a similar lump of non-app-specific 
functionality, how would I do so in such a way that plugging in the 
views and other code would be as easy as possible?
(and also easy for the consumer to override my choice of html, specific 
url, etc)

cheers,

Chris - fun feeling like a total n00b again :-)

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] imperative configuration prevents application extension?

2010-04-28 Thread Chris Withers
Hi All,

In the BFG book their are copious references to the fact that using 
imperative configuration (or the decorators, my preferred choice) is 
"bad" if you plan to write apps that might be extended by others.

Am I right in understanding that this is because that method of 
configuration somehow prevents overrides being applied later?

If so, what can we do to change that? I've grown quite allergic to ZCML 
in the few years since I last had to touch it...

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] form generation package recommended for use with BFG?

2010-04-28 Thread Chris Withers
Hi All,

Is there anything akin to Django's form generation and handling stuff 
that's recommended for use with BFG?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [sqlalchemy] session lifecycle and wsgi

2010-04-28 Thread Chris Withers
King Simon-NFHD78 wrote:
> Have you read
> http://www.sqlalchemy.org/docs/session.html#lifespan-of-a-contextual-ses
> sion - it describes typical usage of a scoped session in a web
> application.

I have now ;-)

> In your traditional structure, you could get an exception during
> session.commit() which would not be handled in your exception handler. I
> believe (but I'm not certain) that after any kind of database exception,
> it is recommended that you roll back the existing transaction, as it is
> likely to be invalid anyway.

Any ideas in the case where you're using two phase commit?
I'm likely to use repoze.tm2, which has a process that looks roughly like:

try:
   
except:
   session.rollback()
   raise
else:
   try:
  
  session.prepare()
   except:
  session.rollback()
  raise
   else:
  session.commit()

Is this sequence correct? If not, what should change?

> Session.remove() ensures that the current session is removed from the
> scoped session registry. If you don't do this, I think that the next
> time this thread calls Session(), it'll get the old session back again,
> rather than creating a new one.

Surely that's a good thing? When would it not be a good thing?
(repoze.bfg has a faily warty way of calling session.remove, I'd like 
that to go away if it's not necessary)

The only worry I have is about releasing MySQL connections back to the 
pool rather than slowly consuming them all over time...

cheers,

Chris

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


Re: [Repoze-dev] Integration testing with imperative configuration

2010-04-27 Thread Chris Withers
Chris McDonough wrote:
> Instead of calling config.load_zcml there, do whatever your application 
> does to configure itself in its run.py (often .scan()), e.g.:
> 
>class ViewIntegrationTests(unittest.TestCase):
>def setUp(self):
>import myapp
>self.config = Configurator(package=myapp)
>self.config.begin()
>self.config.scan()
> 
>def tearDown(self):
>""" Clear out the application registry """
>self.config.end()

Indeed, but that's a bit anti-DRY...

I guess this would be an indicator of factoring out the imperative 
configuration into a function that took a config argument as its only 
parameter and could be called either form the tests or from the app setup?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] Integration testing with imperative configuration

2010-04-27 Thread Chris Withers
Hi All,

19.3 in the book covers writing integration tests by loading zcml.
In a rare lack of symetry for the book, it doesn't cover the same for 
imperative configuration.

Where can I find integration testing examples when using imperative 
configuration?

cheers,

Chris

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


Re: [Repoze-dev] Repackaged PIL 1.1.7

2010-04-26 Thread Chris Withers
Chris Withers wrote:
>> You would be wrong, as you would know if you had tried running the
>> effbot's packages inside an eggified environment:  he is actively
>> hostile to changes which would make this all go away, which leaves us
>> with the necessity of forking his release.

I don't believe this to be the case, so I dropped Fred a mail.

Here's his response:

Fredrik Lundh wrote:
 > Hi Chris, thanks for the heads up.
 >
 > Not sure what's going on here; PIL is traditionally installed in
 > site-packages/PIL so that everything is available as "from PIL import
 > ...", but with a pth file that adds that directory to the path so that
 > pre-package code still works (there are tons of such code out there).
 >
 > It looks like the setup.py file achieves this as follows:
 >
 > extra_path = "PIL",
 > package_dir={"": "PIL"},
 > packages=[""],
 >
 > where extra_path creates the pth file, and the package_dir stuff makes
 > sure distutils installs things under PIL and not PIL/PIL.  Some quick
 > Googling indicates that setuptools' support for extra_path is spotty
 > (non-existent until 2006, limited since then), so maybe this is the
 > issue?
 >
 > Could you persuade whoever's ranting about this to jump over to
 > image-sig and propose a patch that fixes whatever problem Plone is
 > having but preserves the old behaviour?

Is such a patch possible? If so, could someone do as Fred asks and do so 
while resisting the temptation to be rude and further alienate the 
maintainer of what is a fantastic package? (yeah, I know, rich coming 
from me...)

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk

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


[Repoze-dev] cron-ish jobs

2010-04-21 Thread Chris Withers
Hi Again,

Have any patterns emerged for using a BFG-ish configuration, transaction 
and data stack to perform batch jobs triggered by cron?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] building indexes to run projects from ;-)

2010-04-21 Thread Chris Withers
Hi All,

I know Chris is keen to run from indexes per projects, such as:

http://dist.repoze.org/bfg/current/simple

..so I was wondering what people recommend, software wise, for 
maintaining such an index per project?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] picking versions for use with buildout

2010-04-21 Thread Chris Withers

Hi All,

The attached buildout should generate a versions.cfg file suitable for 
running a particular version of BFG in a buildout.


I've attached its output for version 1.2, and the current development 
index as of writing.


Could anyone who knows please check that it has picked the right versions?*
If it has, where/how should I release/put this .cfg and its output such 
that others can use the generated .cfg files?


cheers,

Chris

* the dev version lists bfg's version as 1.2. Does that just mean bfg's 
setup.py is wrong on trunk?
# 1. Make sure the eggs directory is empty before running this
# 2. Make sure you fill in the right version!

[buildout]
extensions = buildout.dumppickedversions
parts = bfg
eggs-directory = eggs
find-links = http://pypi.python.org/simple/buildout.dumppickedversions/

# insert the right version here:
bfg_version=dev

index = http://dist.repoze.org/bfg/${buildout:bfg_version}/simple
dump-picked-versions-file = repoze.bfg-${buildout:bfg_version}-versions.cfg

[bfg]
recipe = zc.recipe.egg
eggs = repoze.bfg
[versions]
Paste = 1.7.2
WebOb = 0.9.8
repoze.bfg = 1.2.1
zc.buildout = 1.4.3
zc.recipe.egg = 1.2.2
zope.component = 3.9.1
zope.interface = 3.5.3

#Required by:
#repoze.bfg 1.2.1
Chameleon = 1.1.1

#Required by:
#repoze.bfg 1.2.1
#PasteScript 1.7.3
PasteDeploy = 1.3.3

#Required by:
#repoze.bfg 1.2.1
PasteScript = 1.7.3

#Required by:
#repoze.bfg 1.2.1
repoze.lru = 0.3

#Required by:
#repoze.bfg 1.2.1
#zope.deprecation 3.4.0
#zope.interface 3.5.3
#zope.configuration 3.7.1
#zope.component 3.9.1
setuptools = 0.6c11

#Required by:
#repoze.bfg 1.2.1
zope.configuration = 3.7.1

#Required by:
#repoze.bfg 1.2.1
zope.deprecation = 3.4.0

#Required by:
#zope.schema 3.6.1
#zope.component 3.9.1
zope.event = 3.4.1

#Required by:
#zope.schema 3.6.1
#zope.configuration 3.7.1
zope.i18nmessageid = 3.5.1

#Required by:
#zope.configuration 3.7.1
zope.schema = 3.6.1
[versions]
Paste = 1.7.2
WebOb = 0.9.8
repoze.bfg = 1.2
zc.buildout = 1.4.3
zc.recipe.egg = 1.2.2
zope.component = 3.9.1
zope.interface = 3.5.3

#Required by:
#repoze.bfg 1.2
Chameleon = 1.2.3

#Required by:
#repoze.bfg 1.2
#PasteScript 1.7.3
PasteDeploy = 1.3.3

#Required by:
#repoze.bfg 1.2
PasteScript = 1.7.3

#Required by:
#repoze.bfg 1.2
repoze.lru = 0.3

#Required by:
#repoze.bfg 1.2
#zope.deprecation 3.4.0
#zope.interface 3.5.3
#zope.configuration 3.7.1
#zope.component 3.9.1
setuptools = 0.6c11

#Required by:
#repoze.bfg 1.2
zope.configuration = 3.7.1

#Required by:
#repoze.bfg 1.2
zope.deprecation = 3.4.0

#Required by:
#zope.schema 3.6.1
#zope.component 3.9.1
zope.event = 3.4.1

#Required by:
#zope.schema 3.6.1
#zope.configuration 3.7.1
zope.i18nmessageid = 3.5.1

#Required by:
#zope.configuration 3.7.1
zope.schema = 3.6.1
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] plugging in a new scanner

2010-04-21 Thread Chris Withers
Charlie Clark wrote:
> Am 21.04.2010, 16:51 Uhr, schrieb Chris Withers :
> 
>> But the above will definitely be in 1.3, right?
> 
> Nice of you to offer to do the work! ;-)

Sorry, my comment was unclear, it was about the Venusian work, which is 
done already.

i18n is hard, and who would need that crap anyway? ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] plugging in a new scanner

2010-04-21 Thread Chris Withers
Chris McDonough wrote:
>> Monkeypatchable or should I avoid trying to do that...
> 
> The trunk now uses "venusian" instead of hardcoded decorator scanning.  
> See the repoze.bfg.view.bfg_view class for an example decorator that 
> registers a callback that will be called at config.scan() time.  See 
> http://docs.repoze.org/venusian for the details.

Cool, what index should I use to get the right set of package versions 
to work with trunk?

> Not sure about final release.  I think we'll want to add some explicit 
> i18n support before the first beta, but we can probably roll an alpha 
> any time.

But the above will definitely be in 1.3, right?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Repackaged PIL 1.1.7

2010-04-16 Thread Chris Withers
Tres Seaver wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Chris Withers wrote:
>> Hanno Schlichting wrote:
>>>> The confusion surrounding PIL almost makes me want to write some sort of 
>>>> über
>>>> document listing the orginal problem along with all the various 
>>>> hack-arounds.
>>> Both of these show you the exact problem the official distribution has
>>> with setuptools. It uses a package name of '', 
>> How'd you figure that?
>>
>> Line 48 and 480 of PIL 1.1.7's setup.py would suggest it uses a package 
>> name of "PIL"...
>>
>>> As this is a repackaging of a specific version of PIL, it needs to be
>>> done again for each new release. So far we only had a repackaging of
>>> the 1.1.6 version, I contributed one for 1.1.7 now.
>> I would hazard a guess that none of the above are needed anymore ;-)
> 
> You would be wrong, as you would know if you had tried running the
> effbot's packages inside an eggified environment:  he is actively
> hostile to changes which would make this all go away, which leaves us
> with the necessity of forking his release.

ch...@server2:~$ python virtualenv.py --no-site-packages test_pil
New python executable in test_pil/bin/python
Installing setuptools.done.
ch...@server2:~$ cd test_pil/
ch...@server2:~/test_pil$ source bin/activate
(test_pil)ch...@server2:~/test_pil$ easy_install PIL

Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir 
/tmp/easy_install-e9Tqhd/PIL-1.1.7/egg-dist-tmp-wuELlI
WARNING: '' not a valid package name; please use only.-separated package 
names in setup.py
Finished processing dependencies for PIL
(test_pil)ch...@server2:~/test_pil$ python

 >>> import Image
 >>> Image.__file__
'/home/chris/test_pil/lib/python2.4/site-packages/PIL-1.1.7-py2.4-linux-i686.egg/Image.pyc'

Yeah, the warning is a wart, but what's the problem?
Has anyone tried asking Fred politely before?
I did this a while back about the name of the distribution file and he 
was happy to change it to make things work for setuptools.
What's he's not happy about is people ranting at him about a tool he 
doesn't use or care about ;-)

I dunno if changing the package name is going to be an easy thing for 
him to do..

cheers,

Chris

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


Re: [Repoze-dev] plugging in a new scanner

2010-04-15 Thread Chris Withers
Chris McDonough wrote:
> On 4/13/10 4:15 AM, Chris Withers wrote:
>> Hi All,
>>
>> I'd like to plug in my own decorator (as a way of wiring a method to
>> recieve stomp messages from a particular queue as it happens) to the
>> config.scan() machinery.
>>
>> Are there docs or a recommended way to do this?
> 
> No.  It's hardcoded. 

Monkeypatchable or should I avoid trying to do that...

> I think we should make it not-hardcoded for 1.3.

Cool, what are the timescales for 1.3?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk

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


[Repoze-dev] plugging in a new scanner

2010-04-13 Thread Chris Withers
Hi All,

I'd like to plug in my own decorator (as a way of wiring a method to 
recieve stomp messages from a particular queue as it happens) to the 
config.scan() machinery.

Are there docs or a recommended way to do this?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Repackaged PIL 1.1.7

2010-04-11 Thread Chris Withers
Hanno Schlichting wrote:
>> The confusion surrounding PIL almost makes me want to write some sort of über
>> document listing the orginal problem along with all the various hack-arounds.
> 
> Both of these show you the exact problem the official distribution has
> with setuptools. It uses a package name of '', 

How'd you figure that?

Line 48 and 480 of PIL 1.1.7's setup.py would suggest it uses a package 
name of "PIL"...

> As this is a repackaging of a specific version of PIL, it needs to be
> done again for each new release. So far we only had a repackaging of
> the 1.1.6 version, I contributed one for 1.1.7 now.

I would hazard a guess that none of the above are needed anymore ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] RenderResponse objects

2010-04-06 Thread Chris Withers
Chris McDonough wrote:
>> Also, how come you put response attributes on the request when using a
>> renderer?
>>
>> How about a RenderResponse object:
>>
>> class RenderResponse(dict):
>>
>> def __init__(self):
>> super(dict,self).__init__()
>> self.content_type = 'the default'
>> self.header_list = []
>> self.status = '200 Ok' # or whatever...
>> self.charset = 'utf-8'
>> self.cache_for = 0
>>
>> ...then in you view you could just do:
>>
>> from repoze.bfg.view import bfg_view
>> from repoze.somewhere import RenderResponse
>>
>> @bfg_view(name='gone',renderer='templates/gone.pt')
>> def myview(request):
>> response = Response(URL=request.URL)
>> response.status = '404 Not Found'
>> return response
>>
>> The view code wouldn't change and you wouldn't have to pollute the
>> request...
> 
> Could have been, too late now.

How about for 1.4?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] repoze.component and repoze.configuration

2009-06-27 Thread Chris Withers
Fernando Correa Neto wrote:
> I'd like to say that repoze.component ended up being more than just an
> entry point for people willing to apply AOP on their apps.
> One can easily exercise the pattern of registering components and
> looking them up back by just using simple strings rather than defining
> interfaces just as markers.

I have to admit, most of the time I just register components against 
classes, rather than interfaces, when using zope.component.

It'd be interesting to play with repoze.components and see how using 
strings instead feels...

Chris


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


Re: [Repoze-dev] bfg vs buildout

2009-06-25 Thread Chris Withers
Shane Hathaway wrote:
> I'm not very familiar with pip, but I don't think that's an issue for 
> Buildout.  Buildout also has the ability to pin the version of all 
> packages, but I don't think that's what Jens and I want in this case.

yep, the only thing buildout is missing is a command to dump the 
versions.cfg based on what's in the current buildout...

> We want an authority to provide a regularly updated list of Repoze 
> package versions known to probably work together.  Thankfully, the BFG 
> index is serving that purpose, except that it's not easy to combine that 
> list with the rest of PyPI.  I think the problem would be solved if that 
> index took the form of a versions.cfg (auto-generated would be fine).

Yep, I wonder if Chris could be tickled to put your auto-generator up 
somewhere on dist.repoze.org?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg vs buildout

2009-06-24 Thread Chris Withers
Tres Seaver wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Chris Withers wrote:
>> Chris Rossi wrote:
>>> On Wed, Jun 24, 2009 at 9:16 AM, Chris Withers >> <mailto:ch...@simplistix.co.uk>> wrote:
>>>
>>>
>>> Also, how do you wire running tests, particularly running them with
>>> nose, into this?
>>>
>>> bin/nosetests path/to/src
>> ...having added nosetests as a dependent egg, right?
>>
>> How/where do you encapsulate options to nosetests such that they don't 
>> have to be continuously re-typed?
> 
> You can put them in the [nosetests] section of setup.cfg, and then run
> the tests via '/path/to/python setup.py nosetests' (having first
> installed 'Nose', and maybe 'coverage').

The question was in the context of buildout, so I guess this would 
translate to:

- add nose and coverage to required eggs

- bin/buildout setup path/to/my/package/setup.py nosetests

?

That feels a bit cumbersome, is there any way to use zc.recipe.egg or 
some other recipe such that I can just do:

bin/test

?

Also, has anyone found a way to get buildout to do something with eggs 
specified in test_requires? (ie: bake them into a script rather than 
letting setuptools just install them randomly into your source tree)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] BFG testing

2009-06-24 Thread Chris Withers
Tres Seaver wrote:
>> I see BFG uses the tests_require parameter to setuptools' setup function 
>> rather than the "normal zope way" of an extra_requires dict with a 
>> 'test' key.
>>
>> What's the difference between these two from your perspective and what 
>> made you guys choose tests_require over extra_requires?
> 
> So that '/path/to/python setup.py test' will do the right thing.  We
> don't expect / require using zc.buildout or any external runner to run
> the tests.

So, playing this back in a different way, did you guys pick nose over 
zope.testrunner because zope.testrunner doesn't work with
"python setup.py test"?

>> Also, how come nose and coverage aren't specified as dependencies anywhere?
> 
> They are optional.  We often run the tests with them, but don't insist
> that everyone must.

Cool.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg vs buildout

2009-06-24 Thread Chris Withers
Chris Rossi wrote:
> 
> 
> (karl3)ch...@opportunity:~/proj/karl3/src/karl$ cat test
> ../../bin/nosetests $*
> 
> So, we just do:
> 
> $ cd src/karl
> $ ./test

Hackish, but I guess functional. Sadly not cross platform.

I wonder if a little buildout recipe is in order?

I see:

http://pypi.python.org/pypi/pbp.recipe.noserunner

...but this doesn't seem to be much more than a wrapper around 
zc.recipe.egg and doesn't offer any way to store nose config options in 
buildout.cfg.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg vs buildout

2009-06-24 Thread Chris Withers
Chris Rossi wrote:
> On Wed, Jun 24, 2009 at 9:16 AM, Chris Withers  <mailto:ch...@simplistix.co.uk>> wrote:
> 
> 
> Also, how do you wire running tests, particularly running them with
> nose, into this?
> 
> bin/nosetests path/to/src

...having added nosetests as a dependent egg, right?

How/where do you encapsulate options to nosetests such that they don't 
have to be continuously re-typed?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg vs buildout

2009-06-24 Thread Chris Withers
Jens W. Klein wrote:
> -
> [buildout]
> extensions = buildout.dumppickedversions
> parts = instance
> eggs-directory = ${buildout:directory}/eggs
> find-links = 
> http://dist.repoze.org/bfg/1.0/
> 
> [instance]
> recipe = repoze.recipe.egg:scripts
> eggs =
> repoze.bfg
> 
> Missing is a version fixation like done in ZTK, Grok, Plone, ... 
> I'd really like to see such a version.cfg for each repoze release. 
> Creation could be automated.

Why don't you just replace find-links with index?

Also, how do you wire running tests, particularly running them with 
nose, into this?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] BFG testing

2009-06-24 Thread Chris Withers
Hi All,

I see BFG uses the tests_require parameter to setuptools' setup function 
rather than the "normal zope way" of an extra_requires dict with a 
'test' key.

What's the difference between these two from your perspective and what 
made you guys choose tests_require over extra_requires?

Also, how come nose and coverage aren't specified as dependencies anywhere?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] bfg vs buildout

2009-06-24 Thread Chris Withers
Hey All,

Just been reading http://docs.repoze.org/bfg/narr/install.html and I 
notice a conspicuous absence of zc.buildout...

Do you guys recommend not using buildout?
If not, are there docs anywhere for using BFG in a buildout context?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Plan for repoze.zodbconn

2009-06-12 Thread Chris Withers
Shane Hathaway wrote:
> To make tasks like these easier, I would like to add to repoze.zodbconn 
> a WSGI framework component that opens a ZODB connection, puts that 
> connection in the WSGI environment, calls the next WSGI app in the 
> chain, then closes the same ZODB connection on the way out.  I intend to 
> add it myself, but I would like to hear any feedback the group might 
> have before I do it.

+lots from me, especially if I can use this in other (much smaller) wsgi 
apps...

Also, would it make sense to manage the transaction, maybe optionally, 
in this outer layer too?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] repoze grok comparison

2009-05-09 Thread Chris Withers
Chris McDonough wrote:
> People are often confused about the duality of zope.interface Interface 
> objects 
> being used as markers during adaptation as well as being used as a mechanism 
> to 
> describe an API.

I've found the use of interfaces as markers pretty limited.
Most of the time now, I just register adapters directly against classes.

Does repoze.plugin support this?

I'm quite interested in:

- persistent registries that aren't tied to ZODB (which is all that 
zope.component offers)

- context-based registries (ie: different views for a folder in a site 
versus the root of a site)

Would be great to know thoughts you have on both of those!

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] templating engine speed comparisions

2009-05-01 Thread Chris Withers
Wichert Akkerman wrote:
>> Are there any speed-comparison suites for templating engines out there?
>> Would be really interesting to compare them all...
> 
> chameleon has a benchmarker somewhere in its sources.

Does it benchmark anything other than chameleon though?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] templating engine speed comparisions

2009-05-01 Thread Chris Withers
Malthe Borch wrote:
> We use a custom parser based on ``xml.parsers.sax`` –– it's in
> ``chameleon.core.etree``.
> 
>> How do you guys to speed profiling? Would be interested to see how the speed
>> compares with and without lxml and across various templating engines...
> 
> The ``lxml`` library is only used in the compilation process; it's not
> used at all while rendering.

Interesting, but the bit of my question is still unanswered:

Are there any speed-comparison suites for templating engines out there?
Would be really interesting to compare them all...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] repoze.bfg under google appengine?

2009-04-15 Thread Chris Withers
Malthe Borch wrote:
> I'm quite keen to rid ourselves of this inane dependency; I just need
> to find some moments to do it. Since by now we use Python's builtin
> XML parser anyway, 

Which one do you use? Where's the relevant code in you repository?
How do you guys to speed profiling? Would be interested to see how the 
speed compares with and without lxml and across various templating 
engines...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] repoze.recipe.egg?

2009-04-02 Thread Chris Withers
Out of interest, what does repoze.recipe.egg to differently to 
zc.recipe.egg?

Would be good to only have one recipe :-)

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] bfg and google app engine

2009-01-16 Thread Chris Withers
Tres Seaver wrote:
> What would be helpful is to have somebody try to get a minimal BFG app
> run on top of Kapil's forked packages probably using the GAE-emulation
> environment, and tell us what breaks.  Once we know it is possible, then
> packaging BFG and its full dependency set into a ZIP file would be the
> next step.

I wonder how much this is actually worth persuing before GAE has support 
for C-extensions such as zope.component?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Somebody needs to talk at EuropPython.

2008-05-31 Thread Chris Withers
Godefroid Chapelle wrote:
> I think Lennart is really hitting a nail here. We need to advertize 
> about our great efforts.
> 
> I wont be in EuroPython even if I would have spoken about it with pleasure.

I am planning on going and would be happy to talk but I'm not sure I 
know enough on these subjects to be a good speaker :-(

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

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


Re: [Repoze-dev] Repoze with mod_wsgi and Varnish/Squid

2008-03-13 Thread Chris Withers
Chris McDonough wrote:
>   - Run two Apache instances:
> 
>   Apache (80)
>   |
>   | mod_proxy
>   v
>  Varnish ()
>   |
>   | http
>   v
> Apache (mod_wsgi)

Do you even need two Apache instances?
Wouldn't it be okay just having Apache listen on two ports with 
different handling for each?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

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