Re: [Zope-dev] Zope 4 release management

2012-02-01 Thread Jonathan Ballet
On Wed, Feb 01, 2012 at 02:21:32PM +0100, Lennart Regebro wrote:

 What we would like to do, of course, is to have a self-hosted github.
 :-)  (And that exists. Buuut... it costs $250 per commiter and
 year, so that's not an option, obviously.)

Just to be sure I keep the fire on: what about self-hosted Gitorious?
It's not as neat as Github, but you still have the same (similar)
forking/merging abilities than Github.

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope] MemoryError: out of memory

2011-01-26 Thread Jonathan Salazar Santos
Hi Comunity,

I have been in troubles with Zope2.10.5-final since 4 moths ago,
related to the MemoryError: out of memory (in the event.log), every
three or fourth days (more or less) the Zope starts to say in our web:
value error: Memory, and stops to serve some pages (not all), usually
the pages that serve file contents (to download, convert to pdf or
view online). I solve the problem (when appears) by rebooting the zope
server, but its not a solutions, because I dont know when the error
its coming ¿Can you help me to giving me some light to solve the
problem? I have 2gb of RAM, and the server (FreeBSD) it says
no-overloaded, just have 2 services, web(zope) and database(mysql). I
think its something related to the cache memory or kind of (I changed
some values in config file but not success). See some of my event.log


Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module OFS.DTMLMethod, line 144, in __call__
   - DTMLMethod at //index_html used for //suscribete/adminNewsletter
   - URL: http:///index_html/manage_main
   - Physical Path: //index_html
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module OFS.DTMLMethod, line 137, in __call__
   - DTMLMethod at //suscribete/adminNewsletter/third_header
   - URL: http:///suscribete/adminNewsletter/third_header/manage_main
   - Physical Path: //suscribete/adminNewsletter/third_header
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module DocumentTemplate.DT_In, line 703, in renderwob
  Module Products.MailHost.SendMailTag, line 114, in render
  Module Products.MIMETools.MIMETag, line 198, in render
  Module MimeWriter, line 177, in lastpart
MemoryError: out of memory


-- 
Lic. Jonathan Salazar
Saludos,
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-dev] Buggy zc.recipe.testrunner 1.4.0?

2010-10-13 Thread Jonathan Ballet
Hello,

I noticed that some of our tests started to fail due to missing
environment values in the test script generated by zc.recipe.testrunner.
Switching back the version from 1.4.0 to 1.3.0 fixed the issue.

So, I tried to run the tests of the 1.4.0 release (using the tarball
from Pypi), and I have a bunch of failures, which are summed in the
attached file (also available in http://pastebin.com/HtVk8sKX if the
mailing list doesn't allow attachments). My problem reflects in the
following test:

=
File 
/tmp/sb/zc.recipe.testrunner-1.4.0/src/zc/recipe/testrunner/README.txt,
line 487, in README.txt
Failed example:
cat(sample_buildout, 'bin', 'testdemo')
Expected:
#!python -S
BLANKLINE
import sys
sys.path[0:0] = [
'/sample-buildout/parts/testdemo/site-packages',
]
BLANKLINE
BLANKLINE
import os
path = sys.path[0]
if os.environ.get('PYTHONPATH'):
path = os.pathsep.join([path, os.environ['PYTHONPATH']])
os.environ['PYTHONPATH'] = path
import site # imports custom buildout-generated site.py
import os
sys.argv[0] = os.path.abspath(sys.argv[0])
os.chdir('/sample-buildout/parts/testdemo/working-directory')
os.environ['zc.recipe.testrunner'] = '42'
BLANKLINE
import zope.testrunner
BLANKLINE
if __name__ == '__main__':
zope.testrunner.run([
'--test-path', '/sample-buildout/demo',
])
Got:
#!python
BLANKLINE
import sys
sys.path[0:0] = [
'/sample-buildout/demo',
'/sample-buildout/eggs/zope.testrunner-X-pyN.N.egg',
'/sample-buildout/eggs/zope.interface-X-pyN.N.egg',
'/sample-buildout/eggs/zope.exceptions-X-pyN.N.egg',
'/sample-buildout/eggs/setuptools-X-pyN.N.egg',
]
BLANKLINE
BLANKLINE
import zope.testrunner
BLANKLINE
if __name__ == '__main__':
zope.testrunner.run([
'--test-path', '/sample-buildout/demo',
])
=

As you can see, the generated file misses the line
``os.environ['zc.recipe.testrunner'] = '42' ``.

Here is the content of bin/test generated by Buildout in the
zc.recipe.testrunner 1.4.0 directory (in case there are weird
dependencies):

=
#!/tmp/sb/zc.recipe.testrunner-1.4.0/../bin/python

import sys
sys.path[0:0] = [
'/tmp/sb/zc.recipe.testrunner-1.4.0/src',

'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zope.testrunner-4.0.0b5-py2.5.egg',

'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zope.interface-3.6.1-py2.5-linux-x86_64.egg',

'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zope.exceptions-3.6.1-py2.5.egg',

'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/setuptools-0.6c12dev_r85381-py2.5.egg',
'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zope.testing-3.10.0-py2.5.egg',

'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/z3c.recipe.scripts-1.0.1-py2.5.egg',
'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zc.buildout-1.5.2-py2.5.egg',
'/tmp/sb/zc.recipe.testrunner-1.4.0/eggs/zc.recipe.egg-1.3.2-py2.5.egg',
]


import zope.testrunner

if __name__ == '__main__':
zope.testrunner.run([
'--test-path', '/tmp/sb/zc.recipe.testrunner-1.4.0/src',
])
=

It seems to be a serious regression, so I guess I have something wrong
on my side, otherwise other people would have noticed it. What do I
miss?
Are there any public continuous integration reports for those projects?

Thanks,

 Jonathan
$ cd /tmp/
tmp$ virtualenv --no-site-packages --unzip-setuptools sb
New python executable in sb/bin/python2.5
Also creating executable in sb/bin/python
Installing setuptools.done.
tmp$ cd sb
sb$ wget http://pypi.python.org/packages/source/z/zc.recipe.testrunner/zc.recipe.testrunner-1.4.0.tar.gz
--2010-10-13 17:45:14--  http://pypi.python.org/packages/source/z/zc.recipe.testrunner/zc.recipe.testrunner-1.4.0.tar.gz
Résolution de pypi.python.org... 82.94.164.168, 2001:888:2000:d::a8
Connexion vers pypi.python.org|82.94.164.168|:80...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 27973 (27K) [application/x-gzip]
Sauvegarde en : «zc.recipe.testrunner-1.4.0.tar.gz»

100%[=] 27 973  --.-K/s   ds 0,08s   

2010-10-13 17:45:14 (325 KB/s) - «zc.recipe.testrunner-1.4.0.tar.gz» sauvegardé [27973/27973]

sb$ tar xf zc.recipe.testrunner-1.4.0.tar.gz 
sb$ cd zc.recipe.testrunner-1.4.0/
zc.recipe.testrunner-1.4.0$ ../bin/python bootstrap.py 
Creating directory

Re: [Zope] string formatting

2010-08-13 Thread Jonathan (dev101)
Something like:

 

dtml-call REQUEST.set('signumfix2', signum[0:1] +
_.str(_.int(signum[1:4])+1)



won’t work because you will turn B006 into B7

 

If you want to retain the leading zeros you will need to pad them. 

 

As Andreas said, this would be better done using a python script (which you
can call from dtml you don’t have to use zpt).

 

 

 

Jonathan

 

From: zope-boun...@zope.org [mailto:zope-boun...@zope.org] On Behalf Of Ebbe
Kvist
Sent: August-13-10 12:17 PM
To: zope@zope.org
Subject: [Zope] string formatting

 

Hi all,

I want to process a variable, signum2, which is picked up from a MySQL
database. The content of the variable is
B006.
The aim is to process this variable so the result will be 
B007 and it will then be saved as part of a new record in the database.
The core process is to increment the integer part of the variable 006 with
1.

I have successfully done this incrementation but I have not been able to
create a new 
correct content for the new varable new_xyz.

dtml-call REQUEST.set('signumfix2',signum2[1:4])
dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1)

How can I from here create the correct content of the new variable? I need
to bring the B part
with me and then the incremented integer part formatted with two preceeding
zeroes. Does anyone know?

Best regards,

Ebbe Kvist
Stockholm 

___
Hitta kärleken med hjälp av vårt matchningstest - Klicka här!
http://spray.matchaffinity.se/?mtcmk=614114 

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] zope.testing / zope.testrunner path forward:

2010-07-27 Thread Jonathan Lange
On Tue, Jul 20, 2010 at 5:32 PM, Lennart Regebro rege...@gmail.com wrote:
 I'd like to put down some effort this week during the EuroPython
 sprint to go forward with zope.testing for Python 3. zope.testing
 3.9.5 is already deprecating zope.testing.testrunner, but I need to
 remove it so that I can port zope.testing to Python 3 without going
 mad. (zope.testrunner runs on Python 3 already, although installing it
 fails, because it tries to install zope.testing 3.9.5.)

Hi Lennart,

Just to be clear, is zope.testing 4.0.0 intended to work with Python 2?

I'll try to get around to trying 3.10.0 with Launchpad rsn.

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] ./bin/test failing with trunk zope.testing

2010-07-18 Thread Jonathan Lange
Hello,

When running zope.testing's tests on my laptop, I get many failures.
I've run the tests plenty of times before and haven't got these
failures. Am a bit mystified, so I'd appreciate any help.

jml
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.


Failure in test 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging-layer-setup.test
Traceback (most recent call last):
  File /usr/lib/python2.6/unittest.py, line 279, in run
testMethod()
  File /home/jml/src/zope.testing/trunk/src/zope/testing/doctest/__init__.py, 
line 2249, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
DocTestFailureException: Failed doctest test for 
testrunner-debugging-layer-setup.test
  File 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging-layer-setup.test,
 line 0

--
File 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging-layer-setup.test,
 line 100, in testrunner-debugging-layer-setup.test
Failed example:
try:
zope.testing.testrunner.run_internal(
  ['--path', dir, '-Dvv', '--tests-pattern', 'tests2'])
finally: sys.stdin = real_stdin
# doctest: +ELLIPSIS +REPORT_NDIFF
Differences (ndiff with -expected +actual):
  Running tests at level 1
  Running tests2.Layer1 tests:
Set up tests2.Layer1 in N.NNN seconds.
Running:
   a_test (tests2)
Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
  Running tests2.Layer2 tests:
Tear down tests2.Layer1 ... not supported
Running in a subprocess.
Set up tests2.Layer2
  **
  BLANKLINE
  Can't post-mortem debug when running a layer as a subprocess!
  Try running layer 'tests2.Layer2' by itself.
  BLANKLINE
  **
  BLANKLINE
  Traceback (most recent call last):
- ...
+   File 
/home/jml/.buildout/eggs/zope.testrunner-4.0.0b4-py2.6.egg/zope/testrunner/runner.py,
 Line NNN, in run_layer
+ setup_layer(options, layer, setup_layers)
+   File 
/home/jml/.buildout/eggs/zope.testrunner-4.0.0b4-py2.6.egg/zope/testrunner/runner.py,
 Line NNN, in setup_layer
+ layer.setUp()
+   File /tmp/tmprTh_Qv/TESTS-DIR/tests2.py, Line NNN, in setUp
  raise ValueError
  ValueError
  BLANKLINE
  BLANKLINE
  Tests with errors:
-runTest (zope.testing.testrunner.runner.SetUpLayerFailure)
? 
+runTest (zope.testrunner.runner.SetUpLayerFailure)
  Total: 1 tests, 0 failures, 1 errors in N.NNN seconds.
  True


--Return--
 /home/jml/src/zope.testing/trunk/src/zope/testing/doctest/__init__.py(360)set_trace()-None
- pdb.Pdb.set_trace(self)
(Pdb) p x
*** NameError: NameError(name 'x' is not defined,)
(Pdb) c


Failure in test 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging.txt
Traceback (most recent call last):
  File /usr/lib/python2.6/unittest.py, line 279, in run
testMethod()
  File /home/jml/src/zope.testing/trunk/src/zope/testing/doctest/__init__.py, 
line 2249, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
DocTestFailureException: Failed doctest test for testrunner-debugging.txt
  File 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging.txt,
 line 0

--
File 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-debugging.txt,
 line 35, in testrunner-debugging.txt
Failed example:
try: testrunner.run_internal(defaults)
finally: sys.stdin = real_stdin
# doctest: +ELLIPSIS
Expected:
Running zope.testing.testrunner.layer.UnitTests tests:
...
 testrunner-ex/sample3/sampletests_d.py(NNN)test_set_trace1()
- y = x
(Pdb) p x
1
(Pdb) c
  Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
...
False
Got:
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in N.NNN seconds.
  Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
Tearing down left over layers:
  Tear down zope.testing.testrunner.layer.UnitTests in N.NNN seconds.
False


--Return--
 /home/jml/src/zope.testing/trunk/src/zope/testing/doctest/__init__.py(360)set_trace()-None
- pdb.Pdb.set_trace(self)
(Pdb) p x
*** NameError: NameError(name 'x' is not defined,)
(Pdb) c


Failure in test 
/home/jml/src/zope.testing/trunk/src/zope/testing/testrunner/testrunner-edge-cases.txt
Traceback (most recent call last):
  File /usr/lib/python2.6/unittest.py, line 279, in run
testMethod()
  File 

Re: [Zope-dev] ./bin/test failing with trunk zope.testing

2010-07-18 Thread Jonathan Lange
On Sun, Jul 18, 2010 at 5:56 PM, Hanno Schlichting ha...@hannosch.eu wrote:
 Hi.

 On Sun, Jul 18, 2010 at 5:50 PM, Jonathan Lange j...@mumak.net wrote:
 When running zope.testing's tests on my laptop, I get many failures.
 I've run the tests plenty of times before and haven't got these
 failures. Am a bit mystified, so I'd appreciate any help.

 Looks like the tests assume to be run under the zope.testing.testrunner:

 -    runTest (zope.testing.testrunner.runner.SetUpLayerFailure)
 ?                 
 +    runTest (zope.testrunner.runner.SetUpLayerFailure)

 but you end up with the one from zope.testrunner. If you pin
 zc.recipe.testrunner to version 1.2.0, that should do the trick for
 now.

 Someone should look into making the tests compatible with both
 testrunners or requiring the new zope.testrunner.


Thanks.

Actually, it turned out to be something of a pebkac. I was getting
trunk from the old Launchpad branch
(lp:~vcs-imports/zope.testing/trunk) rather than the new Launchpad
branch (lp:zope.testing).

With the new branch, everything works out of the box. Sorry for the noise.

While we're here, if I want to patch the Zope testrunner, should I
submit patches against zope.testing or zope.testrunner?

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.testing 4.0.0 coming up.

2010-04-27 Thread Jonathan Lange
On Tue, Apr 27, 2010 at 8:30 PM, Lennart Regebro rege...@gmail.com wrote:
 I've been working on zope.tetsing lately. The main impetus behind this
 is Python 3 compatibility, but also general cleanup. This work was
 discussed on #zope bu Jim Fulton, Stephan Richter,  Charlie Clark and
 me. The conclusion was to release a backwards incompatible
 zope.testing 4.0.0.

...
 Questions? :)


Is it too late for me to introduce another mildly backwards
incompatible change?

I'd like to add a method to OutputFormatter to handle the specific
case of layer setup/teardown failing and change the rest of the runner
to call that instead of error.

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.testrunner (Was: Circular dependency hell.)

2010-04-21 Thread Jonathan Ballet
Hi Lennart,

On Mon, Apr 19, 2010 at 2:42 PM, Jonathan Ballet
jonathan.bal...@securactive.net wrote:
 Hi,

 On Mon, Apr 19, 2010 at 1:03 PM, Lennart Regebro rege...@gmail.com wrote:
 OK, I made a branch of zope.testing that doesn't include the
 testrunner. That was easy peasy.

 http://svn.zope.org/zope.testing/branches/regebro-notestrunner/

 And I made a zope.testrunner:

 http://svn.zope.org/zope.testrunner/trunk

 That was pretty easy too. Except one thing: The shuffle feature
 shuffles things differently in zope.testrunner compared to in
 zope.testing.testrunner, which seems to be because it finds the layers
 in a different order.

I took some time to look at this yesterday, and it seems you were
right: the order should have changed since the layers now have a
different name.

I can't speak for other people who are using the feature, but this
will not affect us very much. We use the shuffle seed feature for two
cases:

 * we want to reproduce on a developer computer a test run which has
failed on the Buildbot;
 * while reviewing someone's code, if tests are failing on a computer
but not on another, we want to provide a way for tests to fail the
same way on both computers, by pinning the order.

Both cases have a short life time (we don't need to reproduce a
particular order from X months ago), so this change is OK for us.

Regards,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.testrunner (Was: Circular dependency hell.)

2010-04-19 Thread Jonathan Ballet
Hi,

On Mon, Apr 19, 2010 at 1:03 PM, Lennart Regebro rege...@gmail.com wrote:
 OK, I made a branch of zope.testing that doesn't include the
 testrunner. That was easy peasy.

 http://svn.zope.org/zope.testing/branches/regebro-notestrunner/

 And I made a zope.testrunner:

 http://svn.zope.org/zope.testrunner/trunk

 That was pretty easy too. Except one thing: The shuffle feature
 shuffles things differently in zope.testrunner compared to in
 zope.testing.testrunner, which seems to be because it finds the layers
 in a different order.

 Anybody using the shuffle feature with seeds in their tests, so we can
 make sure it still actually works?

I wrote the shuffle feature in the first place and we are sometimes
using it here. I won't have time today, but I can take a look tomorrow
I guess (I need to catch up with the Circular dependency hell thread
and with zope.testrunner first, though).

Regards,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] RFC: Proposed new style for documenting and testing ZTK packages

2010-04-19 Thread Jonathan Lange
On Mon, Apr 19, 2010 at 3:03 PM, Lennart Regebro rege...@gmail.com wrote:
 On Mon, Apr 19, 2010 at 15:48, Marius Gedminas mar...@gedmin.as wrote:
 If you've the discipline to keep the doctests short, I don't see why you
 shouldn't continue writing them instead of unit tests

 Because they are a bitch to debug, relies on details of output, which
 makes them brittle, hard to port to Python 3, and can be tricky to set
 up with loads of subtle things like inheriting the environment from
 where the DocTest was created, etc.


You may wish to read:
  http://bemusement.org/diary/2008/October/23/narrative-tests
  http://bemusement.org/diary/2008/October/24/more-doctest-problems

which are an extended meditation on the whole topic.

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] KGS 3.4.1 versions

2010-04-19 Thread Jonathan Ballet
On Thu, Apr 15, 2010 at 12:29 PM, Adam GROSZER agros...@gmail.com wrote:
 Hello,

 There is a sheet with versions for KGS 3.4.1
 http://spreadsheets.google.com/pub?key=tUE5Q72d4Kg1FXaacCA3EKQoutput=html

 Anyone for/against those versions?

Tres Seaver just released zope.securitypolicy 3.4.4 (3.4.3 was buggy).
There was a subtle bug, which was triggered if you used
zope.securitypolicy's security policy without having zope.dublincore
package already loaded.
See https://bugs.launchpad.net/bugs/564525 for more informations.

Could I suggest you to include this version (3.4.4) in Zope KGS 3.4.1 ?

Thanks,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] RFC: Proposed new style for documenting and testing ZTK packages

2010-04-19 Thread Jonathan Lange
On Mon, Apr 19, 2010 at 6:42 PM, Marius Gedminas mar...@gedmin.as wrote:
 On Mon, Apr 19, 2010 at 03:56:02PM +0200, Wichert Akkerman wrote:
 On 4/19/10 15:48 , Marius Gedminas wrote:
       def doctest_MyClass_bar():
           Test MyClass.bar
 
                 y = MyClass()
 
            The bar method peforms a bar calculation that typically returns
            twenty-three:
 
                 y.bar()
               23
 
           

 What is the advantage of that over:

      def test_something(self):
           # Test MyClass.bar

           y=MyClass()

 *cringe*

 Sorry, I've this reflex to cringe every time I see a PEP-8 violation.


           # The bar method peforms a bar calculation that typically
           # returns 23.

           self.assertEqual(y.bar(), 23)

 It reads the same, and as a bonus you can step through it with pdb and
 syntax highlighting works normally in most editors.

 The advantage is that I've rarely seen comments in unit tests and
 personally I never felt compelled to write a comment when writing a unit
 test.


Twisted and Launchpad both have policies that require new or modified
unit tests to have comments, enforced as a part of our respective
review processes. This seems to work well, since the reviewer can
block silly comments.

The documentation you get is more like a list of requirements /
behaviours (e.g. We raise an error when we try to create a branch in
a namespace where there is already a branch of the same name) than a
story, but sometimes that's a good thing. It's surprising how easy it
is to slip into the habit.

It's no substitute for tutorial / howto documentation, but is often a
great supplement to API docs.

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Circular dependency hell.

2010-04-16 Thread Jonathan Lange
On Fri, Apr 16, 2010 at 6:05 PM, Lennart Regebro rege...@gmail.com wrote:
...
 == Suggestion 1 ==

 I think we should deprecate zope.testing. Completely. There has been
 some discussion about deprecating it for something else, but I think
 we should just deprecate it. Just say Don't use zope.testing, it's
 pure evil. We can recommend another testrunner, and it seems nose is
 winning the wars in the Python world there, but I don't think we
 necessarily need to do that. Most testrunners will find the tests by
 themselves, and the tests should be runnable with any testrunner, so
 which one you use is a minor issue.

As the author of one of those other testrunners, I can tell you that
if you do this you'll find that your number one biggest problem is
getting layers to work.

 But zope.testing is a mess that builds on
 two other messes, namely unittest (yes, it's a bloody mess, the API
 makes no sense) and doctest (which is a horror of a mess).

unittest's API makes sense and it's not a mess. It's got problems, but
they are defects and not bone-deep. Further, the current maintainer of
unittest, Michael Foord, has been doing some excellent work in
addressing those defects.

The testing-in-python mailing list[1] is probably the best place to
take up the issue if you wish to do so.

jml

[1] http://lists.idyll.org/listinfo/testing-in-python
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] zope.app.component broken with zope.component 3.8.0 and greater?

2010-04-11 Thread Jonathan Lange
Hello,

I'm trying to update my application to use the recent patch that Tres
Seaver helpfully landed on zope.app.testing.

The new zope.app.testing seems to require a new zope.component, since
it's importing hooks from z.component rather than zope.site.

However, when I update zope.component, I get the following error from
zope.app.component:

Traceback (most recent call last):
...
  File 
.../zope.app.component-3.8.3-py2.5.egg/zope/app/component/metaconfigure.py,
line 15, in module
from zope.component.zcml import PublicPermission, _checker, view, resource
ImportError: cannot import name PublicPermission

It appears that r83 of lp:zope.component moves PublicPermission from
zope.component.zcml to zope.component.security.

Now, my app is only using metaconfigure in this instance to get at
PublicPermission and view, so I might as well import them from
zope.component directly, solving my immediate problem.

However, this still leaves zope.app.component broken with new
zope.component releases.

I can't find the code for zope.app.component on Launchpad, but the fix
seems pretty simple – import PublicPermission from
z.component.security.

It seems to me that zope.component is also broken, since moving
PublicPermission to a new module breaks backwards compatibility. I've
attached a patch that goes some way to fixing this.

More generally, I'm a bit worried that this attempt of mine to upgrade
the zope.testing that my app uses is going to result in a cascade of
dependency upgrades, each with their own little backwards
compatibility problems. What sort of expectations should I have? e.g.
Do the version numbers tell me anything about intended compatibility?

Thanks,
jml
=== modified file 'src/zope/component/zcml.py'
--- src/zope/component/zcml.py	2010-04-06 03:01:29 +
+++ src/zope/component/zcml.py	2010-04-11 14:24:49 +
@@ -30,7 +30,7 @@
 try:
 from zope.component.security import _checker, proxify, protectedFactory, \
 securityAdapterFactory
-from zope.security.zcml import Permission
+from zope.security.zcml import Permission, PublicPermission
 except ImportError:
 SECURITY_SUPPORT = False
 from zope.schema import TextLine as Permission

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] [PATCH] Better error support in subunit output formatter

2010-04-10 Thread Jonathan Lange
Hello,

The subunit output formatter that was added recently currently raises
NotImplementedError when it's given a generic error. The error()
method on formatters is used to communicate user error (e.g. when the
user selects incompatible options), internal framework errors (afaict,
only when there's a subprocess read error) and layer setUp errors.

I find the idea of masking layer setUp errors to be unconscionably
awful, so I've attached the following patch, which changes the subunit
formatter's error() method to print out whatever it gets. It doesn't
have any tests, but it's simple enough, and none of the other
formatters have tests for this method either.

Ideally, I think there should be a new method on OutputFormatter to
handle layer setup failure. Probably teardown failure too. If someone
wants to push back on this simple patch in favour of a new method, I
could probably be persuaded to do the work, provided I had clear
backwards compatibility guidelines.

jml
=== modified file 'src/zope/testing/testrunner/formatter.py'
--- src/zope/testing/testrunner/formatter.py	2010-04-06 03:02:54 +
+++ src/zope/testing/testrunner/formatter.py	2010-04-10 15:27:41 +
@@ -795,8 +795,7 @@
 Report an error.
 # XXX: Mostly used for user errors, sometimes used for errors in the
 # test framework, sometimes used to record layer setUp failure (!!!).
-# How should this be encoded?
-raise NotImplementedError(self.error)
+self._stream.write('%s\n' % (message,))
 
 def error_with_banner(self, message):
 Report an error with a big ASCII banner.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] [PATCH] zope.app.testing: Use doctest instead of deprecated zope.testing.doctest

2010-04-10 Thread Jonathan Lange
Hello,

Recent versions of zope.testing deprecate the zope.testing.doctest
module in favour of the standard library's doctest module.
zope.app.testing currently uses zope.testing.doctest for its tests and
to provide its functional testing features. This patch changes it to
use standard library doctest.

The patch also deletes a repeated import line from
zope.app.testing.functional, caught thanks to pyflakes.

jml
=== modified file 'src/zope/app/testing/functional.py'
--- src/zope/app/testing/functional.py	2009-11-19 16:31:33 +
+++ src/zope/app/testing/functional.py	2010-04-10 17:38:33 +
@@ -18,6 +18,7 @@
 $Id: functional.py 105881 2009-11-19 16:31:33Z tlotze $
 
 import copy
+import doctest
 import logging
 import os.path
 import re
@@ -39,7 +40,6 @@
 from zope.publisher.publish import publish
 from zope.publisher.skinnable import setDefaultSkin
 from zope.security.interfaces import Forbidden, Unauthorized
-from zope.testing import doctest
 
 import zope.app.appsetup.product
 import zope.app.testing.setup
@@ -47,7 +47,6 @@
 from zope.app.debug import Debugger
 from zope.app.publication.http import HTTPPublication
 from zope.app.publication.zopepublication import ZopePublication
-from zope.app.publication.http import HTTPPublication
 from zope.app.publication.httpfactory import chooseClasses
 from zope.component.hooks import setSite, getSite
 

=== modified file 'src/zope/app/testing/tests.py'
--- src/zope/app/testing/tests.py	2009-07-24 14:04:31 +
+++ src/zope/app/testing/tests.py	2010-04-10 17:39:57 +
@@ -15,12 +15,12 @@
 
 $Id: tests.py 102244 2009-07-24 14:04:31Z srichter $
 
+from doctest import DocTestSuite
 import os
 import re
 import unittest
 import StringIO
 
-from zope.testing.doctestunit import DocTestSuite
 from zope.testing.renormalizing import RENormalizing
 from zope.component import getAllUtilitiesRegisteredFor
 from ZODB.interfaces import IDatabase

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [PATCH] Better error support in subunit output formatter

2010-04-10 Thread Jonathan Lange
On Sat, Apr 10, 2010 at 7:16 PM, Tres Seaver tsea...@palladion.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Jonathan Lange wrote:
 Hello,

 The subunit output formatter that was added recently currently raises
 NotImplementedError when it's given a generic error. The error()
 method on formatters is used to communicate user error (e.g. when the
 user selects incompatible options), internal framework errors (afaict,
 only when there's a subprocess read error) and layer setUp errors.

 I find the idea of masking layer setUp errors to be unconscionably
 awful, so I've attached the following patch, which changes the subunit
 formatter's error() method to print out whatever it gets. It doesn't
 have any tests, but it's simple enough, and none of the other
 formatters have tests for this method either.

 Ideally, I think there should be a new method on OutputFormatter to
 handle layer setup failure. Probably teardown failure too. If someone
 wants to push back on this simple patch in favour of a new method, I
 could probably be persuaded to do the work, provided I had clear
 backwards compatibility guidelines.

 Your patches look pretty reasonable to me:  can you kick them into
 Launchpad so they don't get lost in the mailing list archives?  There is
 a project page for zope.app.testing, but it doesn't (as of today) have
 the bug tracker turned on.

  https://launchpad.net/zope.app.testing


Branches pushed, merge proposals created, bugs filed, branches linked.

FWIW, I sent to the mailing list first because last time I tried this
I filed bugs, pushed up branches etc. and didn't get any response
until I posted patches to the ML :)

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Summary of this weeks' meeting (2010-03-30)

2010-03-31 Thread Jonathan Ballet
Hi,

On Wed, Mar 31, 2010 at 5:16 PM, Christian Theune c...@gocept.com wrote:

 For those of you who can't/don't participate in those meetings, there's
 the open question about how useful you consider my summaries to be.
 Please tell!

I like to read those summaries, since they gave me an quick insight of
what's going on in Zope world. Thanks!

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [PATCH] subunit output for zope.testing

2010-03-11 Thread Jonathan Lange
On Thu, Mar 11, 2010 at 9:17 PM, Marius Gedminas mar...@gedmin.as wrote:
 On Thu, Mar 11, 2010 at 08:52:11PM +, Jonathan Lange wrote:
 For a long time, I've wanted to have a subunit output formatter for
 zope.testing. Subunit is a language-generic streaming protocol for
 test results. Once a test runner can display subunit output, it
 becomes much easier to write tools to process output programmatically.
 We want to use it in the Launchpad project for analyzing test results
 and for distributing our test runs across multiple machines. Other
 projects use it to get Hudson integration, or to glue their
 multi-language test suite into one result.

 I like this.


Thanks.

 Incidentally, how do you integrate it with Hudson?  subunit2junitxml, I
 assume?  How exactly do you combine bin/test with subunit2junitxml -- I
 assume some care with respect to exit codes?


I haven't tried myself, but from analogy with other subunit tools:
  ./bin/test --subunit | subunit2junitxml

The formatter doesn't control exit codes, so I didn't really think
about them in this patch. Should I produce a follow up?

 === modified file 'src/zope/testing/testrunner/formatter.py'
 --- src/zope/testing/testrunner/formatter.py  2009-12-23 21:21:53 +
 +++ src/zope/testing/testrunner/formatter.py  2010-03-11 20:29:26 +
 ...
 +    def __init__(self, options):
 +        if subunit is None:
 +            raise Exception(Requires subunit 0.0.4 or better)
 +        if content is None:
 +            raise Exception(Requires testtools XXX or better)

 This seems a mite imprecise (unless testtools uses roman numerals for
 version numbering).


Oops :) I've changed it to say 0.9.2, and subunit to say 0.0.5, which
is the actual version I've tested with.

 === modified file 'src/zope/testing/testrunner/testrunner-leaks.txt'
 --- src/zope/testing/testrunner/testrunner-leaks.txt  2008-05-05 18:50:48 
 +
 +++ src/zope/testing/testrunner/testrunner-leaks.txt  2010-02-20 22:23:32 
 +
 @@ -16,7 +16,7 @@
       from zope.testing import testrunner

       sys.argv = 'test --layer Layer11$ --layer Layer12$ -N4 -r'.split()
 -     _ = testrunner.run(defaults)
 +     _ = testrunner.run_internal(defaults)

 I'm curious about this change.


Sidnei explained it correctly. This particular file is only tested if
you're running a Python with --with-pydebug set, so it's easy to miss
when you make a change.

jml
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] unable to acquire commit lock

2010-02-24 Thread Jonathan (dev101)
Just a guess, but it looks like you are trying to get a transaction lock on
a mysql table, so does the mysql table you are using have a storage engine
that supports transactions (eg. InnoDB)?

 

Jonathan

 

From: zope-boun...@zope.org [mailto:zope-boun...@zope.org] On Behalf Of
iarly selbir | ski0s
Sent: February-24-10 8:12 AM
To: zope@zope.org
Subject: [Zope] unable to acquire commit lock

 

few days ago my I'm getting this errors when trying logging on /manage,
googling I don't found any reasonable solution and/or  information about,
only thing was, restarting zope instances works, thats true

 

 

Traceback:

 

2010-02-24T09:43:09 ERROR Zope.SiteErrorLog
http://www.mywebsite.com/login_form

Traceback (innermost last):

  Module ZPublisher.Publish, line 125, in publish

  Module Zope2.App.startup, line 238, in commit

  Module transaction._manager, line 96, in commit

  Module transaction._transaction, line 395, in commit

  Module transaction._transaction, line 498, in _commitResources

  Module ZODB.Connection, line 726, in tpc_vote

  Module relstorage.relstorage, line 711, in tpc_vote

  Module relstorage.relstorage, line 686, in _vote

  Module relstorage.relstorage, line 593, in _prepare_tid

  Module relstorage.adapters.mysql, line 506, in start_commit

  Module relstorage.adapters.mysql, line 672, in _hold_commit_lock

StorageError: Unable to acquire commit lock

 

 

 

I looked at the code and this function _hold_commit_lock has the following
SELECT statement:

 

SELECT GET_LOCK(CONCAT(DATABASE(), '.commit'), %s)

 

I tried to reproduce it querying manually but  it looks like an unknown
command, and other point, I don't know what Zope put in %s variable.

 

 

 

Does anybody already had this problem?

 

 

Thanks for any reply.

 


Regards,

- -
iarlyy selbir | ski0s

:wq!

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] generate unique user id, without cookies

2010-01-04 Thread Jonathan (dev101)
 after having some weird issues with Sessions and ZEO usage I've found
 out part of the problem.
 It turns out certain browsers (IE6 mostly) save the session ID cookies,
 but sometimes these disappear. This results in a new _ZopeId being
 generated and thus the new session is empty.

 At first i thought it was a session product problem, but in recreating
 this with my own session management (mysql based) the same issue arises.

 I don't know why this happens, the only obstacle I'm facing now is to
 create an adequate solution ;)

The cookie approach should work.  You should be able to set persistent 
cookies on the client browsers (unless the browser has cookies disabled, in 
which case you should tell the user that they must enable cookies if they 
want to proceed).

If you can't set persistent cookies then it could be due to a cross-browser 
scripting problem (ie. you are setting a cookie within an iframe that is 
loaded from a third-party site) or you are not setting the appropriate 
fields in the cookie to make it persistent.

You should try to investigate the cause of the cookie disappearance (use a 
tool to look at the http headers that are sent/received).

If you can't get cookies to work then you need to give users unique links 
(ie. embed their id in an html link) or force the users to log in.


Jonathan 

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-12-18 Thread Jonathan Ballet
Hi,

On Fri, Dec 18, 2009 at 1:51 PM, Christian Theune c...@gocept.com wrote:

 Reviewed and merged.

 I made some minor textual changes, otherwise that code was fine.

Thank you Christian!
BTW, the Pypi page for zope.testing is a bit broken currently (the
HTML has not been generated), can you fix this too?

Regards,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] Finding unused products

2009-11-30 Thread Jonathan (dev101)

- Original Message - 
From: Tres Seaver tsea...@palladion.com
To: zope@zope.org
Sent: Sunday, November 29, 2009 4:05 PM
Subject: Re: [Zope] Finding unused products


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Gaute Amundsen wrote:
 On Sun, 2009-11-29 at 12:32 +0100, Jens Vagelpohl wrote:
 On Nov 29, 2009, at 11:59 , Gaute Amundsen wrote:

 Quick question before I reinvent.

 Is there some established way of finding products which have no
 instances in zodb, and can be safely removed?
 No there isn't. You may have to invest some time writing a script that
  visits all objects to find out what products they belong to. It may
  not be worth the effort.

 jens

 Unfortunately it has not been worth the effort for a number of years,
 but now it has become unavoidable.
 Walking the tree it is then.

 You could probably work directly with the pickles way faster than
 activating every object in a large site:  look at the 'fsdump' script
 for clues.

You could also write a stand-alone python routine to access the zodb (.fs 
file) directly (should be faster than running a script through a running 
zope instance and maybe easier than working with pickles).

Jonathan

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-11-23 Thread Jonathan Ballet
Hello,

On Tue, Nov 3, 2009 at 11:21 AM, Jonathan Ballet
jonathan.bal...@securactive.net wrote:
 Hello Christian,

 On Tue, Nov 3, 2009 at 11:07 AM, Christian Theune c...@gocept.com wrote:
 [...] btw: do you log the seed if
 you generated one?)

 Yep, the seed is displayed at the end of tests, so that it can be
 reused to reproduce a failing test.

    $ ./bin/test --shuffle -cvvv
    Running tests at level 1
    Running zope.testing.testrunner.layer.UnitTests tests:
      Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
      ...
      Ran 257 tests with 0 failures and 0 errors in 21.908 seconds.
    Tests were shuffled using seed number 321854366611

Any thoughts on this feature? Did someone try it?
Is there any possibilities to merge this into trunk and to release a
new version with this?

Cheers,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Relative path support for z3c.recipe.paster?

2009-11-04 Thread Jonathan Ballet
Hi,

Since zc.recipe.egg 1.2.0, there's an option to generate scripts which
contains relative paths to eggs installed in the eggs/ directory [1]
This is very handy if you want to move your buildout around, without
needing to relaunch the whole buildout process.

What do maintainers of z3c.recipe.paster think if I propose a patch
which add this option (or something else) to support the same thing
for this recipe?
Actually, this can be a relatively minor change, since the recipe
already use zc.recipe.egg, which means it only has to pass the
corresponding option to this one.

Thoughts?

Cheers,

 Jonathan

[1] : http://pypi.python.org/pypi/zc.recipe.egg#relative-egg-paths
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Relative path support for z3c.recipe.paster?

2009-11-04 Thread Jonathan Ballet
Hi Roger,

On Wed, Nov 4, 2009 at 5:15 PM, Roger Ineichen d...@projekt01.ch wrote:
 Hi Jonathan

 In general any improvment is welcome as long as there is no bad
 sideffect. I do not know this option and do not understand what
 you mean with moving buildout around.

By moving buildout around, I mean: I generate a buildout in a
directory, let's say /home/foo/prod/1.0 on the host FOO, and I would
like to be able to copy the result of the buildout on the host BAR, in
the directory /var/run/bar/ and be able to just run ./bin/paster and
voilà!
That's why I would like to have relative paths.

 Anyway, if there is no sideffect like larger processing time
 in prodction use just for provide a fancy feature, you are very
 welcome to improve and implement usefull things ;-)

Ok, I don't think the modification will have such side effects, so I
will propose a patch for this then :)

Cheers,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-11-03 Thread Jonathan Ballet
Hello Christian,

On Tue, Nov 3, 2009 at 11:07 AM, Christian Theune c...@gocept.com wrote:
 [...] btw: do you log the seed if
 you generated one?)

Yep, the seed is displayed at the end of tests, so that it can be
reused to reproduce a failing test.

$ ./bin/test --shuffle -cvvv
Running tests at level 1
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
  ...
  Ran 257 tests with 0 failures and 0 errors in 21.908 seconds.
Tests were shuffled using seed number 321854366611

I already find it *very* useful ...

Cheers,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-10-19 Thread Jonathan Ballet
Hello there,

as I mentioned by Sebastien, the patch has been commited into the
sdouche-shuffle branch. It now has tests and a bit of documentation
too.

Regarding CLI arguments, I'm not sure this could be changed like
Christian proposed. If you know how to do it, I'm listening, 'cause I
don't know! :)

I have one more thing I would like to discuss: how should this feature
behave with the --repeat feature?
Currently, the shuffling is done before the repeat feature. This means
that tests will *not* get reordered for each loop (just once, at the
very beginning of tests launching).
I know how to do it, so that for each loop, tests will get a different
order (basically, I would propose to wrap the __iter__() method of the
TestSuite used to launch tests, and to shuffle here):

class ShuffledTestSuite(unittest.TestSuite):
def __iter__(self):
tests = list(super(Shuffled, self))
seed = long(time.time() * 256)
shuffler = random.Random()
shuffler.shuffle(tests)
return iter(tests)

However, using this means we would loose the seed printing (which
seems very convenient to me). I'm not sure if we could get it and
print it for each loop...


Reviews, comments and feedbacks are welcome!
Cheers,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] Prevent a logger from writing to event.log

2009-10-16 Thread Jonathan (dev101)

- Original Message - 
From: Bert Vanderbauwhede batlock...@gmail.com
To: zope@zope.org
Sent: Friday, October 16, 2009 8:07 AM
Subject: [Zope] Prevent a logger from writing to event.log


 Hi,

 Is it possible to have a logger in Zope that doesn't write to the
 event.log?  All the other loggers can write to the event.log, but just 
 this
 one logger should not.

You can easily build your own:  we use an external method that any routine 
can call to log an event.  In one use case we log user actions/activity and 
the log file is actually a MySQL database (we do this so that we can 
retrieve, in real-time, previous user actions which we then use to customize 
what is presented to the user).

The advantage of rolling your own is that you can log whatever you want, 
in whatever format you need, whenever/wherever you need it.


Jonathan

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-10-09 Thread Jonathan Ballet
Hey,

On Fri, Oct 9, 2009 at 2:33 PM, Christian Theune c...@gocept.com wrote:
   * --shuffle to randomize the order of the tests in a layer (layers
 are not yet randomized, I didn't look at it yet);
   * --shuffle-seed XXX, to initialize the RNG with a specific value,
 which allows to reproduce a specific randomization of tests (inspired
 by this thread 
 http://lists.idyll.org/pipermail/testing-in-python/2009-April/001812.html
 )

 Sounds right. It could even be folded into a single option:

 --shuffle[=XXX]

I'm not sure how to do that, considering those use cases:

 * the user doesn't want to shuffle its tests and so, doesn't set --shuffle
 * the user want to shuffle its tests, without specifying an order,
and use --shuffle
 * the user want to shuffle its tests in specific order, and use --shuffle=42

If I want this option to have an optional value, I think I must set a
default value to the option. But then, how to make the distinction
between the two first cases? I might miss something I don't know in
option parsing, but I didn't find anything...

 It's not yet ready-to-commit: it still misses tests (tricky to write)
 and more documentation.

 That's what working branches are for. You do have commit rights, don't you?

I don't (personally) have commit rights, but my boss (sdouche) has.
I'll see with him.


Thanks for your advices!

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-10-09 Thread Jonathan Ballet
Hi,

On Fri, Oct 9, 2009 at 3:30 PM, Benji York be...@zope.com wrote:
 On Fri, Oct 9, 2009 at 8:51 AM, Jonathan Ballet
 jonathan.bal...@securactive.net wrote:
 If I want this option to have an optional value, I think I must set a
 default value to the option. But then, how to make the distinction
 between the two first cases? I might miss something I don't know in
 option parsing, but I didn't find anything...

 I'd try the same approach as default options in Python functions.  Make
 the default None (which isn't a valid seed) and then you can tell the
 difference.

That's what I originally though, but then, how can I make the
difference between 'the user has not set --shuffle' (the option's
value is then None), and 'the user has set the --shuffle option, but
without specifying a seed' (then the option's value is None again)?

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Testrunner option for running tests in random order?!?

2009-10-08 Thread Jonathan Ballet
Hi Christian,

On Fri, Oct 2, 2009 at 2:00 PM, Christian Theune c...@gocept.com wrote:
 Hi,

 I *thought* the test runner had a feature to run tests in randomized
 order, but I can't find it. Is that something that Zope 2 had and that
 was never ported to zope.testing?

 I couldn't find in the history either.

 /me is confused.

I was about to send the same mail today, but I found out your mail before.

I didn't find anything relative to random tests in Zope 2 (but I'm not
familiar at all with Zope 2, so I'm pretty sure I could have missed
something), and I ended up writing a new feature for zope.testing's
testrunner.

I made a branch 'shuffle-tests', available on the Mercurial repository
at http://bitbucket.org/multani/zope.testing-shuffle/ , which adds two
new options:
  * --shuffle to randomize the order of the tests in a layer (layers
are not yet randomized, I didn't look at it yet);
  * --shuffle-seed XXX, to initialize the RNG with a specific value,
which allows to reproduce a specific randomization of tests (inspired
by this thread 
http://lists.idyll.org/pipermail/testing-in-python/2009-April/001812.html
)

It's not yet ready-to-commit: it still misses tests (tricky to write)
and more documentation.
However, feedbacks are welcome!

Cheers,

 Jonathan
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] apache rules with zope

2009-09-04 Thread Jonathan (dev101)

- Original Message - 
From: Thomas Bennett bennet...@appstate.edu
To: zope@zope.org
Sent: Friday, September 04, 2009 2:58 PM
Subject: [Zope] apache rules with zope


I can access two directories in /var/www but not two others.
 I have this rule in httpd.conf before the rewrite rules for Zope:

 RewriteCond %{REQUEST_URI} !^/(usage|zusage|ead2002|asu_ead)

 The usage and zusage directories work, that is /usage goes to the
 /var/www/usage directory not looking on Zope/ZODB.  Same with the zusage
 directory.  But ead2002 and asu_ead directories give a Not Found error 
 from
 Zope.  The Alias  and Directory tags in httpd.conf are the same for all 
 four.


You don't usually access underlying file directories directly from zope 
unless you are using external methods or an add-on product like ExtFile.

How are you trying to access these directories?


Jonathan 

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] apache rules with zope

2009-09-04 Thread Jonathan (dev101)

- Original Message - 
From: Thomas Bennett bennet...@appstate.edu
To: Jonathan (dev101) dev...@magma.ca
Sent: Friday, September 04, 2009 4:09 PM
Subject: Re: [Zope] apache rules with zope


 I'm trying to serve the files on the underlying directories straight 
 through
 apache with no zope interaction.

 My main site has all content on zope.  I now have content also on the
 filesystem I want to server without leaving the site.  From
 http://wiki.zope.org/zope2/ZopeAndApache I found I could supposedly use a
 rewrite condition to do such. So usiing the rewrite condition:

 RewriteCond %{REQUEST_URI} !^/(usage|zusage|ead2002|asu_ead)

 I thought would work.  I have found why the usage and zusage directories 
 work,
 there is a usage and zusage directory on the zope system so it hasn't been
 using the file system at all for any of them.

 Below is the excerpt from wiki.zope.org that explains how to do this, 
 which
 doesn't work for me.

 A lot of site content is in Zope, some parts are served directly by 
 apache

 For this, we use the RewriteRule? where everything is inside Zope, but 
 slap a
 RewriteCond? in front of it:
 RewriteCond %{REQUEST_URI} !^/(stats|manual|static_images)
 RewriteRule ^(.*) \
 http://127.0.0.1:8080/VirtualHostBase/\
 http/%{SERVER_NAME}:80/www_example_com/VirtualHostRoot$1 [L,P]


Make sure you are directing zope requests to port 8080 and apache (direct 
file access) requests to port 80 (assuming you have zope listening on 8080).


Jonathan



___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Problem with POST and text/xml (work-around)

2009-07-13 Thread Jonathan (dev101)
Problem:  zope interprets POST requests with a Content-Type of text/xml to 
be xmlrpc requests.

Work-around (requires Apache as a reverse proxy): use Apache to re-write the 
Content-Type header of the incoming request before it gets to zope using the 
following directives:

SetEnvIfNoCase Content-Type text/xml XMLFLAG
RequestHeader set Content-Type application/xml env=XMLFLAG

Zope then sees text/xml requests as application/xml requests and the xml 
data can then be accessed via REQUEST['BODY'].

Thanks to Michael H. for the assistance!


Jonathan

___
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] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)

- Original Message - 
From: Andreas Jung li...@zopyx.com
To: Jonathan (dev101) dev...@magma.ca
Cc: zope@zope.org
Sent: Friday, July 10, 2009 4:30 PM
Subject: Re: [Zope] Problem with POST and text/xml


 https://bugs.launchpad.net/zope2/+bug/373663

 -aj

 On 10.07.09 21:24, Jonathan (dev101) wrote:
 I need to support a third party web service (which is not within my 
 control)
 that wants to send xml data to my zope server (Zope 2.9.2 running on 
 Redhat
 linux).

 When Zope receives a POST request with a Content-Type of text/xml it 
 assumes
 that it is an xmlrpc call (which it is not - it is just passing xml data
 within the POST request).

 Is there a way to get Zope to turn off this xmlrpc assumption so that 
 my
 zope external method can process the xml data that is being passed?


 Thanks,

 Jonathan

Thanks for the link!

There were some differences between my Zope 2.9.2 installation and the patch 
instructions:

1) There was no interfaces.py file in the ZPublisher source directory (so I 
created a new one)
2) There were some differences in the HTTPRequest.py file, but it was still 
possible to make the changes indicated in the patch instructions.

I restarted Zope via the ZMI, and ran a test (which generated a 500 response 
error). I noticed that there were no pyc/pyo files for interfaces.py and 
HTTPRequest.py, so I created them manually using py_compile.

I restarted Zope and ran another test (using wget to simulate a POST request 
containing xml data) and got a 503 response:

---response begin---
HTTP/1.0 503 Service Unavailable
Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1
Date: Sat, 11 Jul 2009 14:04:08 GMT
Bobo-Exception-Line: 402
Content-Length: 995
Bobo-Exception-Value: See the server error log for details
Content-Type: text/html; charset=iso-8859-15
Bobo-Exception-Type: NameError
Connection: Keep-Alive
Bobo-Exception-File: HTTPRequest.py


There were no entries in Z2.log or event.log.

Other than manually creating pyc/pyo files and re-starting zope, is there 
anything else I need to do to implement the changes to interfaces.py and 
HTTPRequest.py?  If not, any ideas as to what could be causing this error or 
how I could go about debugging it?


Thanks,

Jonathan


___
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] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)

- Original Message - 
From: Michael Haubenwallner mich...@d2m.at
To: zope@zope.org
Sent: Saturday, July 11, 2009 9:51 AM
Subject: Re: [Zope] Problem with POST and text/xml


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Jonathan (dev101) wrote:
 I need to support a third party web service (which is not within my 
 control)
 that wants to send xml data to my zope server (Zope 2.9.2 running on 
 Redhat
 linux).

 When Zope receives a POST request with a Content-Type of text/xml it 
 assumes
 that it is an xmlrpc call (which it is not - it is just passing xml data
 within the POST request).

 Is there a way to get Zope to turn off this xmlrpc assumption so that 
 my
 zope external method can process the xml data that is being passed?


 Did you think of using 'application/xml' instead of 'text/xml' ?
 Everything should work as expected.

 Regards
 Michael

The POST requests are coming from a third party web service (which we don't 
control, and they have lots of other users) and they won't change the 
content-type just for us to work around a zope bug (sigh).






___
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] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)
As a quick test I modified HTTPRequest.py to turn off the zope assumption 
that all POST requests with content-type of text/xml are xmlrpc requests.

This had the effect of eliminating the xmlrpc error that zope was raising, 
but a side effect is that the xml data is not available within the REQUEST 
object.

I don't think the patch submitted for bug 373663 will fix this behaviour 
(ie. it will resolve the xmlrpc error, but it won't make the xml data 
contained within the POST request available).

Any ideas on how to get access to the xml data?!  (and re-writing the entire 
app with Grok is not something I really want to do!)

Thanks,

Jonathan


___
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] Problem with POST and text/xml

2009-07-10 Thread Jonathan (dev101)
I need to support a third party web service (which is not within my control) 
that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat 
linux).

When Zope receives a POST request with a Content-Type of text/xml it assumes 
that it is an xmlrpc call (which it is not - it is just passing xml data 
within the POST request).

Is there a way to get Zope to turn off this xmlrpc assumption so that my 
zope external method can process the xml data that is being passed?


Thanks,

Jonathan


P.S.  details of a wget session that illustrate the error being generated 
follows:

Setting --header (header) to Content-Type: text/xml
Setting --post-data (postdata) to ?xml version=1.0 encoding=ISO-8859-1 
?
bulkMtNotification
  transactionId235006/transactionId
  triggerId1160/triggerId
  messagetest #27/message
  date2007-09-14 15:52:59/date
  phoneNumber+11234567890/phoneNumber
  carrierId26/carrierId
  carrierNameSprint/carrierName
  shortCode5/shortCode
 /bulkMtNotification
DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

--16:12:28--  http://192.168.123.2:8080/Coz/Process3Ci
   = `Process3Ci.1'
Connecting to 192.168.123.2:8080... connected.
Created socket 3.
Releasing 0x00638c60 (new refcount 0).
Deleting unused 0x00638c60.

---request begin---
POST /Coz/Process3Ci HTTP/1.0
User-Agent: Wget/1.10.2 (Red Hat modified)
Accept: */*
Host: 192.168.123.2:8080
Connection: Keep-Alive
Content-Type: text/xml
Content-Length: 390

---request end---
[POST data: ?xml version=1.0 encoding=ISO-8859-1 ?
bulkMtNotification
  transactionId235006/transactionId
  triggerId1160/triggerId
  messagetest #27/message
  date2007-09-14 15:52:59/date
  phoneNumber+11234567890/phoneNumber
  carrierId26/carrierId
  carrierNameSprint/carrierName
  shortCode5/shortCode
 /bulkMtNotification]
HTTP request sent, awaiting response...
---response begin---
HTTP/1.0 500 Internal Server Error
Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1
Date: Fri, 10 Jul 2009 20:12:28 GMT
Bobo-Exception-Line: 742
Content-Length: 849
Bobo-Exception-Value: See the server error log for details
Content-Type: text/html; charset=iso-8859-15
Bobo-Exception-Type: ResponseError
Connection: Keep-Alive
Bobo-Exception-File: xmlrpclib.py

---response end---
500 Internal Server Error
Registered socket 3 for persistent reuse.


___
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] Error packing database

2009-05-27 Thread Jonathan (dev101)
- Original Message - 
From: Fabian Schoeck fabian.scho...@physik.uni-erlangen.de
To: zope@zope.org
Sent: Wednesday, May 27, 2009 4:08 AM
Subject: [Zope] Error packing database
 
 I searched the web for help, but did not find anything really helpful.
 Is this due to some timeout of the web browser? The Data.fs is quite
 large (7 GB). Should I rather pack the data base via shell and not using
 the ZMI? What is the command to do so?


Google manage_pack.


Jonathan
___
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] define library path for python external method

2009-05-11 Thread Jonathan (dev101)
snip
I use python script as an external method, 

Do you know how to define the python  libraries path.

I get an error No module named  .
/snip


Here is something I use in external methods:

EXTDIR = '/apps/zope/Extensions'
import sys
if EXTDIR not in sys.path:
 sys.path.append(EXTDIR)


hth

Jonathan
___
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] auto login user

2009-04-30 Thread Jonathan (dev101)
If you are using a form-processor routine (ie. some routine which examines 
login id/pwd entered by user on a form), then you could send the demo-ee a 
link,  which contains the id/pwd as url parameters, and directly calls the 
form processor routine.


- Original Message - 
From: ga...@schoolteachers.co.uk
To: zope@zope.org
Sent: Thursday, April 30, 2009 7:14 AM
Subject: [Zope] auto login user


 How could I automatically/programmatically log in an existing user when 
 anyone
 visits a zope site? I am doing this because I want to demo an application 
 on
 the web without needing a login. I am using an authenticated user in the
 application to retrieve data from a database that is specific to that 
 user.
 Regards
 Garry
 ___
 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 )







No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.12.8/2086 - Release Date: 04/29/09 
06:37:00

___
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] how to prevent URL access to an external method?

2009-04-28 Thread Jonathan (dev101)
Within the ExternalMethod you could check the ACTUAL_URL variable (in 
REQUEST) and if the name of the external method is found you could redirect 
the user to a you're a baaad user page.

Jonathan

- Original Message - 
From: Pedro LaWrench pedrolawre...@yahoo.com
To: zope@zope.org
Sent: Tuesday, April 28, 2009 11:04 AM
Subject: [Zope] how to prevent URL access to an external method?



I need to do something on the filesystem, which requires unrestricted 
python, so I created an external method. The problem is that anyone can call 
that directly via URL, so I added a permission check. Even then, users with 
the sufficient permissions can call this via URL, which I don't want them to 
do. I only want them to have access indirectly from other pages (such as a 
page template that will pass sane parameters). Is there anyway to do this?

Thanks,
PL



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







No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.12.6/2084 - Release Date: 04/28/09 
06:15:00

___
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-dev] Defining Zope 3.

2009-04-19 Thread Jonathan (dev101)
How about starting with Zope 3 Toolkit and then moving to Zope Toolkit 
after a year or so.

This evolutionary approach may address some of the issues that have been 
raised:

- there would be no sudden disappearance of Zope 3, eliminating the idea 
that  the Zope 3 concept is an evolutionary dead-end

- it would use the Zope 3 brand to introduce the concept of  the Toolkit

This approach is used in the retail industry whenever a brand is being 
repositioned and the brand owner wants to move as many customers as 
possible to the new brand. It retains the value/goodwill associated with the 
old brand while building value/goodwill for the new brand.


Jonathan


- Original Message - 
From: Lennart Regebro rege...@gmail.com
To: srich...@cosmos.phy.tufts.edu
Cc: Tres Seaver tsea...@palladion.com; Martijn Faassen 
faas...@startifact.com; zope-dev@zope.org
Sent: Sunday, April 19, 2009 5:00 AM
Subject: Re: [Zope-dev] Defining Zope 3.


 On Sun, Apr 19, 2009 at 04:43, Stephan Richter
 srich...@cosmos.phy.tufts.edu wrote:
 On Thursday 16 April 2009, Tres Seaver wrote:
 I would rather that we stop pushing the Zope 3 brand now,

 I would rather keep the name Zope 3.

 That's too bad, as it means that after all this discussion were are
 back to status quo on the branding situation: Complete and utter
 confusion. Except possibly that we now with the toolkit are in an even
 worse position, as it is evident from this thread that we get
 confusion not only between Zope 2 and Zope 3, Zope and Zope corp, but
 also between Zope 3 and the Zope Toolkit.

 If we keep the name Zope 3, we are still in that confused situation.
 It will make it hard to get more people to use the Zope technologies,
 no matter which variant we are talking about.

 Obviously, as the Zope 3 release manager it is ultimately up to you do
 decide what you call the releases, but I thought I would just do this
 last pleading for getting us out of the branding swamp we are in.

 -- 
 Lennart Regebro: Python, Zope, Plone, Grok
 http://regebro.wordpress.com/
 +33 661 58 14 64
 ___
 Zope-Dev maillist  -  Zope-Dev@zope.org
 http://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )







No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.0.238 / Virus Database: 270.12.0/2066 - Release Date: 04/18/09 
09:55:00

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] Trying ZODB with a background in RDBMS

2008-08-14 Thread Jonathan

- Original Message - 
From: Phillip B Oldham [EMAIL PROTECTED]
To: zope@zope.org
Sent: Thursday, August 14, 2008 4:40 AM
Subject: [Zope] Trying ZODB with a background in RDBMS


 Hi all. I'm playing with standalone ZODB at the moment trying to get a
 better understanding of its use in applications. I come from a
 PHP/MySQL background, and I'm taking my first steps with Python at the
 same time.

 One of the things I'm not understanding about ZODB is assigning
 incremental IDs to objects. For instance, if I were to be writing a
 support-ticket system I'd want to give each ticket a unique number,
 but one that's human-useable (otherwise you could just use a UUID -
 try giving one of those over the phone!).

One possible solution:

- when you create a new ID store the ID somewhere you can easily retrieve it 
(eg. as a property field on a temporary folder - stored in memory, so 
constant writes of the ID do not bloat your ZODB; or stored as a record in 
an external DB)

- create a routine that returns the stored ID; if the ID is not found then 
this routine would access the appropriate folder and return the highest ID 
found there

- if you have a low-volume application you could skip the ID storage step 
and just look for the highest stored ID each time


hth

Jonathan 

___
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] getting post data from a webcam

2008-07-09 Thread Jonathan


- Original Message - 
From: William Heymann [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, July 09, 2008 6:42 AM
Subject: Re: [Zope] getting post data from a webcam



On Wednesday 09 July 2008, Tino Wildenhain wrote:

William Heymann wrote:
 I am trying to integrate a webcamera with a site and I can get it to 
 POST
 the data to a certain url on the server the problem is I can't figure 
 out

 how to get access to the data. It is not in REQUEST.form

 the relevant request vars are

 ('CONTENT_LENGTH', '111695')
 ('CONTENT_TYPE', 'image/jpeg')
 ('HTTP_CONTENT_DISPOSITION', 'attachment;
 filename=image01-07-29_05-54-26-96.jpg')

 This is being posted to a python script object inside zope, however if 
 I

 need to use an external method that is not a problem I just need to
 figure out how to get the data.

If the file is posted as attachment (similar to file upload) it should
appear in the relevant form element as file. You can just use the method
.read() on it to get the data (or feed it into factory of image/file)



Unfortunately it is now showing up in REQUEST.form, it is not a POST like 
what
you get with a file upload from a form. Zope is showing that the correct 
size

of data was sent to that page.


For this to work the data needs to be sent as
enctype=multipart/form-data (hopefully the cam does this).



It was not sent with that kind of encoding at least not in any way I can 
tell.
It was a webcam and all I could give it was a url to POST the data to and 
it

did not submit it like a regular form.


Maybe you send all variables of the request to figure out.

Regards
Tino


You need to provide more details... try dumping the contents of REQUEST and 
posting them as was suggested earlier.



Jonathan


___
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] getting post data from a webcam

2008-07-09 Thread Jonathan


- Original Message - 
From: William Heymann [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, July 09, 2008 7:23 AM
Subject: Re: [Zope] getting post data from a webcam



On Wednesday 09 July 2008, Jonathan wrote:



You need to provide more details... try dumping the contents of REQUEST 
and

posting them as was suggested earlier.



I did post all the relevant fields from the REQUEST


here are all of the them in REQUEST.items()

[('ACTUAL_URL', 'http://www.X.com/imageuploader'),
('AUTHENTICATED_USER', User 'X'),
('AUTHENTICATION_PATH', 'XXX/VirtualHostBase//'), ('BASE0', 'http://
www.XXcom'), ('BASE1', 
'http://www.cougarcanyonliving.com'),

('BASE2', 'http://www..com/imageuploader'),
('CONTENT_LENGTH', '111695'), ('CONTENT_TYPE', 'image/jpeg'),
('GATEWAY_INTERFACE', 'CGI/1.1'), ('HTTP_CONTENT_DISPOSITION', 
'attachment;
filename=image01-07-29_05-54-26-96.jpg'), ('HTTP_HOST', 
'127.0.0.1:9673'),

('HTTP_MAX_FORWARDS', '10'), ('HTTP_USER_AGENT', 'Axis shttpclien
t $Revision: 1.45 $'), ('HTTP_VIA', '1.0 www..com'),
('HTTP_X_FORWARDED_FOR', 'XX.XXX.XXX.XXX'),
('HTTP_X_FORWARDED_HOST', '.com'),
('HTTP_X_FORWARDED_SERVER', 'www.X.com'), ('PARENTS', [Folder
at /XXX, Application at ]),
('PATH_INFO', 
'/VirtualHostBase/http/www..com:80/XXX/VirtualHostRoot/imageuploader'),

('PATH_TRANSLATED', '/VirtualHostBase
/http/www..com:80/XXX/VirtualHostRoot/imageuploader'), 
('PUBLISHED',

PythonScript at /XXX/imageuploader), ('REMOTE_ADDR', '127.0.0.1'),
('REQUEST_METHOD', 'POST'), ('RESPONSE', ZServerHTTPRe
sponse('')), ('SCRIPT_NAME', ''), ('SERVER_NAME', 'localhost'),
('SERVER_PORT', '9673'), ('SERVER_PROTOCOL', 'HTTP/1.1'),
('SERVER_SOFTWARE', 'Zope/(Zope 2.9.6-final, python 2.4.4, linux2)
ZServer/1.1'), ('SERVER_URL', 'http://www..com'), ('SESSION', id:
12155753281337189705, token: 99836730A3cKJMzoaVU, content keys: []),
('TraversalRequestNameStack', []), ('URL', 'http://www..com/
imageuploader'), ('URL0', 'http://www..com/imageuploader'),
('URL1', 'http://www..com'),
('VIRTUAL_URL', 'http://www..com/imageuploader'),
('VIRTUAL_URL_PARTS', ('http://www..com', 'imageuploader')),
('VirtualRootPhysicalPath', ('', 'XXX')),
('__aca', '/36gevRRS99FhE%2BrH6GVLeSzXzA%3D%0A'), ('traverse_subpath', 
[])]


there is nothing in REQUEST.form


Just a thought... could your front-end (apache?) be stripping out the image 
due to attachment size restrictions or some other restriction?



Jonathan 


___
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] ZCatalog question

2008-07-08 Thread Jonathan Salazar Santos
Hi everybody


I have a method that creates a Files and DTML Documents but I need to
Index those news items to a ZCatalog when they are created.

Do you know if there are some dtml calls (like manage_catalogACTION)
to call the action: Index, Reindex, Delete indexed objects with dtml
or Python Scrips.

How can I do to get indexed my new items in a zcatalog automatically?

Some help will be appreciated.

Regards,
-- 
Jonathan Salazar
Vista: http://jonathansalazar.com
___
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] ZCatalog question

2008-07-08 Thread Jonathan


- Original Message - 
From: Jonathan Salazar Santos [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, July 08, 2008 5:17 PM
Subject: [zope] ZCatalog question



Hi everybody


I have a method that creates a Files and DTML Documents but I need to
Index those news items to a ZCatalog when they are created.

Do you know if there are some dtml calls (like manage_catalogACTION)
to call the action: Index, Reindex, Delete indexed objects with dtml
or Python Scrips.

How can I do to get indexed my new items in a zcatalog automatically?

Some help will be appreciated.

Regards,
--
Jonathan Salazar


Basic ZCatalog info can be found in the Searching and Categorizing Content 
chapter of the Zope Book (http://www.plope.com/Books/2_7Edition)


Automatic object cataloging was accomplished by creating 'ZCatalog aware' 
object instances - i can't remember if this is a feature of ZClasses only 
(stay away from ZClasses) or if you can create your own product that 
subclasses the 'awareness' features (google is your friend).


You can manually add/remove items using the methods catalog_object and 
uncatalog_object (Zope Book and google for more info).


hth

Jonathan (another one) 


___
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] ZCatalog : Searching Multiple Indexes : Returning One Result

2008-07-07 Thread Jonathan


- Original Message - 
From: Tom Von Lahndorff [EMAIL PROTECTED]

To: zope list user zope@zope.org
Sent: Monday, July 07, 2008 3:42 PM
Subject: [Zope] ZCatalog : Searching Multiple Indexes : Returning One Result



Hi, I have a catalog called catalog that contains a bunch of cataloged
items. I have indexed 3 properties for each item, name, body and
description. I'd like to be able to search the catalog in the following
way:

if the word text shows up in any index, name, body or description,
return that result back once.

The problem is I have is that if a do a search for text and say there's
results that have the word text in one or more of those indexes:

catalog({name:query}) or catalog({body:query}) or
catalog({description:query})
only gives back limited results (leaves out some 'True' hits) and:
catalog({name:query}) + catalog({body:query}) + 
catalog({description:query})

gives me back the same result 3 times.

any ideas? Thanks.


Something I saved from a long time ago post (warning untested) which may 
give you some ideas:


snip
context.Catalog({'keywordindex': ['Value1', 'Value2']})
Catalog returns me an OR search instead of an AND one

Use context.Catalog(keywordindex = {'query':[...], operator='and'})
when you want to use the and operator.
/snip

hth

Jonathan

___
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] m2crypt in Zope 10

2008-06-20 Thread Jonathan Salazar Santos
Hello everybody


I am wondering, if there are some howto patching the zope 10 files
specifically for $MYZOPEHOME/lib/python/ZServer/datatypes.py

Because when I try to patch like: patch datatypes.py
datatypes.py.patch, the result:

patching file datatypes.py
Hunk #1 FAILED at 72.
1 out of 1 hunk FAILED -- saving rejects to file datatypes.py.rej


It is the only file failed, the others one were fine.

Some help will appreciate.

-- 
Jonathan Salazar
Vista: http://jonathansalazar.com
___
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] Writing a file in ZMI using python script

2008-06-10 Thread Jonathan


- Original Message - 
From: Kedar Dash [EMAIL PROTECTED]

To: Zope@zope.org
Sent: Tuesday, June 10, 2008 6:58 AM
Subject: [Zope] Writing a file in ZMI using python script



HI All,

How can i create a file in ZMI using python script (It is working fine
with python external method). Here I want to write the output of a query
to a file in ZMI.


If your use case requires 'snapshots' of the data at various times, then you 
have some options for saving the results:


1- use an external method to write the results to the filesystem
2- use EXTFILE
3- save the results in a DTML Document
4- save the results in a property field on a folder
5- build your own Product

(don't you just love Zope... more ways to solve a problem than anyone could 
hope for!)


If, as was already mentioned, you don't need to retain snapshots of the 
data, then just call your script/template to build/display the results as 
and when they are required.



Jonathan

___
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] centos

2008-05-13 Thread Jonathan


- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, May 13, 2008 3:14 AM
Subject: [Zope] centos


Does anyone have any experience running Zope on Centos 5. I have some 
Python
scripts which just will not work. They work on Windows, Ubuntu, and SuSe 
but

just don't do anything on Centos. I have tried various Zope 2.9.0 and
2.9.6-final, various psycopg connectors and Postgres 8.1 and 8.3.
Here is an example script that works everywhere except Centos(excuse email
formatting):

request=context.REQUEST
datefrom=request.datefrom
dateto=request.dateto
today = DateTime(datefrom)
end = DateTime(dateto)
auth=request.auth
year=request.year
while today = end:
   for result in context.getstudentsbyyear(year=year):
   studentid=result.studentid
   if context.getday(today=today): #picks out non-weekend days only
  if context.checkholidays(today=today): #picks out holidays
  pass
  else:

context.insertabsence(entered=today,auth=auth,studentid=studentid)

   today += 1
return b class=redAbsences entered/b


We run Zope 2.9.2 and 2.9.4 on centos 4.3 without any problems.  What error 
is being generated?


Jonathan 


___
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] Making Zope stop storing old object versions

2008-05-08 Thread Jonathan

Sinang, Danny wrote:
Hello,

We've got lots of Catalog reads and writes and our Data.fs is growing
at an immense rate.

Is there a way we can tell Zope to stop storing old object
versions to limit the growth and not have to pack that often ?


Well in fact it (Filestorage) does only store new object versions.
What it does not is removing the old version - this is done during packing.

When you have many Catalog writes or other parts of your object tree
experiences many writes, try to mount an extra ZODB (and storage) there.

You can also try some of the other storages like relstorage (where it
depends on the RDBMS how it handles writes)


Alternatively, you could just replace your Catalog with an external db such 
as MySQL (using zmysql database connections).



Jonathan 


___
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] Making Zope stop storing old object versions

2008-05-08 Thread Jonathan


snip
- Original Message - 
From: Sinang, Danny [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Thursday, May 08, 2008 10:03 AM
Subject: RE: [Zope] Making Zope stop storing old object versions


How do I go about replacing a Catalog using MySQL ? This is the first
time I've heard this.
/snip

Here's the relevant chapter in the Zope Book: 
http://plope.com/Books/2_7Edition/RelationalDatabases.stx




Jonathan 


___
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] disappearing external methods

2008-05-07 Thread Jonathan


- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, May 07, 2008 11:52 AM
Subject: [Zope] disappearing external methods


I have recently moved our Zope installation over to a centos server. Since 
the

move all the external methods periodically stop working for no apparent
reason and the error is returned as:
external method can not be called because it is none

The thing is that it works well and then stops. Does anyone have any ideas
about this? The installation was not initially compiled on centos as I 
have a

large collection of software as part of the application which can be moved
between servers with the Zope installation. The reason for the move to 
Centos
is that DTMLTex fails when trying to run pdflatex on Ubuntu and this seems 
to
be distro specific, with no apparent way to fix it, unless anyone knows 
any

better?


We use centOS and have a lot of external methods (all working happily).

Have you tried deleting the .pyc files associated with the external methods 
and then restarting zope?



Jonathan 


___
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] disappearing external methods

2008-05-07 Thread Jonathan


- Original Message - 
From: Jonathan [EMAIL PROTECTED]

To: Garry Saddington [EMAIL PROTECTED]; zope@zope.org
Sent: Wednesday, May 07, 2008 11:54 AM
Subject: Re: [Zope] disappearing external methods




- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, May 07, 2008 11:52 AM
Subject: [Zope] disappearing external methods


I have recently moved our Zope installation over to a centos server. Since 
the

move all the external methods periodically stop working for no apparent
reason and the error is returned as:
external method can not be called because it is none

The thing is that it works well and then stops. Does anyone have any 
ideas
about this? The installation was not initially compiled on centos as I 
have a
large collection of software as part of the application which can be 
moved
between servers with the Zope installation. The reason for the move to 
Centos
is that DTMLTex fails when trying to run pdflatex on Ubuntu and this 
seems to
be distro specific, with no apparent way to fix it, unless anyone knows 
any

better?


We use centOS and have a lot of external methods (all working happily).

Have you tried deleting the .pyc files associated with the external 
methods and then restarting zope?


Sorry, that should have been delete any .pyc files of modules that your 
external methods call and delete .pyc files for any products that may be 
used by the external methods, then restart zope.


You can also try to delete and re-add the external method within the ZMI.

Jonathan 


___
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] disappearing external methods

2008-05-07 Thread Jonathan


- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, May 07, 2008 12:06 PM
Subject: Re: [Zope] disappearing external methods



On Wednesday 07 May 2008 16:54, Jonathan wrote:

- Original Message -
From: Garry Saddington [EMAIL PROTECTED]
To: zope@zope.org
Sent: Wednesday, May 07, 2008 11:52 AM
Subject: [Zope] disappearing external methods

I have recently moved our Zope installation over to a centos server. 
Since

the
 move all the external methods periodically stop working for no apparent
 reason and the error is returned as:
 external method can not be called because it is none

 The thing is that it works well and then stops. Does anyone have any
 ideas about this? The installation was not initially compiled on centos
 as I have a
 large collection of software as part of the application which can be
 moved between servers with the Zope installation. The reason for the 
 move

 to Centos
 is that DTMLTex fails when trying to run pdflatex on Ubuntu and this
 seems to
 be distro specific, with no apparent way to fix it, unless anyone knows
 any
 better?

We use centOS and have a lot of external methods (all working happily).

Have you tried deleting the .pyc files associated with the external 
methods

and then restarting zope?

There are no .pyc files in any of our installations.
Have you used the Zope that comes with Centos or from Zope.org?
Regards
Garry


We downloaded/installed zope from zope.org.


Jonathan 


___
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] problem attach file / Zfile - more informations

2008-05-02 Thread Jonathan


- Original Message - 
From: Frederique Blondelle [EMAIL PROTECTED]

To: zope@zope.org
Sent: Friday, May 02, 2008 6:16 AM
Subject: [Zope] problem attach file / Zfile - more informations



Hello,

I have created a zclass with zfile as basic class.
With this class, users could, via a web form, send an attached file if
they want.
With zope 2.5 (my previous version) if users don't attach a file, there
is no problem
with zope 2.10, if there is no file attached, I have an error message :
'file not specified. It seems that  attach  file is mandatory.

Here, the complete message from the events log :

Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module OFS.DTMLMethod, line 144, in __call__
   - DTMLMethod at /assistance/do_add
   - URL: http://assistance.abes.fr/do_add/manage_main
   - Physical Path: /assistance/do_add
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module DocumentTemplate.DT_With, line 76, in render
  Module DocumentTemplate.DT_Util, line 196, in eval
   - __traceback_info__: _
  Module string, line 1, in expression
  Module OFS.DTMLMethod, line 137, in __call__
   - DTMLMethod at /assistance/Quest_susvp_add
   - URL: http://assistance.abes.fr/Quest_susvp_add/manage_main
   - Physical Path: /assistance/Quest_susvp_add
  Module DocumentTemplate.DT_String, line 476, in __call__
  Module DocumentTemplate.DT_With, line 61, in render
  Module DocumentTemplate.DT_Util, line 196, in eval
   - __traceback_info__: REQUEST
  Module string, line 1, in expression
  Module ZClasses.ZClass, line 454, in createInObjectManager
  Module ZClasses.ZClass, line 485, in fromRequest
  Module ZPublisher.mapply, line 89, in mapply
  Module OFS.Image, line 120, in __init__
  Module OFS.Image, line 501, in _read_data
ValueError: File not specified


I don't know if this is the cause of your problem, but as of Zope 2.10 
ZClasses are deprecated.



Jonathan 


___
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] ProgrammingError

2008-04-22 Thread Jonathan

snip
- Original Message - 
From: Kaushal Shriyan [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, April 22, 2008 8:36 AM
Subject: [Zope] ProgrammingError


Hi,

When i click on Add MailManager, I get the below error

*Error Type: ProgrammingError

Error Value: ERROR: RETURN cannot have a parameter in function returning
void at or near NONE at character 1293 -- Trigger function up maintaining
the search indicies on mm_ticket -- -- This trigger gets calleÑ
/snip


MailManager is a third party product... you may find some assistance here: 
http://www.logicalware.com/



Jonathan 


___
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] Re: [Zope3-Users] Authentication without cookies

2008-04-14 Thread Jonathan


- Original Message - 
From: Hermann Himmelbauer [EMAIL PROTECTED]

To: Peter Bengtsson [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, April 14, 2008 1:34 PM
Subject: Re: [Zope3-Users] Authentication without cookies



Am Montag, 14. April 2008 18:55 schrieb Peter Bengtsson:

Slightly off-topic: What mobile browsers that support XHTML don't
support cookies these days? Don't need an accurate answer but I'm
curious about rough numbers.


Well, I have a SonyEricsson K750i which seems not to support cookies. It 
does

have some options for cookies, but they don't work.

And the SonyEricsson K550i does support cookies, but - even worse - 
sometimes

does not send the cookie, which *may* have something to do with the cookie
path and bugs in the mobile browser. In this case, the user loses his
authentication and has to login.

So, if even such recent models have severe cookie-problems, I deduce that
things will be at least the same if not worse in older models. But I can 
only
speak about SonyEricsson models as I had not yet time to test other 
brands.


Moreover, WAP seems not to support cookies by design, at least in another,
incompatible fashion, which I'm unsure how this works.


A little off the zope topic, but...

In order to ensure usability by all of our users (regardless as to device 
type) we do not use cookies on our WAP sites. We embed a session identifier 
in every url.


Jonathan 


___
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] try clause in external method

2008-04-14 Thread Jonathan


- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]

To: zope@zope.org
Sent: Monday, April 14, 2008 3:19 PM
Subject: [Zope] try clause in external method


I have the following external method which takes an input .csv file and 
enters
the data into a database by calling a ZSQL method. There may be errors in 
the

input file and so I am trying to catch them and insert each bad row in a
different table. The errors are detected by table constraints on the table
definition and should be reported by the Psycopg connector. However no
correct rows are entered and only the last error row is entered. Can 
anyone

see what I am doing wrong in this script?

def timetabler(self,REQUEST):
 import csv,string
 f=REQUEST.form[TTEXPORT.CSV]
 from cStringIO import StringIO
 filebody=StringIO(f.read())
 r =
csv.DictReader(filebody(day,periodstart,periodend 
,year,teachgroup,teacher ,subject ,set ,room))

 for row in r:
  try:
 self.insertintoiclasses(**row)
  except:
  self.insertimporterrors(**row)
 dtmlMethodName=manage_import_from_timetabler
 return self[dtmlMethodName](self,self.REQUEST)


A couple of things...

1) Have bare try/except clauses may cause you grief ;-)

2) When an error is trapped by the 'try' statement the transaction is not 
committed (ie. nothing is written to your db), only the 'except' statement 
is executed.



Jonathan 


___
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] type checking

2008-04-14 Thread Jonathan


- Original Message - 
From: Jaroslav Lukesh [EMAIL PROTECTED]

To: Garry Saddington [EMAIL PROTECTED]; zope@zope.org
Sent: Monday, April 14, 2008 4:48 PM
Subject: Re: [Zope] type checking



dtml-try
dtml-if _.int(variable) = variable
   Variable is integer
dtml-else
   Variable is not integer
/dtml-if
dtml-except
   Variable is not number
/dtml-try


The 'same_type' function  may be what you are looking for:

dtml-if _.same_type(a,[])
 a is a list
dtml-elif _.same_type(a,{})
 a is a dict
dtml-elif  etc

/dtml-if


Jonathan
___
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] Upgrade to 2.7.2 results in all content unavailable

2008-04-11 Thread Jonathan


- Original Message - 
From: Wes Modes [EMAIL PROTECTED]

To: zope@zope.org
Sent: Friday, April 11, 2008 12:04 AM
Subject: [Zope] Upgrade to 2.7.2 results in all content unavailable


I upgraded to Zope 2.7.2 and all of my content can't be seen by Zope.  
Honestly I'm not sure what the previous version I was running was (nor 
am I sure how to find out).


Now, every page results in

Site Error
An error was encountered while publishing this resource.
Resource not found
Sorry, the requested resource does not exist.
Check the URL and try again.
Resource: Zope GET


What version of zope did you upgrade from?
What happens when you try to access any of the problem objects via the ZMI?


Jonathan

___
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] Upgrade to 2.7.2 results in all content unavailable

2008-04-11 Thread Jonathan


- Original Message - 
From: Wes Modes [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Sent: Friday, April 11, 2008 12:52 PM
Subject: Re: [Zope] Upgrade to 2.7.2 results in all content unavailable



Jonathan, thanks for writing.  Please pardon my zope ignorance.

What happens when you try to access any of the problem objects via the
ZMI? 

How would I do this?

Wes


You typically access the Zope Management Interface (ZMI) by going the url 
for your zope-based web site with '/manage'. eg.  www.myzopesite.com/manage


You will then be asked for a username and password (if you don't have this 
information, you need to use the 'emergency user' - google for 'zope 
emergency user').


You may also want to look at the Zope Book... 
http://www.plope.com/Books/2_7Edition - i don't know if this is the most 
recent version, but it is a good starting point.



Jonathan


___
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] Upgrade to 2.7.2 results in all content unavailable

2008-04-11 Thread Jonathan


- Original Message - 
From: Wes Modes [EMAIL PROTECTED]

To: Dieter Maurer [EMAIL PROTECTED]; zope@zope.org
Sent: Friday, April 11, 2008 1:44 PM
Subject: Re: [Zope] Upgrade to 2.7.2 results in all content unavailable



   2008-04-11 10:36:54 ERROR ZODB.lock_file Error locking file
   /var/lib/zope/var/Data.fs.lock
   Traceback (most recent call last):
 File /usr/lib/zope/lib/python/ZODB/lock_file.py, line 63, in
   __init__
   lock_file(self._fp)
 File /usr/lib/zope/lib/python/ZODB/lock_file.py, line 42, in
   lock_file
   fcntl.flock(file.fileno(), _flags)
   IOError: [Errno 11] Resource temporarily unavailable


Make sure you have read/write access to the /var/lib/zope/var directory and 
that is 'owned' by 'zope'



Jonathan

___
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-dev] Non-ASCII characters in URLs

2008-04-07 Thread Jonathan


- Original Message - 
From: Martijn Pieters [EMAIL PROTECTED]

To: Alexander Limi [EMAIL PROTECTED]
Cc: zope-dev@zope.org
Sent: Monday, April 07, 2008 4:39 AM
Subject: Re: [Zope-dev] Non-ASCII characters in URLs



On Mon, Apr 7, 2008 at 1:37 AM, Alexander Limi [EMAIL PROTECTED] wrote:
 Is there a good technical explanation for why Zope doesn't allow 
non-ASCII

characters in URLs?


Because URLs don't allow non-ASCII characters?


 I'd like to be able to let URLs work like this example from Wikipedia:

 http://ja.wikipedia.org/wiki/メインページ


Your browser translates that into
http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8

 Is there a fundamental reason (ie. Python objects can only be ASCII) or 
is

it simply bugs that need to be fixed?


RFC 1738 (http://www.ietf.org/rfc/rfc1738.txt) doesn't allow non-ascii
characters in URLs.

  No corresponding graphic US-ASCII:

  URLs are written only with the graphic printable characters of the
  US-ASCII coded character set. The octets 80-FF hexadecimal are not
  used in US-ASCII, and the octets 00-1F and 7F hexadecimal represent
  control characters; these must be encoded.

Now, Zope could well support UTF-8 ids, and translate URLs
appropriately, but in the meantime you could use the same scheme?


IDNA (http://www.ietf.org/rfc/rfc3490.txt) and Punycode 
(http://www.faqs.org/rfcs/rfc3492.html) may be of some use.


Jonathan


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope] Zope+SSL

2008-04-07 Thread Jonathan Salazar Santos
Hello All,

I recently bought a dedicated server at Godaddy.com, the think its, I want
to run zope in https mode, but not success, so...
really: Must I need configure Apache+FastCGI+Zope to get ready SSL on Zope?

Any help will be appreciate, thank you in advance.

Saludos,
-- 
Lic. Jonathan Salazar
Vista: http://jonathansalazar.com
___
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] ZServer uncaptured python exception

2008-04-01 Thread Jonathan


- Original Message - 
From: Allen Schmidt Sr. [EMAIL PROTECTED]

To: Zope Users zope@zope.org
Sent: Tuesday, April 01, 2008 10:11 AM
Subject: [Zope] ZServer uncaptured python exception



Running logtail on a ZEO client, I am seeing lots of these.
And our two public clients are pegging the server at 99% almost 
continuously. Not sure why.




2008-04-01T09:54:09 ERROR(200) ZServer uncaptured python exception, 
closing channel ZServer.HTTPServer.zhttp_channel connected 
8.7.96.136:56350 at 0xb63d7a6c channel#: 800 requests:4 
(socket.error:(104, 'Connection reset by peer') 
[/usr/local/lib/python2.3/asynchat.py|initiate_send|218] 
[/var/www/zope/zope275c2/lib/python/ZServer/medusa/http_server.py|send|417] 
[/usr/local/lib/python2.3/asyncore.py|send|337])

--
2008-04-01T09:54:17 ERROR(200) ZServer uncaptured python exception, 
closing channel ZServer.HTTPServer.zhttp_channel connected 
8.7.96.136:56590 at 0xb26898ac channel#: 890 requests: 
(socket.error:(104, 'Connection reset by peer') 
[/usr/local/lib/python2.3/asynchat.py|initiate_send|218] 
[/var/www/zope/zope275c2/lib/python/ZServer/medusa/http_server.py|send|417] 
[/usr/local/lib/python2.3/asyncore.py|send|337])


I am not sure that the error messages you are seeing are related to your 
high cpu utilization.


There is a discussion thread on your error here: 
http://aspn.activestate.com/ASPN/Mail/Message/zope-list/3492748


If you google 'debug spinning zope'  you will find links on how to track 
down cpu consumption.


HTH

Jonathan 


___
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] merging zodb's

2008-04-01 Thread Jonathan


- Original Message - 
From: David Bear [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, April 01, 2008 6:29 PM
Subject: [Zope] merging zodb's


I have a zodb from a dead zope instance that I wanted to merge in to 
another
running zope. I thought I could use a mount point to do this and just 
specify

the old zodb for the storage in my mount point.

alas, this did not work as expect. After making the modification in my
zope.conf like this:

zodb_db support 
   # ssw file store
   filestorage
 path $INSTANCE/var/srvx-Data.fs
   /filestorage
   mount-point /support
/zodb_db

And then restarting zope and adding the mount point -- I see nothing
underneath it.

So, I assume this is NOT a valid way to merge to zodb's together?

Does anyone have an suggestions on a way I might combine 2 zodb's?


A shot in the dark, because I am not sure what you mean by a dead zope 
instance...


Create an external method that you can access from the 'non-dead zope 
instance', which directly accesses the Data.fs file from the dead zope 
instance (using the usual db.open/root=connection.root...) and then loops 
thru all of the objects from the root down and copies them into the 'live' 
zope instance.


hth

Jonathan 


___
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] problem migrating ZClasses from Zope 2.6.1 to Zope 2.9.8

2008-03-26 Thread Jonathan


- Original Message - 
From: Allen Schmidt Sr. [EMAIL PROTECTED]

To: Jens Vagelpohl [EMAIL PROTECTED]
Cc: zope user list zope@zope.org
Sent: Wednesday, March 26, 2008 7:59 AM
Subject: Re: [Zope] problem migrating ZClasses from Zope 2.6.1 to Zope 2.9.8


That sounds so easy. We have one ZClass but it is the basis of almost our 
entire newspaper website. The news ZClass was built in 2000 and put into 
production when we went live on Zope in Feb 2001 (just before the guys at 
Zope Corp said that ZClasss were bad). Over 7 full years of daily news as 
ZClass objects. We are in the same boat as we want to move from 2.7.5 to a 
later version. We could switch to SQL articles but then we would have to 
make sure all the old URLs still functioned as our content is all over the 
search engines...and convert everywhere there are tools to manage story 
creation, importing, editing, etc. Yuck. We could just make the cutover 
one day and just keep an instance running for the old stuff and all new 
stuff runs from SQL.


We did a similar conversion product, but instead of switching to SQL we just 
build new python-based class instance objects, so that all existing urls 
would continue to work.  We built the new class instances in a separate 
folder, keeping the same ids as the original zclass instances, and then just 
swapped the folders around.  We are using zcatalogs, so we also had to 
rebuild these.


We had to manually create a very simple zope product to define the new 
classes, but this is a very easy/simple process.  We then used a combination 
of python scripts and external methods to loop thru the zclass instances, 
create new python-based class instances and update the new zcatalogs (we had 
5 different sets of data each with its own zcatalog).


All-in-all it was a bit of a pita, but the ability to upgrade to newer zope 
versions without fear was well worth the time and effort.


Jonathan 


___
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] getting the keys:values in a propertyItems() object

2008-03-06 Thread Jonathan


- Original Message - 
From: Kamal Hamzat [EMAIL PROTECTED]

To: zope@zope.org
Sent: Thursday, March 06, 2008 7:07 PM
Subject: [Zope] getting the keys:values in a propertyItems() object


Hi,I have this lines of dtml methods.dtml-call REQUEST.set('xx', 
_.getitem('080211'))dtml-var xx.propertyItems()Which rendered these 
Keys:Values below[('title', The man Wants Refinery For Living), 
('lastEditDate', DateTime('2008/02/11 11:49:26.254 US/Eastern')), 
('EpozDocumentTemplate', ''), ('author', 'By Chesal Chesal'), ('summary', 
He has directed that further investment in private refineries be targeted 
at the axis which consumes 15 million litres of fuel per day, more than half 
the country's total.)]
Please, how do I extract each key with its corresponding value. For example 
title : The man Wants Refinery For Living.Thankskamal


/snip

Yet another option:

dtml-let xx= _.getitem('080211')
 dtml-var xx.getProperty('title')
/dtml-let


Jonathan 


___
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] POST version of Response.redirect

2008-02-15 Thread Jonathan
I have a case where I need to redirect users from my Zope site to a 
third-party web site and send POST data that I generate.


The only information I can find on RESPONSE.redirect relates to the GET 
format.  Is there a POST version of RESPONSE.redirect and if so, how is the 
POST data included?


Thanks,

Jonathan 


___
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] Counting threads

2008-01-22 Thread Jonathan


- Original Message - 
From: Peter Bengtsson [EMAIL PROTECTED]

To: Dieter Maurer [EMAIL PROTECTED]
Cc: zope user list zope@zope.org
Sent: Tuesday, January 22, 2008 5:33 PM
Subject: Re: [Zope] Counting threads



On 22/01/2008, Dieter Maurer [EMAIL PROTECTED] wrote:

Peter Bengtsson wrote at 2008-1-22 15:23 +:
Perhaps I'm wrong but I suspect that a Zope I'm running is dying because
of running out of threads.

This is very unlikely. It may no longer respond when all its threads
are working -- but it will not die for this reason.


By dying I don't mean crashing and stopping but instead staying up and
running but not responding to anything. Like a coma.

Sadly I can't reproduce it but the next time it happens I'll look at
both DeadlockDebugger and the Control_Panel Debug info if there are
any clues there.


You could also try this: http://www.zopelabs.com/cookbook/1073504990


Jonathan 


___
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] looking for an easier way

2008-01-02 Thread Jonathan


- Original Message - 
From: David Bear [EMAIL PROTECTED]

To: zope Zope@zope.org
Sent: Wednesday, January 02, 2008 6:10 PM
Subject: [Zope] looking for an easier way

There must be an easier way to 'know' what zope is giving me and grab
the correct dictionary that has the form data in it. anyone have any
pointers?


A couple of ideas:

(i) use Zope marshalling to store all fields from an html form into a record 
(dictionary)

(ii) get all form fields via:  REQUEST.form.keys()


hth

Jonathan 


___
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] urlparse equivalent

2007-12-14 Thread Jonathan
If you print out the contents of 'container.REQUEST' you will find a lot of 
helpful pre-set url-related vars.


Jonathan

- Original Message - 
From: David Bear [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Cc: zope Zope@zope.org
Sent: Friday, December 14, 2007 6:06 PM
Subject: Re: [Zope] urlparse equivalent



On Fri, Dec 14, 2007 at 09:16:54PM +, [EMAIL PROTECTED] wrote:

there isn't but you can write an External Method in pure python.

On 14/12/2007, David Bear [EMAIL PROTECTED] wrote:
 I wanted to use urlparse to handle manage some url rewrites but it's
 not importable.. Is there any zope functional equivelent that I can
 use to parse urls?


Thanks for all the responses.

I'm a little suprised that there isn't anything like urlparse
functionaly in zope. I would think parsing urls would be a fairly
common chore. Which leads me to think that I may be thinking
completely wrong about what I want to accomplish.

Perhaps I can get closer to what I want if I better understand the
names 'here' and 'context'.  I am writing a python script and I want
to get the path to where the script lives -- not from where it was
called. But I don't see that 'here' is a name available to script.
Yet, 'context' doesn't seem to do what I want.

what is the easiest way to get the path to where a script lives?


--
David Bear
phone: 602-496-0424
fax: 602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
Beware the IP portfolio, everyone will be suspect of trespassing
___
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 )



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.17.2/1184 - Release Date: 
12/14/2007 11:29 AM




___
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] Zope Jobs

2007-11-06 Thread Jonathan


- Original Message - 
From: Tom Von Lahndorff [EMAIL PROTECTED]

To: Zope user list zope@zope.org
Sent: Tuesday, November 06, 2007 4:45 PM
Subject: [Zope] Zope Jobs




Anyone have any recommendations for a good place to post a Zope job?  
Its for a freelance, work from where ever gig. Thanks.


You could try here:

http://plone.freerecruiting.com/



Jonathan
___
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] backup full instances

2007-10-26 Thread Jonathan


- Original Message - 
From: Jonas Meurer [EMAIL PROTECTED]

To: zope-users zope@zope.org
Sent: Friday, October 26, 2007 10:57 AM
Subject: [Zope] backup full instances



Hello,

We have several different zope instances running on our servers, and
currently the only backup we do is a daily copy of the Data.fs.

The main problem with this backup approach is, that the zope instance is
not stopped for the backup at all, thus the Data.fs might not be up to
date.

Is it safe in general to copy Data.fs while the instance is running? Or
might I end up with a broken Data.fs, which zope is not able to read at
all?

And which other ways to you know to backup an entire instance? Maybe
sync it with ZEO to another server in realtime? Or use some export
method?


Have a look at:

http://wiki.zope.org/ZODB/FileStorageBackup


Jonathan
___
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] object properties access strangeness

2007-10-25 Thread Jonathan


- Original Message - 
From: Jaroslav Lukesh [EMAIL PROTECTED]

To: zope@zope.org
Sent: Thursday, October 25, 2007 12:38 PM
Subject: [Zope] object properties access strangeness



Hi all,

I have problem with Zope 2.9.4, where I cannot get properties from 
acquired DTML Document in same way as from Image (both are in folder 
above, both objects with properties defined). It seems as to be a 
permission problem, but I was look through permissions at whole tree up to 
zope root.


This is working:

   dtml-with picture.gif
   dtml-var IMGproperty(existing property at Image)
   /dtml-with

And this raise error:

   dtml-with dtml_document_file
   dtml-var ikona1(existing property at DTML document)
   /dtml-with

Error:

Error Type: KeyError
Error Value: 'ikona1'


Try:

dtml-var dtml_document_file.getProperty('ikona1', 'badPropertyName')

Lots of good info in the PropertyManager appendix section of the ZopeBook...


Jonathan

___
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] storing python objects

2007-10-25 Thread Jonathan


- Original Message - 
From: David Bear [EMAIL PROTECTED]

To: zope Zope@zope.org
Sent: Thursday, October 25, 2007 6:19 PM
Subject: [Zope] storing python objects



I need to run an external method to use some python functions that are
restricted within zope. I'm thinking an easy way to get the data back
would be to just store basic python objects within zodb; tupples,
lists, dictionaries.

but I've never seen this documented anywhere. Is it possible to store
basic python objects directly in zodb? AND then use a zpt to read the
data?

I'm thinking a simple thing would be to create an external method that
returns a dictionary.

Then I could have script call the method, and stored the dictionary on
zodb.


I have done something similar:  have an external method store a a 
list/dictionary value in a property field on a folder, then a future call to 
the external method retrieves that property field and uses 'eval' to convert 
it back to a list/dictionary (it is stored as a string).  *** Warning: You 
need to be 100% sure you know what is in the list/dictionary if you are 
going to use 'eval' though!


The other approach I have used is to create a dead simple Zope product that 
just defines an object class (which contains lists, dictionaries, etc) and 
then have the external method store these objects directly in the ZODB.


Jonathan

___
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] Zope database file grows when no one is modifying it

2007-10-19 Thread Jonathan


- Original Message - 
From: Jamie O'Keefe [EMAIL PROTECTED]

To: zope@zope.org
Sent: Friday, October 19, 2007 11:05 AM
Subject: Re: [Zope] Zope database file grows when no one is modifying it


Any suggestions as to how to thwart such attempts besides requiring
user accounts for even the most minor edit and then remaining vigilant
about who get accounts?


Not a zope-based solution, but how about using 'captcha' images if spambots 
are your problem?


Jonathan

___
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] How can I get graph statistics

2007-10-10 Thread Jonathan Salazar Santos
I am wondering if..., ¿Could some body tell me (help me) how to do graph
statistics on the fly with DTML or python?
I need to create reports with statistics on the fly.

Some howto... I will apreciate, thanks in advance.

-- 
Jonathan Salazar
___
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] HOw to create a Zope Instance ?

2007-10-04 Thread Winterflood, Jonathan

Indeed, but Ben's test shows us they definitely use Zope

Jonathan

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Jens Vagelpohl
Envoyé : jeudi 4 octobre 2007 10:53
À : zope list user
Objet : Re: [Zope] HOw to create a Zope Instance ?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 4 Oct 2007, at 10:40, Ben Bartrum wrote:

 Getting seriously OT but this got me interested in what kind of  
 company this is, and whether it has anything to do with Zope's Zeo,  
 so I used  their search box to search the word Zeo.  The result is  
 interesting.

They have nothing to do with ZEO, apart from maybe using it for their  
customers.

jens



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHBKnqRAx5nvEhZLIRAi6YAKCP7NIoITyeY5zV9s5aRbh6s/kyuQCgh6S9
QvPHJ9tGYdLdTwor3qjMZ2o=
=zaGa
-END PGP SIGNATURE-
___
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 )

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.

___
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] Two ZEO instances running on same server?

2007-09-18 Thread Jonathan


- Original Message - 
From: michael nt milne [EMAIL PROTECTED]

Subject: Re: [Zope] Two ZEO instances running on same server?


The data.fs directories are both different though. It's only things like
site names and product listings that are being mirrored. Not actual site
content...


As Michael mentioned, this sounds like you have some ports (or ZODB mount 
points) set incorrectly. To confirm:


1- examine both Data.fs files and note the sizes and last modification times
2- make a change (that will affect the ZODB) in only one of the Zope 
instances
3- examine both Data.fs files.  Did the file size/modification time change 
in the expected Data.fs file and not change in the 'other' Data.fs file?



Jonathan





On 9/18/07, Martijn Pieters [EMAIL PROTECTED] wrote:


On 9/18/07, michael nt milne [EMAIL PROTECTED] wrote:
 What I get is site names etc displayed which haven't been created in
that
 instance and vice versa. When clicking on the site, no actual data is
 displayed and also skins aren't correct. It also looks like the
/Products
 directories are mirrored in ZOPE. However if I go into site set-up in
Plone
 and add/remove products the correct products are listed for each
instance.

Sounds like you'll need to double-check your ports, you have got some
wires crossed somewhere.

You can doublecheck this by looking at the Data.fs sizes and
modification times in both ZEO server instances, I suspect that you
have both your Zope clusters write to one Data.fs only.

--
Martijn Pieters





--
michael








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







No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.21/1012 - Release Date: 9/16/2007 
6:32 PM


___
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] Two ZEO instances running on same server?

2007-09-18 Thread Jonathan


- Original Message - 
From: michael nt milne [EMAIL PROTECTED]

To: zope list user zope@zope.org
Sent: Tuesday, September 18, 2007 9:25 AM
Subject: Re: [Zope] Two ZEO instances running on same server?



thanks for the help. Will carry out what you are saying


like you have some ports (or ZODB mount
points) set incorrectly.


ports all not conflicting

will check mountpoints..is this specified in the zope.conf?


Yes.  Also viewable via the ZMI (in the 'Add' drop-down list select 'ZODB 
Mount Point'), but less info there.


Jonathan

___
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] SOAPMethod

2007-09-04 Thread Jonathan


- Original Message - 
From: Mark Baldry [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, September 04, 2007 4:48 AM
Subject: Re: [Zope] SOAPMethod



Hi Tom

to be honest i would much rather use DTML as i understand this but it 
doesn't

seem to work it only returns the result of the SOAP query when i view the
source code. The SOAPMethod product recommends DTML but I have followed 
the

example they give and this is what is happening.


 I have installed the SOAPMethod and have got it working but i  cannot
 get the
 result to display. I can only view the result when i look at the
 source of
 the page.

 the dtml Method i am using is written -

 dtml-var expr=requestStudentData('5506239')

 this is what the help that came with the product says to use.

 (requestStudentData is the name of the SOAPMethod and 5506239 is 
 the

 query
 string i am passing to the database.)


If I understand correctly, you are saying that the requestStudentData method 
is returning the correct information, but that information is not displaying 
in your web browser, and that you can only see the information returned by 
requestStudentData if you view the source for the page.


If this is the case, then it sounds like an html/css display problem, not a 
dtml problem.  To verify this, create a dtml method that contains:


html
headtitleTesting/title/head
body
dtml-var requestStudentData('5506239')
/body
/html

If the information displays correctly when you click on the View tab for the 
above dtml method then you know that you have an html/css problem in your 
original dtml method.  If you don't see the correct information, then your 
'requestStudentData' method is not functioning correctly.


hth

Jonathan 


___
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] SOAPMethod

2007-09-04 Thread Jonathan


- Original Message - 
From: Mark Baldry [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Sent: Tuesday, September 04, 2007 8:00 AM
Subject: Re: [Zope] SOAPMethod



hi

that was the first thing i tried and it makes no difference i still get a
blank page with the response only viewable when i look at the source.

Mark

On Tuesday 04 September 2007 12:51, you wrote:

html
headtitleTesting/title/head
body
dtml-var requestStudentData('5506239')
/body
/html


Can you post the source of the 'blank' page?

Jonathan

___
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] SOAPMethod

2007-09-04 Thread Jonathan


- Original Message - 
From: Mark Baldry [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Sent: Tuesday, September 04, 2007 8:22 AM
Subject: Re: [Zope] SOAPMethod



hi

source of page

--


html
headtitleTesting/title/head
body
?xml version=1.0 encoding=ISO-8859-1?
uconnect_message  count=1person ccard_number=5506239
first_forename=Mark surname=Baldry school=UUEAS
friendly_email=[EMAIL PROTECTED] /
/uconnect_message
/body
/html


Your requestStudentData method is returning XML encoded data, so you need to 
write a dtml method (or script) that will display the xml fields.  This may 
give you some ideas:


http://www.xml.com/pub/a/1999/12/zope/index.html


Jonathan 


___
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] SOAPMethod

2007-09-03 Thread Jonathan


- Original Message - 
From: Tom Von Lahndorff [EMAIL PROTECTED]

To: robert rottermann [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Monday, September 03, 2007 12:10 PM
Subject: Re: [Zope] SOAPMethod




Hi Mark,

There's nothing wrong with using DTML instead of TAL. each have their 
drawbacks and benefits and it really comes down to user choice and  job 
requirements. People on this list though will always recommend  TAL 
because they are mostly developers who use WYSIWYG html editors.  If you 
hand code your design markup dtml can be much cleaner, require  less code 
and avoid annoying problems with javascript.


Tom


+1   ;-)


Jonathan




On Sep 3, 2007, at 10:10 AM, robert rottermann wrote:


Mark Baldry schrieb:
I need to get some information from a database and display it on  our 
website.
It's a very simple query just passing one number to get the  record. The 
only

way i am allowed to query this database is via SOAP.

I have installed the SOAPMethod and have got it working but i  cannot 
get the
result to display. I can only view the result when i look at the  source 
of

the page.

the dtml Method i am using is written -

dtml-var expr=requestStudentData('5506239')

this is what the help that came with the product says to use.

(requestStudentData is the name of the SOAPMethod and 5506239 is  the 
query

string i am passing to the database.)



you better do not use dtml but tal (aka page templates). to learn  about
it go to the zope site and look up the zope book (take the one on 
plope.org)


it would look something like:
html
  head
title tal:content=template/titleThe title/title
  /head
  body

bSome information on student 5506239/b
div tal:content=python:requestStudentData('5506239') /

  /body
/html


HTH
robert
robert.vcf
___
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 )



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 
269.13.3/986 - Release Date: 9/3/2007 9:31 AM





___
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] Help with DateTime.earliestTime()

2007-08-25 Thread Jonathan


- Original Message - 
From: Eric Thomas [EMAIL PROTECTED]

To: zope@zope.org
Sent: Saturday, August 25, 2007 8:18 AM
Subject: [Zope] Help with DateTime.earliestTime()


I've been having a site problem that I've tracked down to DateTime. 
Simply
enough, the code snippets below both try to add 31 days to the first day 
in

October.  I'm expecting this to result in the first day of November.

Good Example:


from DateTime import DateTime
start=DateTime('2005/10/01 01:00:00 GMT-5')
print start

2005/10/01 01:00:00 GMT-5

earlyStart=start.earliestTime()
print earlyStart

2005/10/01

print earlyStart+31

2005/11/01

Bad Example:  (Here's the problem)


from DateTime import DateTime
start=DateTime('2005/10/01 01:00:00 US/Central')
print start

2005/10/01 01:00:00 US/Central

earlyStart=start.earliestTime()
print earlyStart

2005/10/01

print earlyStart+31

2005/10/31 23:00:00 US/Central

I've confirmed this occurs with several of the US/ timezones (US/Pacific,
US/Alaska, etc)

Can anyone help me figure out why the resulting date is coming up 1 hour
short of the expected 2005/11/01 ?


I don't know what your problem is, but here are some code snippets I used to 
get around a timezone problem I was having:


# def custom timezone class
class LocalTimezone(datetime.tzinfo):
   def utcoffset(self, dt):
   STDOFFSET = datetime.timedelta(seconds = -_time.timezone)
   ZERO = datetime.timedelta(0)
   if _time.daylight:
   DSTOFFSET = datetime.timedelta(seconds 
= -_time.altzone)

   else:
   DSTOFFSET = STDOFFSET
   if self._isdst(dt):
   return DSTOFFSET
   else:
   return STDOFFSET

   def dst(self, dt):
   STDOFFSET = datetime.timedelta(seconds = -_time.timezone)
   ZERO = datetime.timedelta(0)
   if _time.daylight:
   DSTOFFSET = datetime.timedelta(seconds 
= -_time.altzone)

   else:
   DSTOFFSET = STDOFFSET
   if self._isdst(dt):
   DSTDIFF = DSTOFFSET - STDOFFSET
   return DSTDIFF
   else:
   return ZERO

   def tzname(self, dt):
   return _time.tzname[self._isdst(dt)]

   def _isdst(self, dt):
   tt = (dt.year, dt.month, dt.day,
   dt.hour, dt.minute, dt.second,
   dt.weekday(), 0, -1)
   stamp = _time.mktime(tt)
   tt = _time.localtime(stamp)
   return tt.tm_isdst  0


# usage code...
   Local = LocalTimezone()
   chkDate = datetime.datetime.now(Local)
   now = datetime.datetime.now(Local)

   # see if we have to apply a local timezone offset
   if tzo:
   # get the number of hours less than UTC (GMT)
   localTZO = int(chkDate.strftime('%z')[0:-2])

   # make sure we have the target tzo as an integer
   targetTZO = int(tzo)

   diffTZO = 0
   if targetTZO  localTZO:
   diffTZO = -(-targetTZO + localTZO)

   elif targetTZO  localTZO:
   diffTZO = (-localTZO + targetTZO)

   if diffTZO:
   # we have to adjust our dates to account for the 
time zone difference
   chkDate = chkDate + 
datetime.timedelta(hours=diffTZO)

   now = now + datetime.timedelta(hours=diffTZO)

   # create a time delta object (a date/time object that is a duration) 
for 6 months

   maxDate = datetime.timedelta(weeks=24)

   # check for events within a 6 month window
   while chkDate  now + maxDate:


This code was just ripped from an application, but may provide you with some 
ideas for a work-around.


Good luck!

Jonathan


___
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] How do I eval a variable within the acquisition path?

2007-08-21 Thread Jonathan


- Original Message - 
From: Tim Nash [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, August 21, 2007 7:17 PM
Subject: [Zope] How do I eval a variable within the acquisition path?



I apologize for the question (the zope area of my brain must need
coffee) but I can't find the answer in the zope book or in any of the
scripts posted to the zope cookbook.

I want to use a variable in a acquisition path.

So for example, from the zope book on scripts, imagine that
vaccinateplan() printed out a specific animals vaccination plan.

Now instead of saying 'LargeAnimals' and 'hippo' like so:

print context.Vet.LargeAnimals.hippo.vaccinateplan()

I want to do like this:

category = REQUEST.form['category']
animal = REQUEST.form['animal']

print context.Vet.category.animal.vaccinateplan()



but I get an Attribute Error. How do I eval a variable within the
acquisition path?


any items in a url after python script name will be placed into REQUEST.
Example:

if there is a python script called 'ptst' in the folder 'folderx'
then the url:   www.xyz.com/folderx/ptst/a/b/c
will result in the python script ptst being run and the following entry 
will be in REQUEST:

traverse_subpath ['a', 'b', 'c']

hth

Jonathan

___
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] How do I eval a variable within the acquisition path?

2007-08-21 Thread Jonathan


- Original Message - 
From: Tim Nash [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Tuesday, August 21, 2007 9:10 PM
Subject: Re: [Zope] How do I eval a variable within the acquisition path?



Thank you, that is cool but it isn't what I was looking for. My fault.
It is hard to describe. This may be called an indirect variable
reference.

I want the form to ask for the type of animal (hippo? giraffe?) and
send it to a python script. No problem here. I can write the form and
most of the script that is called. But this is where I have the
problem.

The python script will use the name of the animal to go down into the
proper folder and call vaccinateplan() on all the items in that
folder. The key line in the python script is:

print context.Vet.category.animal.vaccinateplan()

That runs the vaccinateplan script on the folder which has a folder id
of either 'hippo' or 'girafee'. And it is in the folder named by the
variable category and in the folder named 'Vet'

There is no folder with the id of 'category' or 'animal'

I'm sorry my explanations are not clear. And I shouldn't have used the
hippo and girafee example from the zope book because that is doing
something a little different. Below is the directory structure I am
thinking of.
Thanks!
Tim

vet
|
largeAnimal
|   |
|hippo
|girafee
|---small Animal
|
|--vacinateplan()


If you are dealing with a form then you could just direct the 'action' to 
point to the 'vacinateplan' script, then use REQUEST['animal'] or 
REQUEST.form['animal']


Alternatively... if u restructure your URLs so that they look like:

www.xyz.com/vacinateplan/hippo  or
www.xyz.com/vacinateplan/giraffe  etc

Then you can set up your python script (vacinateplan) to access the 
'animal' variable as follows:


print traverse_subpath[0]


It is also possible that i am unclear on your use case!

Jonathan

___
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] Re: Trouble migrating from Zope 2.5.x to Zope 2.9.x

2007-08-09 Thread Jonathan


- Original Message - 
From: Doug Morse [EMAIL PROTECTED]

To: Maurits van Rees [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Thursday, August 09, 2007 9:18 AM
Subject: Re: [Zope] Re: Trouble migrating from Zope 2.5.x to Zope 2.9.x



Hi Maurits,

Thanks for the speedy reply!

Hmmm... you make a good point about the ZODB file size.  At
installation, though, there was a notable difference.  The new,
default Data.fs was 2.9MB, whereas the mounted, older Data.fs
(renamed, of course) was/is 4.4MB.

I like your suggestion re: just upgrading though each minor release
number.  If someone doesn't suggest an alternative, speedier route,
then I'll do as you suggest.


I would try the following:

1) Create a new, clean 2.9.x installation
2) Copy the Data.fs file (your 2.5.x version)

And see if it works. It could be that your non-root installation is messing 
things up.  If you have any ZCatalogs you will need to fix up the indexes 
(see the READMEs, there was some change in 2.6? 2.8? that requires a utility 
to update the indexes).


Jonathan


___
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] debugging memory exhaustion

2007-08-09 Thread Jonathan


- Original Message - 
From: Chris Withers [EMAIL PROTECTED]

To: zope list user zope@zope.org
Sent: Thursday, August 09, 2007 12:09 PM
Subject: [Zope] debugging memory exhaustion



Hi All,

I'm suffering with an app server that keeps blowing through all its 
memory.


I have a suspicion this is due to a dodgy python script or page template 
pulling too many objects into memory. However, by the time I know to look, 
the app server throws MemoryErrors for each and every request.


What're the best ways to go about debugging this? Would DeadlockDebugger 
help or will it suffer from the same problem?


Of course, it'd be lovely if you could actually specify an upper memory 
bound for a particular request to use, and/or Zope as a whole, but these 
kinds of things always seem to stall at the development stage :-(


If you're running on a linux machine you could look into the ulimit command 
to limit the process memory utilization, which may allow you to see what it 
happening.



Jonathan 


___
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] debugging memory exhaustion

2007-08-09 Thread Jonathan


- Original Message - 
From: Chris Withers [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope list user zope@zope.org
Sent: Thursday, August 09, 2007 1:24 PM
Subject: Re: [Zope] debugging memory exhaustion



Jonathan wrote:


Of course, it'd be lovely if you could actually specify an upper memory 
bound for a particular request to use, and/or Zope as a whole, but these 
kinds of things always seem to stall at the development stage :-(


If you're running on a linux machine you could look into the ulimit 
command to limit the process memory utilization, which may allow you to 
see what it happening.


Er no, that would just exacerbate the problem.
The machine itself is functional, just with low memory.
Zope is throwing MemoryErrors because the OS won't give it anymore.
ulimit'ing zope would just make those MemoryErrors come sooner...


In your original post you said:

Of course, it'd be lovely if you could actually specify an upper memory
bound for a particular request to use, and/or Zope as a whole

If your server is still alive and Zope is throwing memory errors, then Zope 
has hit its specified upper memory limit.  What do you want Zope to do at 
this point?


Jonathan


___
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] debugging memory exhaustion

2007-08-09 Thread Jonathan


- Original Message - 
From: Chris Withers [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope list user zope@zope.org
Sent: Thursday, August 09, 2007 5:47 PM
Subject: Re: [Zope] debugging memory exhaustion



Jonathan wrote:

Of course, it'd be lovely if you could actually specify an upper memory
bound for a particular request to use, and/or Zope as a whole

If your server is still alive and Zope is throwing memory errors, then 
Zope has hit its specified upper memory limit.


No, Zope does little if anything to control the amount of memory it uses. 
If it did, we wouldn't see MemoryErrors ;-)


By Zope i meant the process running zope (i agree that Zope does not track 
process memory utilization!).




What do you want Zope to do at this point?


Start dumping objects out of the ZODB object cache when it reaches a 
certain memory limit, preferably configurable in zope.conf.


There is already a way to control (within limits) the number of objects in 
the ZODB cache, so you must be referring to something else? (ie. a way to 
control memory eating 'dodgy' scripts?).



Jonathan 


___
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] Export fails

2007-08-06 Thread Jonathan


- Original Message - 
From: Christian Schaffer [EMAIL PROTECTED]

Subject: Re: [Zope] Export fails


unfortunately, the zexp-file does not contain any of the children
objects. Re-importing the zexp-file leads to the following error:



We need some more information as to the type of object you are trying to 
export (eg. folder, ZClass instance, custom product instance, etc).




Site Error
An error was encountered while publishing this resource.
Error Type: AttributeError
Error Value: 'NoneType' object has no attribute 'id'


Include the full traceback.


Jonathan 


___
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] TOC ondelete event

2007-07-28 Thread Jonathan


- Original Message - 
From: [EMAIL PROTECTED]

To: zope zope@zope.org
Sent: Saturday, July 28, 2007 7:15 AM
Subject: [Zope] TOC ondelete event

I'm setting up a Session data Manager with a Transient Object Container 
that call a python script session_delete?

(sdo,toc).

I want to show a message like (your session was terminated due 
inactivity) so I tried to write this


#PYTHON SCRIPT (NOT EXTERNAL) session_delete(sdo,toc)
request = container.REQUEST
RESPONSE =  request.RESPONSE
RESPONSE.redirect(container.mywarningpage.absolute_url())

Launched manually it gives me no errors but when the session is terminated 
only onadd script make effects.


Are there not permitted operations in this case?
Could anyone explain me where I mistake or another way to do tha same 
thing? (AFAIK sdo parameter is the old

session so I can't store any info in it)


The TOC invokes your script when the data object timeout value is reached 
(eg. if the timeout value is set for 5 minutes, then the TOC will invoke the 
script to call when objects are deleted when there has been no activity 
for 5 minutes).


The TOC invokes the delete script as a result of the timeout, not because of 
an incoming user request and therefore there is no user to be 'redirected'. 
You are trying to push out a message to a user that is no longer there.


You need to revise your application logic so that if a user comes back 
(makes another request) after the 'timeout' they receive your warning 
message.


hth

Jonathan


___
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] TOC ondelete event

2007-07-28 Thread Jonathan


- Original Message - 
From: [EMAIL PROTECTED]

To: dev101 [EMAIL PROTECTED]
Cc: zope zope@zope.org
Sent: Saturday, July 28, 2007 8:51 AM
Subject: Re: [Zope] TOC ondelete event



Hi Jonathan,
I'm sure that what you said is right but
1) I tried to change my script performing a manage_add that should be 
performed after timeout. Nothing happened.


My guess is that there is a bug in your timeout script. Debugging scripts 
that get invoked on TOC timeout can be tricky.  I put my timeout routines in 
external methods so that I can easily write out debug info to a log file.




2) However the only way I see is:
  a- keep the session id in the request
  b- if request.savedsessionidsession.id then alert session timed out


If i understand correctly, what you are trying to accomplish is:

1- user starts a session and then has x minutes of inactivity
2- at x + 1 minutes the session timesout
3- at x+2 (or later) minutes the user restarts the session and you want to 
display a warning/timed-out message


If this is the case, then one possible solution (and there is always more 
than one solution!) is to store the session id in a cookie on the user's pc, 
then you could test: if cookieSessionId != session.id...



Jonathan

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


  1   2   3   4   5   6   7   8   >