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

2010-04-29 Thread Darryl Cousins
Hi,

I happily use FormEncode with BFG.

http://formencode.org/Design.html

Best,
Darryl

On Thu, Apr 29, 2010 at 10:23 AM, Rob Miller r...@kalistra.com wrote:
 Chris Withers wrote:
 Hi All,

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

 repoze.bfg.formish is probably your best bet right now:

 http://svn.repoze.org/repoze.bfg.formish/trunk/docs/index.rst

 it's being used pretty heavily by the KARL project, so there's lots of in-use
 code to look at, the formish:form tags (and the classes they refer to) in
 this file are a good place to start:

 http://osi.agendaless.com/bfgsvn/karl/trunk/karl/content/views/configure.zcml

 chris has been working on repoze.deform, which is similar in many ways to
 repoze.bfg.formish, but takes a different approach to serialization, along w/
 some other differences.  see:

 http://docs.repoze.org/deform/

 and:

 http://www.plope.com/peppercorn

 the deform stuff is much less battle-worn, however; not only has
 repoze.bfg.formish been around for longer, but formish itself has a life of
 its own outside of repoze-land, whereas i'm not sure if deform has even seen
 any production use yet.

 -r

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

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


Re: [Repoze-dev] GAE or other 'cloud' choices for bfg apps?

2010-04-17 Thread Darryl Cousins
Hey Attila,

On Sat, Apr 17, 2010 at 9:32 AM, Attila Oláh attilao...@gmail.com wrote:
 Hi,

 On Fri, Apr 16, 2010 at 21:52, Darryl Cousins darryljcous...@gmail.com 
 wrote:
 Hi Tim,

 On Thu, Apr 15, 2010 at 1:55 PM, Tim Hoffman zutes...@gmail.com wrote:
 Hi Iain

 I have a number of projects on app engine.  Some using repoze.bfg
 (www.polytechnic.wa.edu.au (paid work), www.fishandlily.com.au (my
 small business)) and others just using zope.component and bobo (not
 public yet).

 We are using app engines persistence model which is simple and
 straight forward.  (http://code.google.com/p/bfg-pages/ has some
 examples of implementing a very simple cms on bfg and appengine, it
 implements traversal over entities in the datastore as folders and
 content).

 I think bfg is a good fit with appengine.  A couple of pointers, you
 are basically using the view, traversal, component registry
 mechanisms and not zodb/persistence (which isn't really core to bfg).
 We are not currently using chameleon but straight zpt with a custom
 bindings see the link above. You need to watch startup times so I am
 moving  away from using zcml and using python to register things.

 Yes, start up time is something I've noticed too. Aside from not using
 zcml for component registration do you have any other pointers to help
 with that problem?

 GAE caches your app for one minute, IIRC. Some Django folks use a cron
 job to ping the app every minute to keep it in cache, since Django is
 a monster when it comes to startup times. Something like:
 http://www.morkeleb.com/2009/12/16/appengine-grails-cron/

Thanks very much for the tip and the link.

Best,
Darryl


 Attila

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


Re: [Repoze-dev] GAE or other 'cloud' choices for bfg apps?

2010-04-17 Thread Darryl Cousins
Hi Tim,

On Sat, Apr 17, 2010 at 7:27 PM, Tim Hoffman zutes...@gmail.com wrote:
 HI Darryl

 Here's a couple of quick tips and these where a big win for us.

 1.  Memcache page output heavily, and  if possible serve the pages
 without even starting up or initialising bfg.
 We found we could do a cold startup and serve a page from cache in
 200ms cached page from memcache in 30ms. In this scenario you don't
 want to import any thirdparty libraries, just use what comes out of
 the box from appengine. (  ie importing any module not part of the
 core gae env always seems to take longer.)   Whereas just starting bfg
 before doing anything could take between 3-4 sec and on a bad day a
 lot longer.  Then if its not in the cache start bfg and process the
 page request.

 2.  Defer loading/importing stuff where possible.  For instance we use
 formish/schemaish for forms.  But if no one is logged in
 then we don't need to do the formish/schema imports.  If someone is
 logged in then we do import formish.  That way we only incur import
 costs when we actually use things. This is hard to control with zcml
 and a lot easier to do if you are directly registering things in
 python.  Also it means you don't have the cost of parsing zcml as
 well.

Thanks a million for sharing!

Very best,
Darryl


 Rgds

 T



 On Sat, Apr 17, 2010 at 3:52 AM, Darryl Cousins
 darryljcous...@gmail.com wrote:
 Hi Tim,

 On Thu, Apr 15, 2010 at 1:55 PM, Tim Hoffman zutes...@gmail.com wrote:
 Hi Iain

 I have a number of projects on app engine.  Some using repoze.bfg
 (www.polytechnic.wa.edu.au (paid work), www.fishandlily.com.au (my
 small business)) and others just using zope.component and bobo (not
 public yet).

 We are using app engines persistence model which is simple and
 straight forward.  (http://code.google.com/p/bfg-pages/ has some
 examples of implementing a very simple cms on bfg and appengine, it
 implements traversal over entities in the datastore as folders and
 content).

 I think bfg is a good fit with appengine.  A couple of pointers, you
 are basically using the view, traversal, component registry
 mechanisms and not zodb/persistence (which isn't really core to bfg).
 We are not currently using chameleon but straight zpt with a custom
 bindings see the link above. You need to watch startup times so I am
 moving  away from using zcml and using python to register things.

 Yes, start up time is something I've noticed too. Aside from not using
 zcml for component registration do you have any other pointers to help
 with that problem?

 Thanks in advance,
 Darryl Cousins


 The really big advantage of app engine as I see it, is not having to
 deal with the system platform (ie cpu's disk, memory, networks, etc..)
  app engine is purely a runtime and services. So if you have little in
 the way of IT admin support, it is a big win.
 You do have to make some concessions/design compromises to take into
 account the restrictions enforced by the platform.

 As for economics www.polytechnic.wa.edu.au gets about 7000 unique
 visitors a day, around 20,000-50,000 page views a day and
 we have billing enabled but rarely get over 50% of the free quota so
 it's currently not costing anything at the moment to run.

 Rgds

 T


 On Thu, Apr 15, 2010 at 7:46 AM, Iain Duncan iainduncanli...@gmail.com 
 wrote:
 Hey all, I have an app that eventually is intended to be used as a
 subscriber service. I'm totally new to the cloud thing, wondering if
 experienced bfg'ers would like to weigh in with their experiences
 - what is your preferred cloud deployment for bfg apps?
 - what persistence mechanism gets used? Is there some kind of facade over
 the bigtable? How do you handle it?
 - what is your experience with using cloud deployment, do you think it's
 even worth it?
 thanks!
 Iain
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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



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


Re: [Repoze-dev] GAE or other 'cloud' choices for bfg apps?

2010-04-16 Thread Darryl Cousins
Hi Tim,

On Thu, Apr 15, 2010 at 1:55 PM, Tim Hoffman zutes...@gmail.com wrote:
 Hi Iain

 I have a number of projects on app engine.  Some using repoze.bfg
 (www.polytechnic.wa.edu.au (paid work), www.fishandlily.com.au (my
 small business)) and others just using zope.component and bobo (not
 public yet).

 We are using app engines persistence model which is simple and
 straight forward.  (http://code.google.com/p/bfg-pages/ has some
 examples of implementing a very simple cms on bfg and appengine, it
 implements traversal over entities in the datastore as folders and
 content).

 I think bfg is a good fit with appengine.  A couple of pointers, you
 are basically using the view, traversal, component registry
 mechanisms and not zodb/persistence (which isn't really core to bfg).
 We are not currently using chameleon but straight zpt with a custom
 bindings see the link above. You need to watch startup times so I am
 moving  away from using zcml and using python to register things.

Yes, start up time is something I've noticed too. Aside from not using
zcml for component registration do you have any other pointers to help
with that problem?

Thanks in advance,
Darryl Cousins


 The really big advantage of app engine as I see it, is not having to
 deal with the system platform (ie cpu's disk, memory, networks, etc..)
  app engine is purely a runtime and services. So if you have little in
 the way of IT admin support, it is a big win.
 You do have to make some concessions/design compromises to take into
 account the restrictions enforced by the platform.

 As for economics www.polytechnic.wa.edu.au gets about 7000 unique
 visitors a day, around 20,000-50,000 page views a day and
 we have billing enabled but rarely get over 50% of the free quota so
 it's currently not costing anything at the moment to run.

 Rgds

 T


 On Thu, Apr 15, 2010 at 7:46 AM, Iain Duncan iainduncanli...@gmail.com 
 wrote:
 Hey all, I have an app that eventually is intended to be used as a
 subscriber service. I'm totally new to the cloud thing, wondering if
 experienced bfg'ers would like to weigh in with their experiences
 - what is your preferred cloud deployment for bfg apps?
 - what persistence mechanism gets used? Is there some kind of facade over
 the bigtable? How do you handle it?
 - what is your experience with using cloud deployment, do you think it's
 even worth it?
 thanks!
 Iain
 ___
 Repoze-dev mailing list
 Repoze-dev@lists.repoze.org
 http://lists.repoze.org/listinfo/repoze-dev


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

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


Re: [Repoze-dev] Presentation at NZPUG, Christchurch, NZ

2010-03-05 Thread Darryl Cousins
On Fri, Mar 5, 2010 at 8:50 PM, Darryl Cousins darryljcous...@gmail.com wrote:
 Live coding session with repoze.bfg:

 http://darrylcousins.blip.tv/

 Best regards and thanks,
 Darryl Cousins


As a follow up Chris suggested the following improvements, which I
much appreciate:

@darrylcousins instead of getUtility(ISettings)... from
repoze.bfg.settings import get_settings; settings = get_settings()
@darrylcousins also instead of
getSiteManger.sethook(get_current_registry): configurator.hook_zca()
@darrylcousins and instead of registry= getSiteManager()... registry =
request.registry
@darrylcousins maybe create a subscriber to INewRequest that attaches
a sqlite connection to each new request so they can do request.dbconn

Many thanks,
Darryl Cousins
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Question of manipulating URL

2010-03-04 Thread Darryl Cousins
On Fri, Mar 5, 2010 at 10:32 AM, georgehu geo...@gmail.com wrote:
 I'm writing a helper function for paginating the data,  the function needs
 to append a query string to the url to compose a new url with page number,
 and I decide to use the request object to get the url and then change it.
 The function I use to construct the url is route_url, I got an issue of
 using matchdict in the route_url, in the following syntax:

 route_url(route_name, self.request, **self.request.matchdict)

 It said Keyword must be string,  So I have to add the following codes to
 change the keyword to string:

 for k,v in self.request.matchdict.items():
     link_params[str(k)]=v

 I also need to get the route name:
    route_name=self.reqeust.environ['bfg.routes.route'].name,

 Am I making simple things complicated? Well, my target is to generate a url
 from /a to /a?page=1, why should I go through the process of breaking
 down then composing again? I finally found the request.url is a more
 straightforward way. My question is, which way should I choose? Is there a
 best practice guide to manipulating the url?

Hi George,

Are you aware of the '_query' parameter to route_url?

q = dict(page=1)
url =route_url(route_name, request, _query=q)

It doesn't answer all your question but may help.

Best,
Darryl






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


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


[Repoze-dev] Presentation at NZPUG, Christchurch, NZ

2010-03-04 Thread Darryl Cousins
Live coding session with repoze.bfg:

http://darrylcousins.blip.tv/

Best regards and thanks,
Darryl Cousins
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] System Error; Transaction closed

2010-02-20 Thread Darryl Cousins
Hi Chris,

On Sat, Feb 20, 2010 at 5:03 PM, Chris McDonough chr...@plope.com wrote:
 It looks like repoze.tm2 is committing the transaction before beaker has a
 chance to do a write.  Or something.  I'd move beaker below repoze.tm2 in
 paste.ini as a first shot at solving it.

Thanks for the reply. I gave that a go (I've previously tried swapping
the pipeline parts around to find a solution). Unfortunately to no
avail (and I'm using beaker in memory so it's no real surprise).

Wickert, Thanks for your reply. I had also wondered about that, but
usually an sqlalchemy error will come through in the traceback. Of
course it may be masked in some way (in a try/except statement). I'll
continue to investigate.

Thanks again for your replies.

Best,
Darryl

On Sat, Feb 20, 2010 at 5:03 PM, Chris McDonough chr...@plope.com wrote:
 It looks like repoze.tm2 is committing the transaction before beaker has a
 chance to do a write.  Or something.  I'd move beaker below repoze.tm2 in
 paste.ini as a first shot at solving it.

 On 2/19/10 8:39 PM, Darryl Cousins wrote:

 Hi,

 I'm frequently coming across a problem with the transaction. A typical
 traceback is included below.

 Relevant section of paste.ini:

 [pipeline:main]
 pipeline =
     responselogger
     browserid
     deliverance
     beaker
     egg:repoze.tm2#tm
     who
     myapp

 I don't call session.commit() anywhere in my code. And on refresh the
 error disappears (usually the first refresh, sometimes on second or
 third refresh).

 Has anyone else come across this problem and if so what was the
 solution or source of the problem?

 Thanks in advance,
 Darryl Cousins

 Traceback (most recent call last):
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
 line 1062, in process_request_in_thread
     self.finish_request(request, client_address)
   File
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py,
 line 320, in finish_request
     self.RequestHandlerClass(request, client_address, self)
   File
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py,
 line 615, in __init__
     self.handle()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
 line 436, in handle
     BaseHTTPRequestHandler.handle(self)
   File
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py,
 line 329, in handle
     self.handle_one_request()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
 line 431, in handle_one_request
     self.wsgi_execute()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
 line 287, in wsgi_execute
     self.wsgi_start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.debug-0.7-py2.6.egg/repoze/debug/responselogger.py,
 line 59, in __call__
     app_iter = self.application(environ, replace_start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.browserid-0.2-py2.6.egg/repoze/browserid/middleware.py,
 line 92, in __call__
     return self.app(environ, start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/parts/svneggs/deliverance/deliverance/security.py,
 line 89, in replacement_app
     return app(environ, start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/parts/svneggs/deliverance/deliverance/middleware.py,
 line 87, in __call__
     resp = req.get_response(self.app)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/WebOb-0.9.8-py2.6.egg/webob/request.py,
 line 919, in get_response
     application, catch_exc_info=False)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/WebOb-0.9.8-py2.6.egg/webob/request.py,
 line 887, in call_application
     app_iter = application(self.environ, start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/Beaker-1.5.1-py2.6.egg/beaker/middleware.py,
 line 152, in __call__
     return self.wrap_app(environ, session_start_response)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py,
 line 47, in __call__
     self.commit()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py,
 line 52, in commit
     t.commit()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/transaction-1.0.0-py2.6.egg/transaction/_transaction.py,
 line 322, in commit
     self._commitResources()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/transaction-1.0.0-py2.6.egg/transaction/_transaction.py,
 line 419, in _commitResources
     rm.tpc_vote(self)
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/zope.sqlalchemy-0.4-py2.6.egg/zope/sqlalchemy/datamanager.py,
 line 77, in tpc_vote
     self.tx.commit()
   File
 /Users/darrylcousins/vortex/buildout/vortex/eggs/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/orm/session.py,
 line 366

[Repoze-dev] System Error; Transaction closed

2010-02-19 Thread Darryl Cousins
Hi,

I'm frequently coming across a problem with the transaction. A typical
traceback is included below.

Relevant section of paste.ini:

[pipeline:main]
pipeline =
responselogger
browserid
deliverance
beaker
egg:repoze.tm2#tm
who
myapp

I don't call session.commit() anywhere in my code. And on refresh the
error disappears (usually the first refresh, sometimes on second or
third refresh).

Has anyone else come across this problem and if so what was the
solution or source of the problem?

Thanks in advance,
Darryl Cousins

Traceback (most recent call last):
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
line 1062, in process_request_in_thread
self.finish_request(request, client_address)
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py,
line 320, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py,
line 615, in __init__
self.handle()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
line 436, in handle
BaseHTTPRequestHandler.handle(self)
  File 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.py,
line 329, in handle
self.handle_one_request()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
line 431, in handle_one_request
self.wsgi_execute()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/Paste-1.7.2-py2.6.egg/paste/httpserver.py,
line 287, in wsgi_execute
self.wsgi_start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.debug-0.7-py2.6.egg/repoze/debug/responselogger.py,
line 59, in __call__
app_iter = self.application(environ, replace_start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.browserid-0.2-py2.6.egg/repoze/browserid/middleware.py,
line 92, in __call__
return self.app(environ, start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/parts/svneggs/deliverance/deliverance/security.py,
line 89, in replacement_app
return app(environ, start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/parts/svneggs/deliverance/deliverance/middleware.py,
line 87, in __call__
resp = req.get_response(self.app)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/WebOb-0.9.8-py2.6.egg/webob/request.py,
line 919, in get_response
application, catch_exc_info=False)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/WebOb-0.9.8-py2.6.egg/webob/request.py,
line 887, in call_application
app_iter = application(self.environ, start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/Beaker-1.5.1-py2.6.egg/beaker/middleware.py,
line 152, in __call__
return self.wrap_app(environ, session_start_response)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py,
line 47, in __call__
self.commit()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py,
line 52, in commit
t.commit()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/transaction-1.0.0-py2.6.egg/transaction/_transaction.py,
line 322, in commit
self._commitResources()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/transaction-1.0.0-py2.6.egg/transaction/_transaction.py,
line 419, in _commitResources
rm.tpc_vote(self)
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/zope.sqlalchemy-0.4-py2.6.egg/zope/sqlalchemy/datamanager.py,
line 77, in tpc_vote
self.tx.commit()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/orm/session.py,
line 366, in commit
self._assert_is_open()
  File 
/Users/darrylcousins/vortex/buildout/vortex/eggs/SQLAlchemy-0.6beta1-py2.6.egg/sqlalchemy/orm/session.py,
line 242, in _assert_is_open
raise sa_exc.InvalidRequestError(error_msg)
InvalidRequestError: The transaction is closed
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] chameleon.formish and formish i18n

2010-01-17 Thread Darryl Cousins
Hi Tom,

On Mon, Jan 18, 2010 at 6:17 AM, Tom Gross itconse...@gmail.com wrote:
 Hi all,

  what is the preferred form generation tool for repoze.bfg? I tried
 chameleon.formish, which seems a nice solution.
 I found the fileupload-widget is broken, attached is a patch to fix it.

 This is probably the wrong list to ask about i18n support of formish, but
 since chameleon is involved the key is maybe there. I solved the
 localization issue of the form labels with the following monkey patch, but
 I'm not really happy to use monkey patches in general. does anyone know of a
 better solution?

I wouldn't argue that it's better ...

I've been using formencode which has i18n support,
formencode.validators is easy to work with, the package has minimal
html generation (formencode.htmlfill) which was a design decision.

http://formencode.org/i18n.html
http://formencode.org/Design.html

Best,
Darryl


 -Tom

 from formish.forms import Field
 from zope.i18nmessageid.message import Message
 from zope.i18n import translate

 @property
 def title(self):
    title = self._orig_title
    if isinstance(title, Message):
        lang = getattr(self.form, 'target_language', 'en')
        return translate(title, target_language=lang)
    return title

 Field._orig_title = Field.title
 Field.title = title

 @property
 def description(self):
    description = self._orig_description
    if isinstance(description, Message):
        lang = getattr(self.form, 'target_language', 'en')
        return translate(description, target_language=lang)
    return description

 Field._orig_description = Field.description
 Field.description = description

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


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


[Repoze-dev] Running repoze.bfg on Google’s A pp Engine

2009-12-02 Thread Darryl Cousins
Hi All,

I found that the recipe [1] to run repoze.bfg on gae **almost** works.

The failure was that the resulting fresh application loads Chameleon via:

include package=repoze.bfg.includes /

which is included in paster jinja2 template configure.zcml [2]

Just removing this line gets the app up and running but is missing
directives from repoze.zcml:meta.zcml

I see 2 options:

1. replace the above mentioned include with the following in the
jinja2 paster template (attached patch.diff)

include package=repoze.zcml file=meta.zcml /

... which has the drawback that those using the paster template do not
have Chameleon (desirable in gae but perhaps not in other scenarios).

2. Make a mention in the tutorial (perhaps as in attached doc.diff)

Hope that is helpful,
Darryl Cousins

[1] http://docs.repoze.org/bfg/1.2/tutorials/gae/index.html
[2] 
http://svn.repoze.org/repoze.bfg.jinja2/trunk/repoze/bfg/jinja2/paster_template/+package+/configure.zcml


patch.diff
Description: Binary data


doc.diff
Description: Binary data
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] Running repoze.bfg on Google’s App Engine

2009-12-02 Thread Darryl Cousins
Hi Chris

On Thu, Dec 3, 2009 at 8:11 PM, Chris McDonough chr...@plope.com wrote:

 Darryl Cousins wrote:

 Hi All,

 I found that the recipe [1] to run repoze.bfg on gae **almost** works.

 Thanks for the analysis!

 I think the best solution would be to make all imports of Chameleon
 conditional.    This actually *used* to be the case; something must have
 broken it since 1.0 (the last time I tested that tutorial).

 Can you provide the traceback that is emitted when the wrong thing
 happens?

Yes. App starts ok, on first request the following traceback:

Mac OS X 10.5.8 - using python2.5 mac ports

Hope that helps, best,
Darryl

darrylcous...@lyrrad:~/projects/placerama $ dev_appserver.py app
INFO     2009-12-03 07:53:00,113 appengine_rpc.py:157] Server:
appengine.google.com
WARNING  2009-12-03 07:53:00,118 datastore_file_stub.py:443] Could not
read datastore data from
/var/folders/I+/I+TKAJhUHkGqvthbu07a-U+++TI/-Tmp-/dev_appserver.datastore
INFO     2009-12-03 07:53:00,162 dev_appserver_main.py:478] Running
application placerama on port 8080: http://localhost:8080
WARNING  2009-12-03 07:53:06,429 py_zipimport.py:103] Can't open
zipfile 
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg:
IOError: [Errno 13] file not accessible:
'/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg'
ERROR    2009-12-03 07:53:07,652 dev_appserver.py:3009] Exception
encountered handling request
Traceback (most recent call last):
 File 
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py,
line 2978, in _HandleRequest
   base_env_dict=env_dict)
 File 
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py,
line 411, in Dispatch
   base_env_dict=base_env_dict)
 File 
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py,
line 2244, in Dispatch
   self._module_dict)
 File 
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py,
line 2162, in ExecuteCGI
   reset_modules = exec_script(handler_path, cgi_path, hook)
 File 
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py,
line 2058, in ExecuteOrImportScript
   exec module_code in script_module.__dict__
 File /Users/darrylcousins/projects/placerama/app/runner.py, line
56, in module
   application = application(*(config_args or ()), **(config_kwargs or {}))
 File /Users/darrylcousins/projects/placerama/app/placerama/run.py,
line 10, in app
   return make_app(get_root, placerama, options=kw)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/repoze.bfg-1.1.3-py2.5.egg/repoze/bfg/router.py,
line 183, in make_app
   settings)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/repoze.bfg-1.1.3-py2.5.egg/repoze/bfg/configuration.py,
line 107, in make_registry
   zcml_configure(filename, package)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/repoze.bfg-1.1.3-py2.5.egg/repoze/bfg/configuration.py,
line 147, in zcml_configure
   xmlconfig.include(context, name, package)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py,
line 546, in include
   processxmlfile(f, context)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py,
line 378, in processxmlfile
   parser.parse(src)
 File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py,
line 107, in parse
   xmlreader.IncrementalParser.parse(self, source)
 File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/xmlreader.py,
line 123, in parse
   self.feed(buffer)
 File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py,
line 207, in feed
   self._parser.Parse(data, isFinal)
 File 
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py,
line 349, in end_element_ns
   self._cont_handler.endElementNS(pair, None)
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py,
line 357, in endElementNS
   self.context.end()
 File 
/Users/darrylcousins/projects/placerama/app/lib/python/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py,
line 537, in end
   self.stack.pop().finish()
 File 
/Users/darrylcousins/projects/placerama/app

[Repoze-dev] repoze.what.plugins.quickstart

2009-12-01 Thread Darryl Cousins
Hi,

I've added  'log_file' and 'log_level' to
repoze.what.plugins.quickstart via configuration files - writing tests
also.

How do I apply for commit privileges to repoze repository?

Sincerely,
Darryl Cousins
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] repoze.what.plugins.quickstart

2009-12-01 Thread Darryl Cousins
Hi,

Please find attached diffs for:

init.diff - quickstart:__init__.py
config.diff - quickstart:config.py
test_config.diff - tests:test_config.py
test_quickstart.diff - tests:test_quickstart.py

The attached diffs allow definitions for log_level and log_file to be
made in a quickstart ini file.

The diffs have been made against trunk:

URL: http://svn.repoze.org/repoze.what/plugins/quickstart/trunk
Repository Root: http://svn.repoze.org
Repository UUID: 8f1d8bf8-68d2-4fbe-a113-2afb08c80ed9
Revision: 7479

Best regards,
Darryl Cousins


config.diff
Description: Binary data


init.diff
Description: Binary data


test_config.diff
Description: Binary data


test_quickstart.diff
Description: Binary data
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] repoze.what.plugins.quickstart

2009-12-01 Thread Darryl Cousins
And here as is likely *should* be done, also 'logging-config.ini' for
tests/fixtures as referenced in added tests.

Sorry for the noise.

Best,
Darryl

On Wed, Dec 2, 2009 at 2:55 PM, Darryl Cousins darryljcous...@gmail.com wrote:
 And also for docs/Config.rst

 Best regards,
 Darryl Cousins



patch.diff
Description: Binary data


logging-config.ini
Description: Binary data
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev