[Repoze-dev] obob example...

Chris McDonough chrism at plope.com
Wed Sep 12 00:42:57 UTC 2007


As far as the paste pipeline is concerned, yes, although technically  
paste calls it an "application".  I think we've been calling them  
endpoints because the word "application" is too overloaded.

On Sep 11, 2007, at 8:41 PM, Paul Everitt wrote:

>
> Just to be clear...obob is the endpoint, right?
>
> --Paul
>
> On Sep 11, 2007, at 8:31 PM, Chris McDonough wrote:
>
>> I was typing this to Mike, but I think this is useful enough to  
>> send to the list.
>>
>> What we're aiming for is a world where a hello world app that uses  
>> obob might look something like this:
>>
>> def helloworld():
>>     return 'hello world!'
>>
>> root = {'helloworld':helloworld}
>>
>> def get_root(request):
>>     return root
>>
>> Configuration will register get_root as the callable for obob to  
>> get the root:
>>
>> [application:helloworld]
>> use = egg:repoze.obob#publisher
>> root_factory = helloworld:get_root
>>
>> Then from a web browser, if you visit http://localhost:8080/ 
>> helloworld, you would see:
>>
>> hello world!
>>
>> obob will call str() against an object returned or may call some  
>> other method on an object returned to it if it "implements some  
>> interface" (yet to be decided).  obob will guess at a content type  
>> if you don't set one (in this case, 'text/plain').  If you do want  
>> to set one, you will be able to get a "response" object (perhaps  
>> as a thread local via repoze.obob.get_response()) and set a  
>> content type or other headers using the response object API from  
>> anywhere in the code.  And so forth.
>>
>> By default, obob will traverse the graph using '__getitem__'  
>> against each object during path traversal and it will use __call__  
>> against the returned object.  You will be able to register  
>> alternate traversers and callers that do different things based on  
>> whatever policy you decide.
>>
>> - C
>>
>> _______________________________________________
>> Repoze-dev mailing list
>> Repoze-dev at lists.repoze.org
>> http://lists.repoze.org/mailman/listinfo/repoze-dev
>

_______________________________________________
Repoze-dev mailing list
Repoze-dev at lists.repoze.org
http://lists.repoze.org/mailman/listinfo/repoze-dev



More information about the Repoze-dev mailing list