Re: [Zope] generic setup&workflow: how to add to binding??
Yes you can, Plone do it with generic setup. - Register your profile (take a look at GenericSetup documentation) - take a look here: https://svn.plone.org/svn/plone/CMFPlone/tags/3.1.4/profiles/default/ (worflows.xml register the workflows, workflows folder contains them) look like that; robert rottermann a écrit : > Hi there, > I created a workflow product. > now I would like this workflow *added* to the bindings of the actual workflow > settings when the product is installed. > > so I have something like: > File (Default) > chanched to > File (Default) MyWorklow > > > I this possible? > If yes how? > > thanks > robert > ___ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Cacheable and invalidation
Hi, I m trying to invalidate one entry (and not all entries) of one FSPythonScript i have set to be cached in RamCache ZCacheable_invalidate() invalidate all entries def ZCacheable_invalidate(self, view_name='', REQUEST=None): '''Called after a cacheable object is edited. Causes all cache entries that apply to the view_name to be removed. Returns a status message. ''' is it possible ? By reading the code I supposed this is not. Thanks JeanMichel FRANCOIS Makina-Corpus ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ZopeProfiler and Kcachegrind, how to convert statistics files ?
Is someone has try to use ZopeProfiler with KCacheGrind ? I would like to try KCachegrind because i found xdot very slow. I have started to read the code of ZopeProfiler and i have discovered the world of profiling file format. It seems that ZopeProfiler save it's file in pstats format. So i need to convert those file to calltree format. But all scripts i have tryed has failed: * pyprof2calltree * lsprofcalltree.py * hotshot2calltree So am i on the wrong way ? Do i need to fix one of these script ? Are you using on of them ? Thanks. JeanMichel FRANCOIS Makina-Corpus ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZopeProfiler and Kcachegrind, how to convert statistics files ?
Dieter Maurer a écrit : > Jean-Michel FRANCOIS wrote at 2009-1-28 16:56 +0100: > >> Is someone has try to use ZopeProfiler with KCacheGrind ? I would like >> to try KCachegrind because i found xdot very slow. >> >> I have started to read the code of ZopeProfiler and i have discovered >> the world of profiling file format. It seems that ZopeProfiler save it's >> file in pstats format. So i need to convert those file to calltree >> format. But all scripts i have tryed has failed: >> >> * pyprof2calltree >> * lsprofcalltree.py >> * hotshot2calltree >> >> So am i on the wrong way ? Do i need to fix one of these script ? Are >> you using on of them ? >> > > You could try "pyprof2calltree" from the Python interpreter in > the following way: > > from marshal import load > from pyprof2calltree import visualize # or convert > stats = load(open(name_of_saved_file, 'rb')) > visualize(stats) > > > Not sure whether it will work (it probably will when "pyprof2calltree" does > not expect a more modern 'pstats' format). > > > > I have try this one. First issue, it assume you are using a Python2.5 (cProfile is new in Python2.5 but assume the same API) so i have change the import import profile as cProfile Now got a new problem when trying visualize: >>> visualize(stats) Traceback (most recent call last): File "", line 1, in ? File "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", line 256, in visualize converter = CalltreeConverter(profiling_data) File "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", line 117, in visualize self.output(f) File "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", line 104, in output self._print_summary() File "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", line 134, in _print_summary print entry AttributeError: 'tuple' object has no attribute 'totaltime' ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZopeProfiler and Kcachegrind, how to convert statistics files ?
It's done, i m now able to use KCachegrind with ZopeProfiler. I have patched pyprof2calltree to work with python2.4: diff -U 3 -H -d -r -N -- pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py pyprof2calltree-1.1.0-py2.4.egg.NEW//pyprof2calltree.py --- pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py2008-12-21 19:14:42.0 +0100 +++ pyprof2calltree-1.1.0-py2.4.egg.NEW//pyprof2calltree.py 2009-01-29 17:15:05.0 +0100 @@ -26,7 +26,18 @@ take a previously recorded instance of the pstats.Stats class. """ -import cProfile +try: +import cProfile +except ImportError: +#BBB for python2.4 +import profile as cProfile +def label(code): +if isinstance(code, str): +return ('~', 0, code) # built-in functions ('~' sorts at the end) +else: +return (code.co_filename, code.co_firstlineno, code.co_name) +cProfile.label = label + import pstats import optparse import os But something don't work : the call_info variable is not a sequence but a integer, so i have fixed it like that: @@ -175,9 +186,9 @@ print >> out_file, 'cfn=%s %s:%d' % ( co_name, co_filename, co_firstlineno) print >> out_file, 'cfi=%s' % (co_filename,) -print >> out_file, 'calls=%d %d' % (call_info[0], co_firstlineno) +print >> out_file, 'calls=%d %d' % (call_info, co_firstlineno) -totaltime = int(call_info[3] * 1000) +totaltime = int(call_info * 1000) print >> out_file, '%d %d' % (lineno, totaltime) def main(): Jean-Michel FRANCOIS a écrit : > Dieter Maurer a écrit : > >> Jean-Michel FRANCOIS wrote at 2009-1-28 16:56 +0100: >> >> >>> Is someone has try to use ZopeProfiler with KCacheGrind ? I would like >>> to try KCachegrind because i found xdot very slow. >>> >>> I have started to read the code of ZopeProfiler and i have discovered >>> the world of profiling file format. It seems that ZopeProfiler save it's >>> file in pstats format. So i need to convert those file to calltree >>> format. But all scripts i have tryed has failed: >>> >>> * pyprof2calltree >>> * lsprofcalltree.py >>> * hotshot2calltree >>> >>> So am i on the wrong way ? Do i need to fix one of these script ? Are >>> you using on of them ? >>> >>> >> You could try "pyprof2calltree" from the Python interpreter in >> the following way: >> >> from marshal import load >> from pyprof2calltree import visualize # or convert >> stats = load(open(name_of_saved_file, 'rb')) >> visualize(stats) >> >> >> Not sure whether it will work (it probably will when "pyprof2calltree" does >> not expect a more modern 'pstats' format). >> >> >> >> >> > I have try this one. First issue, it assume you are using a Python2.5 > (cProfile is new in Python2.5 but assume the same API) so i have change > the import > > import profile as cProfile > > Now got a new problem when trying visualize: > > >>>> visualize(stats) >>>> > Traceback (most recent call last): > File "", line 1, in ? > File > "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", > line 256, in visualize > converter = CalltreeConverter(profiling_data) > File > "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", > line 117, in visualize > self.output(f) > File > "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", > line 104, in output > self._print_summary() > File > "/home/toutpt/temp/profiling/lib/python2.4/site-packages/pyprof2calltree-1.1.0-py2.4.egg/pyprof2calltree.py", > line 134, in _print_summary > print entry > AttributeError: 'tuple' object has no attribute 'totaltime' > > > ___ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] ZopeProfiler and Kcachegrind, how to convert statistics files ?
Sebastien Douche a écrit : > On Wed, Jan 28, 2009 at 16:56, Jean-Michel FRANCOIS > wrote: > >> Is someone has try to use ZopeProfiler with KCacheGrind ? I would like >> to try KCachegrind because i found xdot very slow. >> >> I have started to read the code of ZopeProfiler and i have discovered >> the world of profiling file format. It seems that ZopeProfiler save it's >> file in pstats format. So i need to convert those file to calltree >> format. But all scripts i have tryed has failed: >> >> * pyprof2calltree >> * lsprofcalltree.py >> * hotshot2calltree >> >> So am i on the wrong way ? Do i need to fix one of these script ? Are >> you using on of them ? >> > > Maybe try this? > http://pypi.python.org/pypi/profilestats/1.0 > > > About those 10 lines of codes: It use the 'with' keyword so it is not compatible with python2.4 & Zope2.9 It use pyprof2calltree to convert stats to calltree (kcachegrind) It less flexible than ZopeProfiler (no configuration, no way to save multiple stats (filename is hardcoded)) You must modify the code (it s a decorator) So it's not help me in this case but thanks for pointing me out this decorator, it can help me for other use cases JeanMichel FRANCOIS Makina-Corpus ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] unittest a component that is using zope.dublincore
Hi, I m trying to make my first content type with zope3. The code is available there: http://github.com/toutpt/z3weblog.entry/tree I m following the second edition of the book "web component developement with zope3", i know this is not the last edition. So, i m making a ISized component for my simple content type, with a simple unittest, but now, i want to use zope.dublincore package and i get an error when i m launch the tests: = (zope3apps)tou...@linux-tggd:~/workspace/zope3apps/apps/prout> .bin/test Running tests at level 1 Running unit tests: Running: ... Error in test test_size_for_display (z3weblog.entry.tests.test_size.EntrySizeTestCase) Traceback (most recent call last): File "/home/toutpt/outils/python_system/2.5.4/lib/python2.5/unittest.py", line 260, in run testMethod() File "/home/toutpt/workspace/zope3apps/apps/prout/src/z3weblog.entry/src/z3weblog/entry/tests/test_size.py", line 21, in test_size_for_display msg = self.size.sizeForDisplay() File "/home/toutpt/workspace/zope3apps/apps/prout/src/z3weblog.entry/src/z3weblog/entry/size.py", line 24, in sizeForDisplay unit, chars = self.sizeForSorting() File "/home/toutpt/workspace/zope3apps/apps/prout/src/z3weblog.entry/src/z3weblog/entry/size.py", line 18, in sizeForSorting dc = dcI.IZopeDublinCore(self.context) TypeError: ('Could not adapt', , ) . Error in test test_size_for_sorting (z3weblog.entry.tests.test_size.EntrySizeTestCase) Traceback (most recent call last): File "/home/toutpt/outils/python_system/2.5.4/lib/python2.5/unittest.py", line 260, in run testMethod() File "/home/toutpt/workspace/zope3apps/apps/prout/src/z3weblog.entry/src/z3weblog/entry/tests/test_size.py", line 16, in test_size_for_sorting unit, size = self.size.sizeForSorting() File "/home/toutpt/workspace/zope3apps/apps/prout/src/z3weblog.entry/src/z3weblog/entry/size.py", line 18, in sizeForSorting dc = dcI.IZopeDublinCore(self.context) TypeError: ('Could not adapt', , ) Ran 4 tests with 0 failures and 2 errors in 0.007 seconds. Tests with errors: test_size_for_display (z3weblog.entry.tests.test_size.EntrySizeTestCase) test_size_for_sorting (z3weblog.entry.tests.test_size.EntrySizeTestCase) The trace back is very clear, the zope.dublincore components are not loaded. The question is : what is the best way to load components in unittests ? Do just i have to load the zcml of zope.dublincore, or do i have to register only needed components, if so how can i do that ? JeanMichel FRANCOIS Makina-Corpus begin:vcard fn:JeanMichel FRANCOIS n:FRANCOIS;JeanMichel org:Makina-Corpus adr;quoted-printable:;;44 boulevard des pas enchant=C3=A9s;Nantes;;44200;FRANCE email;internet:jeanmichel.franc...@makina-corpus.com title;quoted-printable:Ing=C3=A9nieur D=C3=A9veloppement tel;work:0251798084 tel;home:0240133880 tel;cell:0675156788 url:www.makina-corpus.com version:2.1 end:vcard ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )