[Zope-dev] Possible performance problem in Page Template engine?

2007-10-26 Thread Christian Scholz

Hi everybody!

When I was trying to fix portlets in Plone I was wondering why the 
render() method of my portlet actually gets called multiple times.


After a bit of investigation I ended up in the Five product in 
browser/providerexpressions.py where provider expressions also seem to 
be called twice for each provider statement.


The problem seems to be in Products/PageTemplates/Expressions.py in line 
199/200 (in Zope 2.10.4):


def evaluateStructure(self, expr):
 customized version in order to get rid of unicode
errors for all and ever

text = super(ZopeContext, self).evaluateStructure(expr)
return self._handleText(text, expr)

This construct seems to evaluate expr twice. One time in 
evaluateStructure() of the super class which is basically a call to 
self.evaluate(expr) (to be found in zope/tales/tales.py around line 713:


def evaluateStructure(self, expr):
return self.evaluate(expr)

and then again in _handleText():

def _handleText(self, text, expr):

text = self.evaluate(expr)

...

I now tried to remove the evaluation of expr in handleText() and in a 
very simple test using ab on my site I got twice the speed!


I might be missing something here of course but if every expression is 
evaluated twice then this is of course huge performance drain. And of 
course this fix was just a quick idea without much understanding of the 
underlying engine (e.g. not knowing if _handleText() is also called from 
somewhere else etc.)


So any Page Template experts here who can confirm this?

cheers,

Christian


--
Christian Scholz video blog: http://comlounge.tv
COM.lounge   blog: http://mrtopf.de/blog
Luetticher Strasse 10Skype: HerrTopf
52064 Aachen  Homepage: http://comlounge.net
Tel: +49 241 400 730 0   E-Mail [EMAIL PROTECTED]
Fax: +49 241 979 00 850   IRC: MrTopf, Tao_T

connect with me: http://mrtopf.de/connect


___
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-dev] Re: Possible performance problem in Page Template engine?

2007-10-26 Thread Christian Scholz
Ok, little correction here: I used ploneout on plone-trunk and it then 
uses Zope trunk and thus 2.11.


This problem seems to be a new problem coming from refactoring:

r78767 | andreasjung | 2007-08-12 12:55:45 +0200 (So, 12 Aug 2007) | 4 lines

- Collector #2339: ZPT: fixed unicode issue when using the 'structure' 
directive
- ZopeContext: added evaluateStructure() and refactored _handleText() in 
order

to deal with unicode issues when using the 'structure' directive

-- christian

___
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-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
Hi list! :)

I am just playing around with Ape (very cool, btw :) and wondering
how it can be used from the outside, e.g. not controlled by transactions.
Main idea is to manually copy parts of the ZODB to the filesystem (from
a product).

I first tried the transaction based process, as I found it in
some tests:

# init (createMapper imported from fsmapper)
root_mapper, conns = createMapper(fspath)
conn=conns['fs']
resource = StaticResource(root_mapper)
storage = ApeStorage(resource, conns)
db = ApeDB(storage, resource)
get_transaction().begin()

# test object to store
object = getattr(self,'standard_template.pt')

c=db.open()
app=c.root()['Application']
id=object.getId()
app._setObject(id,object.aq_base,set_owner=0)
get_transaction().commit()
db.close()

which actually stores it but does not seem to me that clean because of
all the transaction stuff. I would here then recursively run through
all the objects and do that inside one transaction.

I then detected the fascades in io.py which I tried to use (dunno if they're
thought to be used for such a purpose actually ;-):

root_mapper, conns = createMapper(fspath)
ei=ExportImport(root_mapper,conns)
ei.exportObject(object)

Unfortunately this results in an exception 

Type: MappingError
Error Value: Path keychains require a name

So can maybe somebody point me to the easiest way to serialize an object
using the fsmapper (Shane? ;-) ?

I am also interested in reading a serialized object from the fs again
and writing it to the fs. Also I wonder if I need to delete objects which
have been modified before another export or if there's a possibility to
just change it).

(and the best would be of course some simple methods for reading/writing
a whole directory recursively. I don't know if something like this is already
in there somehow or how it works internally.. seems all a bit magic to me ;-)

So thanks in advance if anybody can help me :)

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
Hi!

I actually now have a (as it seems) working version of my first
approach, just using _setObject() etc. which even works recursively.
Has this some drawbacks except it looks a bit like a hack due to the
call of commit()?
I also have the deserialization working and basically it's just a 
copying between two ZODBs I'd say.

On Wed, Jun 11, 2003 at 10:12:46AM -0400, Shane Hathaway wrote:
 Christian Scholz wrote:
  I then detected the fascades in io.py which I tried to use (dunno if they're
  thought to be used for such a purpose actually ;-):
  
  root_mapper, conns = createMapper(fspath)
  ei=ExportImport(root_mapper,conns)
  ei.exportObject(object)
 
 This is *exactly* the purpose ExportImport is meant for, but it's quite 
 new and unfinished.  I'm glad you found it, although it's only in CVS, 
 not in the released version of Ape.

Well, I am looking a bit on the repository and was reading
log messages ;-)

  Unfortunately this results in an exception 
  
  Type: MappingError
  Error Value: Path keychains require a name
  
  So can maybe somebody point me to the easiest way to serialize an object
  using the fsmapper (Shane? ;-) ?
 
 You're on the right track.  I wonder what went wrong.

I looked into that a bit and in core/io.py line 316 you do

   return kgen.makeKeychain(event, None, 1)

so name is None here as it seems. I just dunno if it's a special case
because I was doing something wrong or not ;-)

  I am also interested in reading a serialized object from the fs again
  and writing it to the fs. Also I wonder if I need to delete objects which
  have been modified before another export or if there's a possibility to
  just change it).
 
 Ape will assign new OIDs on import, so you don't have to delete objects 
 first.

Well, at least with my first approach I need to do that because I just
do a folder._setObject() and this fails then of course.

  (and the best would be of course some simple methods for reading/writing
  a whole directory recursively. I don't know if something like this is already
  in there somehow or how it works internally.. seems all a bit magic to me ;-)
 
 Again, ExportImport is designed to do this.

Will it also do it recursively? I found out that when I do it via
folder._setObject() it will also serialize all content which is quite
nice :)
What is actually the result of an export? Where in the fs is it stored then?
Is the whole path to the object in ZODB is taken ?

But thanks for the answer and thanks for Ape! :)

-- christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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-dev] serialization with Ape

2003-06-11 Thread Christian Scholz
Hi again!

 Christian Scholz wrote:
  root_mapper, conns = createMapper(fspath)
  ei=ExportImport(root_mapper,conns)
  ei.exportObject(object)
 
 Ah-ha, I just realized what went wrong.  You need to tell exportObject() 
 where to export.  PathKeychainGenerator refused to guess.  Try changing 
 the last line to:
 
  ei.exportObject(object, keychain=('some/path/under/fspath',))

I now tested it and had the following results:

- the last item of the path needs to be the same id as the object has
- only objects derived from Objectmanager in the end can be serialized.
- they are not written to disk as long as I don't do

conns['fs'].vote()
conns['fs'].finish()

After that it worked quite well :)

I now did the import the other way round with

obj=ei.importObject(keychain)

and then using _setObject with that object in order to store it again
in the usual ZODB (Data.fs). Is this ok? Or do I again need to do some copy?

 It's still obtuse.  I'll think about how to make that cleaner.

Well, for me the whole thing actually is magic. But maybe it helps
if there is an example of usage in the docstring. 

But it seems working now, so fine :-)

Thanks again!

Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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-dev] Zope crash in select_trigger

2001-11-06 Thread Christian Scholz

Hi!

I once had similar problems and as far as I remember also
with SuSE 6.4. I think it stopped when using SuSE 7.1
(and 7.0 had the problems, too I think). I was using
python 1.5.2 and various Zope versions.. so maybe the
pymalloc hint would have worked for me then, too.
Actually the crashes were some sort of non deterministic
and did not depend on load etc.

Unfortunately I don't know any details anymore.. I might test
this again sometime and give you a note.
(maybe there also some old mails from me in the archive explaining
some more details but as I am on a text terminal right now I haven't
looked..)

greetings!

Christian

On Tue, Nov 06, 2001 at 12:00:40PM -0800, Mark Mitchell wrote:
 
 
 --On Tuesday, November 06, 2001 02:58:11 PM -0500 Chris McDonough 
 [EMAIL PROTECTED] wrote:
 
  Hi mark,
 
  Which OS, and which Zope version?  I dont have an answer at all right
  now, but I'd like to start collecting info.  If anybody else has this
  problem, can they also provide platform and Zope version?
 
 From the control panel:
 
 Zope version: (Zope 2.4.2 (binary release, python 2.1, linux2-x86), python 
 2.1.0, linux2)
 Python version: 2.1 (#2, Jun 22 2001, 10:20:42) [GCC 2.7.2.3]
 System Platform: linux2
 
 The system is SuSE Linux 6.4 with their most recent kernel patch, i.e,
 the 2.2.19 kernel.
 
 -- 
 Mark Mitchell[EMAIL PROTECTED]
 CodeSourcery, LLChttp://www.codesourcery.com
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



[Zope-dev] cycles and mem leaks and Zpatterns..

2001-06-13 Thread Christian Scholz

Hi!

As some of you might know, I still have my mem leak problem..
I've now looked again at some code and discovered some cycle in
ZPatterns.. 

Means: I have a Price class and some PriceWinner class, which reference
   each other via some SkinScript.

Could this lead to a leak then? I am not sure at the moment if the backlink to
the price is used somewhere.. 

At least I will try to eliminate it now and maybe replace the price attribute
in the winner class by some method which returns the price.. (hope, this is no
problem then..)

regards,
  Christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] memory eating Zope..

2001-06-04 Thread Christian Scholz

Hi!

 It looks like you're leaking requests.  This is often the consequence of
 setting an attribute on the REQUEST object which is aquisition wrapped. 
 For instance:
 
 REQUEST.adtmldoc = REQUEST['PARENTS'][0]
 
 When requests leak, references to all the objects referenced within the
 request (acquisition wrappers, etc.) leak as well.  This can be
 disastrous and gets worse when the site is busy (when there are more
 requests).  

ok, that's what I experienced.. the day the site got some more
traffic it also suddenly grow memorywise.
I also didn't know that doing above is a bad thing to do..
(though I don't actually understand why this is a problem and why it's
not freed then.. but on the other hand I am not that much into the
inner workings of acquisition ;-)

 It used to be the case that tracking this problem down was tediously
 difficult, and involved basically a binary search for leaks in all
 methods on the site.  But now, finding the cause is likely a job for
 Shane's LeakFinder product:  
 http://www.zope.org/Members/hathawsh/LeakFinder .

Ah, will try that out :)
And actually I directly found some method which fetches the actual
user object from a ZPatterns rack and sets this in the REQUEST at
every request. So maybe that's already the problem then.. will try
to remove that..

 Note that this is likely caused by some sort of brainbending circular
 reference problem that might be helped by Python 2.X's cyclic garbage
 collector.

Well, will also try out python 2.x then... (btw. are all 2.x python versions
working without problems with Zope? Don't want to get a new problem when
resolving the old one ;-)

Thanks!

Christian


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



[Zope-dev] memory eating Zope..

2001-06-03 Thread Christian Scholz

Hi there!

I got another problem with my Zope server and that seems to be
a memory hole.. 

I am using Zope 2.3.2 with Python 1.5.2 now on SuSE 7.0 (this
seems to solve the hanging problem, which appeared on 7.1) and
I use Python Script, ZSQL methods, ZMySQLDA and ZPatterns.

Now using top I see over time how the memory consumption of the
zope processes grows, which means I have to restart once a day
as it then becomes too slow..

When looking at the refcount in the debug section I see the following:

Acquisition.ImplicitAcquirerWrapper: 7509
DocumentTemplate.DT_Util.Eval: 719
Products.ZPatterns.Expressions.Expression: 716
ZPublisher.HTTPRequest.HTTPRequest: 457
ZServer.HTTPResponse.ZServerHTTPResponse: 450
ZPublisher.BaseRequest.RequestContainer: 447

So Acquisition.ImplicitAcquirerWrapper seems to be referenced
quite often (this is in an early state..)

So does anybody know what this might cause? Or maybe how to track that
problem down? 

(seems to be a long way with that server to become it stable.. ;-)

Thanks in advance!

Christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



[Zope-dev] dtml-in bug?

2001-05-28 Thread Christian Scholz

Hi!

Dunno if it's again my strange setup, but I have some problem with dtml-in or
maybe I simply didn't get something right..

Well, I used the following dtml code:

html
dtml-in expr=[1,2,3,4,5,6] size=4
abr
/dtml-in
/html


and I thought I will get three a's as output.. instead I get 6..
If I do size=3 it's ok (3 output), if I do size=4 or 5 or 6 I get
them all..
(actually it happened with some more complex list of Result objects but
 this seems to do the same here)

Can someone explain that to me..?

(it's Zope 2.3.2, Python 1.5.2, SuSE Linux 7.0)

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] dtml-in bug?

2001-05-28 Thread Christian Scholz

Hi!

ok, some more people told me now about it.. ;-)

It's not that intuitive nevertheless.. (IMHO) ;-)

cheers and thx,
  Christian

On Mon, May 28, 2001 at 05:20:39PM +0200, Tino Wildenhain wrote:
 Hi Christian,
 
 --On Montag, 28. Mai 2001 15:38 +0200 Christian Scholz [EMAIL PROTECTED] 
 wrote:
 
  Hi!
 
  Dunno if it's again my strange setup, but I have some problem with
  dtml-in or maybe I simply didn't get something right..
 
  Well, I used the following dtml code:
 
  html
  dtml-in expr=[1,2,3,4,5,6] size=4
  abr
  /dtml-in
  /html
 
 
 *rustle* try orphan=0 :-)
 
 Greetings
 Tino
 
  and I thought I will get three a's as output.. instead I get 6..
  If I do size=3 it's ok (3 output), if I do size=4 or 5 or 6 I get
  them all..
  (actually it happened with some more complex list of Result objects but
   this seems to do the same here)
 
  Can someone explain that to me..?
 
  (it's Zope 2.3.2, Python 1.5.2, SuSE Linux 7.0)
 
  cheers,
Christian
 
  --
  COM.lounge  http://comlounge.net/
  communication  design [EMAIL PROTECTED]
 
  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope )
 
 
 
 

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] getPersistentItemIDs not cooperating?

2001-05-23 Thread Christian Scholz

Hi!

 It works.. partially. For some reason it looks like getPersistentItemIDs 
 does not always return a *complete* list. I need to run this method 
 several times to completely exhaust the Rack's storage. Thoughts? The 
 only way I ever create Track objects is via a different method that is 
 only accessed once (a long time ago!)

Well, I experiences something similar when changing a Racks storage
from persistent to non-persistent. The included objects are marked
as orphaned then and should be deleted with the Clear-Button. This
also works, but only the half of them gets deleted every time I click
on that button.. So I also have to press it several times.. Sounds like
the same problem.. 

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-18 Thread Christian Scholz

Hi!

Just FYI: The server still hangs once a day and another one is doing
the same.. 
It even does this when simply accessing one page or image over and over
again.
More precisely I've started the server and did

ab -n 10 -c 10 http://foo.bar/we/pics/someimg.gif

(ab being the apache benchmarking utility)

and after a while I get the broken pipe error.

I've also changed my python version to 2.0 and tested it with this
but still the same effect. Also changing the server (and thus
hardware and system) did not help it.
I've also removed the mysqlda from the zope installation but also this
did not help.. 
I will try now to create the smallest version of the site that still hangs..

Dunno if anybody has some idea, I actually have none.. 

I'll keep you informed..

-- christian

PS: strangely it works on the development server but also here I am doing 
some tests with ab right now.. and this one is still 1.5.2


On Thu, May 03, 2001 at 02:16:30PM -0400, Chris McDonough wrote:
  Well, my problem might be that in my case most sql statement are done
 inside
  some attribute provider of ZPatterns.. This is using ZSQL methods
 internally
  but actually those then won't show up I guess..
 
 Even if you weren't using ZPatterns, the error probably wouldn't jump out
 and say here I am!  So I don't think there's much difference between using
 ZPatterns and not using ZPatterns.  The process of detecting when something
 hangs is just like any other troubleshooting process, it's a matter of
 exclusion.  If you notice that the request named foobargorf/fleafang
 *always* hangs, you investigate what it does, and try to reproduce it.  If
 it's incidental, so be it, and move on to the next theory.
 
 
  I've also seen that some more recent version of the mysql stuff is around
  and I am using this now..
 
  The problem's also that I just have a few methods to invoke from the
 outside
  which do lots of things by calling other object. Thus I might not really
 see
  what's really causing the problem.. I hope though that my upgrade will
 show some
  benefit..
 
 The -M log perhaps won't show you the actual operation that's causing the
 hang, but it will show you the entry point into a routine which causes the
 hang.  It's your job from there to track down the cause.  This is just like
 debugging a program.  You get an error somewhere, and you need to track it
 back to its root, which may be six levels up the call stack buried in some
 godforsaken regex.  ;-)
 
 
 

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-18 Thread Christian Scholz

Hi!

 Is there any evidence of any sort of relationship between the broken pipe
 error and the hang?  Do they happen at the same time?  Or do they have no
 discernable relationship with one another?  How about memory utilization?
 Is the process leaking memory?

yes, they happen at the same time..

I've also stripped it down and removed evertyhing and put some test.gif
up there.. Then running ab against it created again a broken pipe (quite soon).

looking via top the memory utilization seems ok..

-- christian

PS: with this test.gif it seems to hang very quickly..
PPS: ab tests on my development host are still running without problems.. strange..


 
 - Original Message -
 From: Christian Scholz [EMAIL PROTECTED]
 To: Chris McDonough [EMAIL PROTECTED]
 Cc: Christian Scholz [EMAIL PROTECTED]; Tino Wildenhain
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, May 18, 2001 10:13 AM
 Subject: Re: [Zope-dev] another Zope hanging..
 
 
  Hi!
 
  Just FYI: The server still hangs once a day and another one is doing
  the same..
  It even does this when simply accessing one page or image over and over
  again.
  More precisely I've started the server and did
 
  ab -n 10 -c 10 http://foo.bar/we/pics/someimg.gif
 
  (ab being the apache benchmarking utility)
 
  and after a while I get the broken pipe error.
 
  I've also changed my python version to 2.0 and tested it with this
  but still the same effect. Also changing the server (and thus
  hardware and system) did not help it.
  I've also removed the mysqlda from the zope installation but also this
  did not help..
  I will try now to create the smallest version of the site that still
 hangs..
 
  Dunno if anybody has some idea, I actually have none..
 
  I'll keep you informed..
 
  -- christian
 
  PS: strangely it works on the development server but also here I am doing
  some tests with ab right now.. and this one is still 1.5.2
 
 
  On Thu, May 03, 2001 at 02:16:30PM -0400, Chris McDonough wrote:
Well, my problem might be that in my case most sql statement are done
   inside
some attribute provider of ZPatterns.. This is using ZSQL methods
   internally
but actually those then won't show up I guess..
  
   Even if you weren't using ZPatterns, the error probably wouldn't jump
 out
   and say here I am!  So I don't think there's much difference between
 using
   ZPatterns and not using ZPatterns.  The process of detecting when
 something
   hangs is just like any other troubleshooting process, it's a matter of
   exclusion.  If you notice that the request named foobargorf/fleafang
   *always* hangs, you investigate what it does, and try to reproduce it.
 If
   it's incidental, so be it, and move on to the next theory.
  
   
I've also seen that some more recent version of the mysql stuff is
 around
and I am using this now..
   
The problem's also that I just have a few methods to invoke from the
   outside
which do lots of things by calling other object. Thus I might not
 really
   see
what's really causing the problem.. I hope though that my upgrade will
   show some
benefit..
  
   The -M log perhaps won't show you the actual operation that's causing
 the
   hang, but it will show you the entry point into a routine which causes
 the
   hang.  It's your job from there to track down the cause.  This is just
 like
   debugging a program.  You get an error somewhere, and you need to track
 it
   back to its root, which may be six levels up the call stack buried in
 some
   godforsaken regex.  ;-)
  
  
  
 
  --
  COM.lounge  http://comlounge.net/
  communication  design [EMAIL PROTECTED]
 
 

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-18 Thread Christian Scholz

Hi!

Hm, another strange thing..

I've now tried to start Zope via the normal ./start script.
(I've done it via some own script with INSTANCE_HOME set).

What I've got was:

bash-2.04# ./start
--
2001-05-18T14:59:49 PANIC(300) z2 Startup exception
Traceback (innermost last):
File /opt/zopeneu/z2.py, line 566, in ?
File string, line 1, in ?
File /opt/zopeneu/lib/python/Zope/__init__.py, line 94, in ?
File /opt/zopeneu/lib/python/ZODB/__init__.py, line 85, in ?
ImportError: undefined symbol: PyObject_Init

So what does this want to tell me? ;-)

I've also done the following before that:

- delete Data.fs in my instance home
- create a new user
- create a folder
- put an image (test.gif) into that folder
- started the test on that image

= hang

I've also removed any products I don't need which still have been installed..

-- christian




On Fri, May 18, 2001 at 10:49:23AM -0400, Chris McDonough wrote:
 Is there any evidence of any sort of relationship between the broken pipe
 error and the hang?  Do they happen at the same time?  Or do they have no
 discernable relationship with one another?  How about memory utilization?
 Is the process leaking memory?
 
 - Original Message -
 From: Christian Scholz [EMAIL PROTECTED]
 To: Chris McDonough [EMAIL PROTECTED]
 Cc: Christian Scholz [EMAIL PROTECTED]; Tino Wildenhain
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, May 18, 2001 10:13 AM
 Subject: Re: [Zope-dev] another Zope hanging..
 
 
  Hi!
 
  Just FYI: The server still hangs once a day and another one is doing
  the same..
  It even does this when simply accessing one page or image over and over
  again.
  More precisely I've started the server and did
 
  ab -n 10 -c 10 http://foo.bar/we/pics/someimg.gif
 
  (ab being the apache benchmarking utility)
 
  and after a while I get the broken pipe error.
 
  I've also changed my python version to 2.0 and tested it with this
  but still the same effect. Also changing the server (and thus
  hardware and system) did not help it.
  I've also removed the mysqlda from the zope installation but also this
  did not help..
  I will try now to create the smallest version of the site that still
 hangs..
 
  Dunno if anybody has some idea, I actually have none..
 
  I'll keep you informed..
 
  -- christian
 
  PS: strangely it works on the development server but also here I am doing
  some tests with ab right now.. and this one is still 1.5.2
 
 
  On Thu, May 03, 2001 at 02:16:30PM -0400, Chris McDonough wrote:
Well, my problem might be that in my case most sql statement are done
   inside
some attribute provider of ZPatterns.. This is using ZSQL methods
   internally
but actually those then won't show up I guess..
  
   Even if you weren't using ZPatterns, the error probably wouldn't jump
 out
   and say here I am!  So I don't think there's much difference between
 using
   ZPatterns and not using ZPatterns.  The process of detecting when
 something
   hangs is just like any other troubleshooting process, it's a matter of
   exclusion.  If you notice that the request named foobargorf/fleafang
   *always* hangs, you investigate what it does, and try to reproduce it.
 If
   it's incidental, so be it, and move on to the next theory.
  
   
I've also seen that some more recent version of the mysql stuff is
 around
and I am using this now..
   
The problem's also that I just have a few methods to invoke from the
   outside
which do lots of things by calling other object. Thus I might not
 really
   see
what's really causing the problem.. I hope though that my upgrade will
   show some
benefit..
  
   The -M log perhaps won't show you the actual operation that's causing
 the
   hang, but it will show you the entry point into a routine which causes
 the
   hang.  It's your job from there to track down the cause.  This is just
 like
   debugging a program.  You get an error somewhere, and you need to track
 it
   back to its root, which may be six levels up the call stack buried in
 some
   godforsaken regex.  ;-)
  
  
  
 
  --
  COM.lounge  http://comlounge.net/
  communication  design [EMAIL PROTECTED]
 
 

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-18 Thread Christian Scholz

Hi!

Another test without apache inbetween is still running now..
Could apache and it's proxypass be the problem?

I am simply using ProxyPass and ProxyPassReverse in front
of Zope in a simple virtual site environment..

Apache version is 1.3.19

Where is the bug then? In Zope or in Apache?
I also have other servers running like that for ages
without problems though it's another host and thus another
apache version.

cheers,
  Christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



[Zope-dev] another Zope hanging..

2001-05-03 Thread Christian Scholz

Hi!

I also now have some problems with a hanging zope.

I got something like this in my stupid logfile:

2001-05-03T13:44:39 ERROR(200) ZServer uncaptured python exception, closing channel 
select-trigger (pipe) at 81d64c8 (exceptions.OSError:[Errno 11] Die Ressource ist 
zur Zeit nicht verf?gbar [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|poll|83] 
[/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|handle_read_event|335] 
[/opt/Zope-2.3.1-src/ZServer/medusa/select_trigger.py|handle_read|77] 
[/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|287] 
[/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|475])

Now my question is simply if I can catch this exception somewhere and get some 
traceback etc.
Actually I am quite confused from the inner workings of medusa so I dunno where to 
start
searching.

Can anyone help?

(I know about the -M logging but unfortunately this does not help that much..)

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-03 Thread Christian Scholz

Hi!

 What Python version are you using?

That's 1.5.2

MySQLDA is MySQL-python-0.3.3.tar.gz and ZMySQLDA-2.0.4.tar.gz

(if this makes any problems..)

Zope is 2.3.1 as suerly have noticed.. :)

cheers,
  christian


 - Original Message -
 From: Christian Scholz [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, May 03, 2001 11:05 AM
 Subject: [Zope-dev] another Zope hanging..
 
 
  Hi!
 
  I also now have some problems with a hanging zope.
 
  I got something like this in my stupid logfile:
 
  2001-05-03T13:44:39 ERROR(200) ZServer uncaptured python exception,
 closing channel select-trigger (pipe) at 81d64c8
 (exceptions.OSError:[Errno 11] Die Ressource ist zur Zeit nicht verf?gbar
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|poll|83]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|handle_read_event|335]
 [/opt/Zope-2.3.1-src/ZServer/medusa/select_trigger.py|handle_read|77]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|287]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|475])
 
  Now my question is simply if I can catch this exception somewhere and get
 some traceback etc.
  Actually I am quite confused from the inner workings of medusa so I dunno
 where to start
  searching.
 
  Can anyone help?
 
  (I know about the -M logging but unfortunately this does not help that
 much..)
 
  cheers,
Christian
 
  --
  COM.lounge  http://comlounge.net/
  communication  design [EMAIL PROTECTED]
 
  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope )
 
 

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-03 Thread Christian Scholz


Maybe another general question:

How are exceptions handled which appear in your own products and you don't catch them?
Is there some except somewhere on top ?

How does this look if you're using ZPatterns with your own attribute providers (as I do
with my sql attribute provider). Are these all handled somehow?
(usually I get some sort of traceback on the console/stupid log is something goes wrong
there and I don't handle it myself.. hope it's in general..)

cheers,
  Christian

On Thu, May 03, 2001 at 11:23:54AM -0400, Chris McDonough wrote:
 What Python version are you using?
 
 - Original Message -
 From: Christian Scholz [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, May 03, 2001 11:05 AM
 Subject: [Zope-dev] another Zope hanging..
 
 
  Hi!
 
  I also now have some problems with a hanging zope.
 
  I got something like this in my stupid logfile:
 
  2001-05-03T13:44:39 ERROR(200) ZServer uncaptured python exception,
 closing channel select-trigger (pipe) at 81d64c8
 (exceptions.OSError:[Errno 11] Die Ressource ist zur Zeit nicht verf?gbar
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|poll|83]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|handle_read_event|335]
 [/opt/Zope-2.3.1-src/ZServer/medusa/select_trigger.py|handle_read|77]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|287]
 [/opt/Zope-2.3.1-src/ZServer/medusa/asyncore.py|recv|475])
 
  Now my question is simply if I can catch this exception somewhere and get
 some traceback etc.
  Actually I am quite confused from the inner workings of medusa so I dunno
 where to start
  searching.
 
  Can anyone help?
 
  (I know about the -M logging but unfortunately this does not help that
 much..)
 
  cheers,
Christian
 
  --
  COM.lounge  http://comlounge.net/
  communication  design [EMAIL PROTECTED]
 
  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope )
 
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] another Zope hanging..

2001-05-03 Thread Christian Scholz

Hi!

  most problems with hanging zope come from external RDBMS-access.
 
 Lots do, but lots don't...
 
  You wont see anything useful in the logs because there are
  some objects published before the *sql-method is hanging.
 
 If you see a request come into ZServer, and you see the request go into
 ZPublisher from ZServer, but ZPublisher never returns any data to ZServer,
 that's an indication that something is wrong.  A SQL method hanging would
 look like this, it's the same thing as any other Zope component hanging.
 
 The big-M log is your friend, even in this case.  As a matter of fact,
 it's *especially* your friend in this case because it will be patterned
 against one or a few methods, which is an easy problem to track down.

Well, my problem might be that in my case most sql statement are done inside
some attribute provider of ZPatterns.. This is using ZSQL methods internally
but actually those then won't show up I guess..

I've also seen that some more recent version of the mysql stuff is around
and I am using this now..

The problem's also that I just have a few methods to invoke from the outside
which do lots of things by calling other object. Thus I might not really see
what's really causing the problem.. I hope though that my upgrade will show some
benefit..
(strangely on my development server these problems did not arise.. might have
to check for any differences between the two..)

I will keep cheking the -M anyway (as it seems all I can do..  ;-)

cheers,
  Christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns AttributeProvider question

2001-04-23 Thread Christian Scholz

Hi!

So here's more :)

 def _objectAdding(self,client,
 _tmap={ None:AddedStatus,
 DeletedStatus:ChangedStatus,
 ChangedStatus:AddedStatus
 }
 ):
 t = client._getTokenFor(self)
 s = t.status
 t.status = _tmap.get(s,s)
 
 # we need to do a commit here in order to store the record into
 the database!
  # and we need to have it stored as an AttributeFor() of the primary key will
  # return None otherwise (as this also just makes a query).
 client.commitSubtransaction()
 
 This is broken.  Don't do this!  commitSubtransaction() is an
 application-level operation.  Only.  If you have to use it inside of
 provider-level code or code called from SkinScript, chances are that you
 are doing something horribly wrong.  You run the risk of causing a
 recursive commit operation in the Zope transaction machinery.  Don't do this!

well, it always looked no-good to me, I just didn't know how to solve my problem.

So my problem I was trying to fix was actually the following:

- When creating a new object via newItem(), the Rack checks if self.loadAttrib is 
defined
  before creating a new one.
  if loadAttrib is returned by the attribute provider then the Rack assumes it already
  exists and raises an exception.

- My Attribute Provider now does not know if an object exists or not before looking 
into
  the database (I tried different ways to check it but somehow they haven't worked).
  So it does that. If it finds a record with the given id it returns it, if not it 
returns
  the default value (which means does not exist to the rack).

- When adding a new object in my provider it does an insert via an ZSQL method
  to store it inside the database. This is done in _objectAdded().
  Unfortunately this is too late as before this is called, we already need to have
  it in the database as the request to my primary key will return the default still.
  So I moved this insert to _objectAdding().
  Unfortunately this new record seems not to appear in the database before commit()
  (dunno why, maybe some new transaction code in ZMySQLDA? haven't checked this).
  That's why I did a commit() there which then called _objectAdded().

So my problem is basically that I need to know in _AttributeFor() whether this
object is already created or not.. I will check now again with asking the status
of the client but I think I also tried this before.
The best would be to collect all data before _objectAdded() and store it at once
and not as it's done now by first creating an empty record and doing the rest
via _objectChanged().

But I am open for any other idea :) 

 def _SetAttributeFor(self,client,name,value):
 Set the attribute and return true if successful
  # attribs stores the attributes we care about
 if name in self._attribs.keys():
 client._getCache()[name]=value
 client.__dict__[name]=value; 
  client._p_changed = 1
 return 1
 return None
 
 This also looks broken to me.  Why are you changing both the cache and the
 persistent state?  There's no reason to do both.

ok, this is old code where I wanted to test some other solution to fix my problem.
I will remove the additional line.. (__dict__ might be all I need, it's already a cache
if I remember right?!?)


 I think you're seriously over-engineering this.  I don't see anything that
 you're doing here that couldn't be done more easily with SkinScript
 statements.  If all you want to do is store the data in an SQL database, a
 few SkinScript triggers would suffice.

Well, as mailed yesterday I know this. I've also done this a lot but was then
tired of always typing those paramater lists (for each ZSQL method, for each SkinScript
call twice, ...).
This is of course always the tradeoff between easy to use plugins which are somehow
restricted and the more flexible ones which do need lots of configuration.
I would like to have the first one for the day-to-day-stuff and the latter
for more advanced operations, like linking specialists together etc.

 Now, if you're trying to get a row to be inserted in an SQL database at the
 actual time of the newItem() call, there is a trick you can use to do that
 from SkinScript also.  Do this:
 
 INITIALIZE OBJECT WITH someAttr1=default1,
 someAttr2=default2,...,dummyAttributeName=myInsertQuery(primaryKey=self.id)
 
 Where myInsertQuery() is an SQL insert query that takes primaryKey as a
 parameter, and dummyAttributeName is some attribute name you don't care
 about.  You should also set any default values for fields that will be
 inserted.  Your insert query will be called, initializing the row in the
 database, and then use something like this:
 
 WHEN OBJECT ADDED,CHANGED STORE foo,bar,baz USING
 UpdateMethod(widget_id=self.id, foo_field=self.foo, wbar=self.bar)
 
 
 To update the data at transaction commit time.  Voila.  No need to make any
 custom attribute 

Re: [Zope-dev] ZPatterns AttributeProvider question

2001-04-22 Thread Christian Scholz

Hi!

A little update..

Actually I was mistaken and SetAttributeFor() is called. Just _objectChanged()
is not called in that case.. and thus my attributes are not stored to the database.
Also commit() is not called at all in this case. It get's called once when the
subtranscation is committed but not after some data has changed (which happens
after that).

Printing _v_status_ in SetAttributeFor() also gives me "Changed", thus this seems
right.

Maybe some more code will help (just the important pieces):

def _objectAdded(self,client):
""" store cached data in database """

... here we do an sql query to insert things in database ...

def _objectChanged(self,client):
""" store cached data in database """

... here we do an sql query to update things in database ...

def _objectAdding(self,client,
_tmap={ None:AddedStatus,
DeletedStatus:ChangedStatus,
ChangedStatus:AddedStatus
}
):
t = client._getTokenFor(self)
s = t.status
t.status = _tmap.get(s,s)

# we need to do a commit here in order to store the record into the database!
# and we need to have it stored as an AttributeFor() of the primary key will
# return None otherwise (as this also just makes a query).
client.commitSubtransaction()

def _SetAttributeFor(self,client,name,value):
"""Set the attribute and return true if successful"""
# attribs stores the attributes we care about
if name in self._attribs.keys():
client._getCache()[name]=value
client.__dict__[name]=value; 
client._p_changed = 1
return 1
return None


So _objectChanging() is not overridden, the rest I have ommitted..

So as you also can see I already do a subtransaction commit but it does
not seem to help for this problem.. 

regards,
  Christian

PS: It might also be that I am simply blind ;-) But somehow ZPatterns always confuses 
me,
especially the inner workings ;-)

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns AttributeProvider question

2001-04-22 Thread Christian Scholz

Hi!

Just a quick note as it's quite late already (more tomorrow):

 In the early days of ZPatterns, I assumed that I would create SQL
 providers, LDAP providers, and suchlike gizmos.  Later, it became clear
 that it was more useful to have a simple "glue" language to allow
 harnessing the full power of Zope in the context of events happening to
 objects.  I still toy with the idea of making an "SQL attribute provider",
 however, that would be based on the ZSQLMethod object and add some
 ZPatterns hooks to it, but it's not a big priority.  Its main value would
 be to cut down on some repetitive typing between one's SQL statements and
 SkinScript statements.

Well, exactly this was the intention of programming this as I was a bit
bored by all this typing, exactly when the attribute lists are getting 
longer. So right now I define it once in the ZClass, press the "Read
ZCLass propsheet" button and the my attribute provider sets everything
up itself..
(it also saves me from typing errors..)

Actually I did it with SkinScript before but thought some simple plugin
would be nicer..

But thanks for explaining the inner workings in some more detail (maybe
I should put this into some howto or so? or it might be put into the
ZPatterns wiki..), as this really should help (not only me I guess :)

I will comment more on this tomorrow.. 
(at least I got some idea how I might solve my problem... though I thought this
some times before already.. ;-)

And the other possible option would be (as Steve suggested once on IRC) to create
some wizard which sets up all the SkinScript methods and ZSQL methods in one
go.. 

Anyway, more about it tomorrow.

good nite..
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns AttributeProvider question

2001-04-21 Thread Christian Scholz

Hi!

  Good evening everybody!
  
  I have some question regarding attribute and agent programming for ZPatterns.
  
  I have some provider which is registered for the "handlers" and "attributes"
  methods and some attributes.
  
  My problem is when trying to create a new object and directly editing it, e.g.
  
  obj=newItem()
  obj.propertysheets.data.manage_changeProperties(foobar=13)
  
  the propertysheet is defined and my provider is also registered for
  handling the property "foobar". Unfortunately my SetAttributeFor() method
  is never called.
 
 
 Have you defined a namesForRegistration method in your provider?

Yes, as said above it registers for handlers and attributes. Also
_objectChanged and _SetAttributeFor() etc. are called. They're just not called 
directly after creating the object (when being in the same request that is).

cheers,
  Christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



[Zope-dev] ZPatterns AttributeProvider question

2001-04-20 Thread Christian Scholz

Good evening everybody!

I have some question regarding attribute and agent programming for ZPatterns.

I have some provider which is registered for the "handlers" and "attributes"
methods and some attributes.

My problem is when trying to create a new object and directly editing it, e.g.

obj=newItem()
obj.propertysheets.data.manage_changeProperties(foobar=13)

the propertysheet is defined and my provider is also registered for
handling the property "foobar". Unfortunately my SetAttributeFor() method
is never called.

Also defined in my provider are _objectAdded(),  _objectAdding(), _objectChanged()
(but not _objectChanging()). Here's what they do:

_objectAdded() is storing the data collected via SetAttributeFor() into an sql 
database as new record
_objectAdding() is doing the same as the original method but also committing the 
transaction
as otherwise the new record will not be stored into the database 
(basically
it calls _objectAdded() via the transaction mechanism). I needed to do 
that
as otherwise a getattr on the primary key (==loadAttrib) failed as I 
try
to retrieve the record inside the _AttributeFor() method.
_objectChanged() doing the same as objectAdded() but updating the sql database.

So what's happening is that _objectAdding() and _objectAdded() get called from the 
newItem()
call but _SetAttributeFor() is not called. When doing the manage_changeProperties() 
inside
a new method which is called manually (and does a getItem()) everything is fine.
I've also tried to do

obj=newItem()
newid=obj.id
obj2=getItem(newid)
obj2.propertysheets.data.manage_changeProperties(foobar=13)

but this also did not call _SetAttributeFor(). 

So does any ZPatterns wizard has any idea on what I might do wrong?
(I can also send someone the source code if this message seems too confusing ;-)

regards,
  Christian Scholz

PS: What I am trying to create is an sql attribute provider for ZPatterns which
is some replacement for manually creating the zsql method and SkinScript methods.
Unfortunately it seems more difficult than I thought at first ;-)

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] Re: zope nautilus cabal

2001-04-15 Thread Christian Scholz

Hi!

 Basically, 'access contents information' isn't a great permission. If you
 turn if off, life gets horrible, if you leave it on, bits hang out. I'd
 prefer to see something like:
 - Access Contents Information via HTTP
 - Access Contents Information via FTP
 ...etc...

This sounds more as if some "external interface" concept is needed, where
you can add/disable modules for handling the XMLRPC stuff and the webdav stuff
and the normal management interface stuff and the ftp stuff.. 
And this again also touches the area of model-view again, which seems a bit
far away unfortunately ..


-- mr topf



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



[Zope-dev] ZPatterns Attribute Provider Problem

2001-04-09 Thread Christian Scholz

Hi everybody!

I am trying to write some attribute provider for storing data inside
an SQL table as I am bored of typing parameter lists over and over
again (e.g. in every ZSQL method, in every SkinScript method etc.)

The problem now is that adding a new row to the table (and thus adding
a new object to the rack) is working well but updating an object does not.
Basically the main problem is that _objectChanged is not called in my provider.

What I did is the following:

- If an attribute of the propsheet is changed, _SetAttributeFor is called
  and stores it into the cache (as I don't want to update the database for
  every attribute change).

- _objectChanged is then supposed to create an sql query and execute it.
  This - as said - is actually not happening, as the whole method is not called.

- My namesForRegistration looks like this:

def namesForRegistration(self,container):
""" return names for registration """
return {
'provides':('handlers','attributes'),
'getattr': self._attribs.keys(),
'setattr': self._attribs.keys(),
'delattr': self._attribs.keys()
}

  with self._attribs containing the attributes my provider is responsible for.

So is there any reason why _objectChanged is not called? Actually I am a bit
confused when reading the ZPatterns source which should call it.. ;-)
So which are the conditions under which it's supposed to be called?
(_objectAdded() as said before is called actually..)

I hope someone can help me :)

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] FTP interface being worked on?

2001-03-27 Thread Christian Scholz

Hi!

 By the way -- is it me, or is the current Import/Export interface
 broken?  I tried to select multiple objects to export, but I can only
 get the first one to actually be exported.

It's not just you.. but never thought about whether this might be
a bug ;-)

-- christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] More Core Session Tracking Woes :-(

2001-03-26 Thread Christian Scholz

Hi!

 The setup:
 -Zope 2.2.4
 -Core Session Tracking 0.7
 -Cookie session ID manager (path=/,lifetime=0)
 -Internal Session Data Manager (timeout set to 60 minutes)
 
 This seems to randomly (but sometimes very frequently) loose session data items
 :-(

FYI, you are not the only one.. I also experienced that. That's also the reason
why I am back to using SQLSession again..
(actually I was too lazy to track it down..)

-- mr topf

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] More Core Session Tracking Woes :-(

2001-03-26 Thread Christian Scholz

Hi!

  FYI, you are not the only one.. I also experienced that. That's also the reason
  why I am back to using SQLSession again..
 
 How hard was that to swap in? 

depends. Of course the API is not the same.. So it depends if you've factored out
the session stuff in some dtml or python method which you simply have to change.
(and if you can factor it out, of course.. I basically just looked one variable
up in the session and copied it to REQUEST, so I simply had to change one header file).

Also I haven't written a plugin for my Virtual Site Root yet to make use of the
Core Session Tracking package so I cannot use it in siterooted environments yet
anyway..

cheers,
  MrT

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] Adding a property to a batch of objects ?

2001-03-20 Thread Christian Scholz

Hi!

 I wanted to do sonething like this:
 dtml-in "objectIds(['DTML Document'])
 dtml-call manage_addProperty('foo','bar','string')
 /dtml-in

You might want to use dtml-in "objectValues(['DTML Document'])"
(or objectItems). then just say

dtml-call "manage_addProperty(...)"

or you might change the ... to

dtml-call "_.getattr(this(),_['sequence-item']).manage_addProperty(...)"

(hope this is right, have not tested it.)

First form directly builds a list of the objects instead of the
Ids, second form first looks up the id with _['sequence-item'] and
then looks up the object with that id in the local object (your folder).

Hope this helps..

-- mr topf

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] getPhysicalPath?

2001-03-16 Thread Christian Scholz

Hi!

 Ahh... thanks Brian. Thats a new one to me :)

To me, aswell. Is this documented somewhere? ;-)

And can someone explain to us where the differences between
aq_chain and getPhysicalPath() are? Actually getPhysicalPath()
seems also to walk up aq_parent. Or am I missing something?

regards,
  Christian
  

 
  The aq_chain attribute (computed at time of access) provides 
  a list (in reverse order) of the objects in the acquisition 
  path.
  
  Hope this helps!
  
  
  Brian Lloyd[EMAIL PROTECTED]
  Software Engineer  540.371.6909  
  Digital Creations  http://www.digicool.com 
  
  
  
  
  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
  (Related lists - 
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope )
  
 
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] Playing with DateTime

2001-03-16 Thread Christian Scholz

Hi!

 IMHO, the best approach would be to make mxDateTime available separately
 from DateTime in the _ variable. That would avoid breaking any code, but
 allow anyone who wanted to use mxDateTime that option from within Zope.
 
 I think a product that adds mxDateTime to the _ variable would be your
 best bet.

Well, my opinion, too. On the long run this might get the preferred way of
dealing with time stuff so that the use of DateTime gets depreceated. But
I guess DC needs to decide this.. I also dunno if there are any problems
with mxDateTime being used (e.g. security concerns, whatever) as I havent't
looked to closely at this.

-- christian

--
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]


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



[Zope-dev] ZClass propertysheets

2001-02-27 Thread Christian Scholz

Hi!

I am just wondering if it's possible to get hold of the properties of a propertysheet
of a ZClass without instanciating it. 

So when instanciating I would just do

map=object.propertysheets[1].propertyMap()

and get all information of my ZClass instance object.
So is this also possible on the class definition? 
(actually I would assume it is stored somewhere as I can edit it via
the management interface. I just didn't manage to get it from the
source code..)

(next question might be how to get the class when only having a 
meta type or the path to it.. but I think I will just search 
the Zope source..) 

kind regards,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] initializing objects in ZPatterns

2001-02-22 Thread Christian Scholz

Hi!

  I just encountered another problem with ZPatterns (well not exactly with ZPatterns
  but the way I use it.. ;-)
  
  I have some Specialist with a normal rack which stores data persistently in the 
ZODB.
  Everytime I am creating a new object I want to create an object of another 
specialist
  on the fly and store it's id inside my first object.
  
  Thus I have setup a SkinScript with the following content:
  
  
INITIALIZE OBJECT WITH company_address=addresses.createAddress()
  
WITH addresses.getItem(self.company_address) COMPUTE company_addr=RESULT
  
STORE company_address IN SELF
  
  The createAddress is called actually and it returns the ID of the new object
  (thus the object is created). Unfortunately the id is not stored inside
  company_address. After reading the new object again this value is still empty
  (and thus also no address object is return by the address specialist). Same happens
  when just using some dummy property and filling it with a fixed string. This
  also disappears..
 
 To get company_address stored, you can probably do something like:
 
   your_object.manage_changeProperties(company_address=your_object.company_address)
 
 or possibly your_object.propertysheets.NameOfSheet.manage_changeProperties...
 depending on what kind of object you're using.
 
 You could have this as a trigger:
 
 WHEN OBJECT ADDED CALL
   self.manage_changeProperties(company_address=self.company_address)

Well, the first one seems to work, but the SkinScript trigger does not unfortunately.
So I will try to incorporate this into my other code (which is a bit more tricky
as I automated all the property handling stuff). But thanks anyway!

 As for whether it is a bug, the implementation of the INITALIZE clause just puts
 its attributes directly into the DataSkin's attribute-cache. It appears to be
 designed for the behaviour that you see.
 
 You could get the behaviour that you want by making the implementation actually
 set the attributes instead. I'm not sure what the other implications of doing
 that are, though.
 
 If you're interested, the code is in
 
   lib/python/Products/ZPatterns/SkinScript/Components.py
 about line 71.

ok, thanks, will have a look at that.

cheers,
  Christian


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



Re: [Zope-dev] initializing objects in ZPatterns

2001-02-22 Thread Christian Scholz

Hi!

 To get company_address stored, you can probably do something like:
 
   your_object.manage_changeProperties(company_address=your_object.company_address)
 
 or possibly your_object.propertysheets.NameOfSheet.manage_changeProperties...
 depending on what kind of object you're using.

I've now tried

WHEN OBJECT ADDED CALL
  
self.propertysheets.data.manage_changeProperties(company_address=self.company_address)

which gives me some Unauthorized error on the method call.

(when doing it manually in some dtml method after newItem() it works ok, though.
And I am logged in as Manager..)

Sometimes I wish Zope would print more about the details of such an response,
e.g. which permissions might be missing..

Anyway, I will keep experimenting with it (also tried to subclass directly from
DataSkin, to override some method which create the company address) but then
I noticed that it always needs to be a ZClass (except I would also implement my
own Rack, I guess..)
Wonder when the basic app will be running.. ;-)

ok, nice evening everybody! :)

-- christian


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



[Zope-dev] initializing objects in ZPatterns

2001-02-21 Thread Christian Scholz

Hi!

I just encountered another problem with ZPatterns (well not exactly with ZPatterns
but the way I use it.. ;-)

I have some Specialist with a normal rack which stores data persistently in the ZODB.
Everytime I am creating a new object I want to create an object of another specialist
on the fly and store it's id inside my first object.

Thus I have setup a SkinScript with the following content:


  INITIALIZE OBJECT WITH company_address=addresses.createAddress()

  WITH addresses.getItem(self.company_address) COMPUTE company_addr=RESULT

  STORE company_address IN SELF

The createAddress is called actually and it returns the ID of the new object
(thus the object is created). Unfortunately the id is not stored inside
company_address. After reading the new object again this value is still empty
(and thus also no address object is return by the address specialist). Same happens
when just using some dummy property and filling it with a fixed string. This
also disappears..

So what do I have to do to get it stored?
(the other data which is handled via the default plugins is stored and all the
attributes are defined inside the ZClass..)

Hope, anyone knows how this might be fixed..

regards,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns and SQL

2001-02-19 Thread Christian Scholz

Hi!

 So as the item is an instance of my ZClass containing also an company_name
 attribute
 it will always return the item and because of that the Rack thinks it's
 already there.
 So why is this happening? What do I need to change?
 
 You need to use an attribute which the object has *if and only if* it
 exists in the database.  If the class has the attribute defined, all
 instances exist, and you can't even load it with SkinScript because
 ZPatterns uses __getattr__ to redefine attributes, and that doesn't work if
 the attribute already exists in the class.

So I shouldn't define it inside the ZClass propertysheet? 
Do I understand this right?
(I remember having problems when using properties not defined in a
sheet somewhere.. or am I mistaken completely somehow? ;-)

 When changing the loadAttrib to something else (non existing), the newItem
 is working
 but instead getItem is not working anymore as it returns None only..
 (somehow the zsql
 method is not even called thus the skinscript seems not to work in that
 case (I guess
 because the loadAttrib is not defined in it somewhere)).
 
 Right.  The load attribute has to be one defined in a provider, and which
 will end up being "NOT_FOUND" if the object doesn't exist in the table
 you're querying.

I will experiment a little with this information. Hope it helps :)

Thanks! 

-- christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns and SQL

2001-02-19 Thread Christian Scholz

Hi!

 So I shouldn't define it inside the ZClass propertysheet? 
 Do I understand this right?
 (I remember having problems when using properties not defined in a
 sheet somewhere.. or am I mistaken completely somehow? ;-)
 
 You can't do this with a load attribute, because a default value will
 exist.  The easiest way to deal with this is simply to have a seperate
 attribute name just for loading, or use an attribute that isn't on a
 property sheet.

Ok, I now removed customer_id (which won't be set anyway as this is the
id set by the database automatically) from the propertysheet and used
this as loading attribute. Seems to work now :)
(though I am still confused a little, as I tried one non-existing
attribute and it didn't work. But this one also was not defined inside
the SkinScript and the database).

But it's working now, so it's ok :)

Thanks again!

Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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



Re: [Zope-dev] ZPatterns question

2001-01-04 Thread Christian Scholz

Hi!

  Well, virtual in the sense as a specialist is no real folder but can
  provide content from different sources. Thus what I mean is some mechanism
  which emulates objectIds() etc. so it looks to the user (and the ones
  using it via dtml) like a normal folder object.
  Somehow like the Customizer but without the need for actually creating
  Zope objects. Something inbetween Specialist and Customizer this would be
  I guess.
 
 yeah, this is exactly what I'm after too. I'd like the virtual objects
 the specialist is responsible for to have normal Zope management
 screens.

Well, I think this shouldn't be too difficult to create. Just a subclass
of Specialist and add some Contents-Tab, define objectIds() etc. in the
Methods tab and call it in the management screen of "Contents".
Though the more advanced things like Copy/Paste/Rename might then not
be available.. But for me actually it would be sufficient to get the
contents. 

 Also, much mroe trickily, I'd like them to be able to contain each
 other, although Steve A's __bobo_traverse__ trick might help with this
 bit...

What do you mean? Nesting Specialists (or these virtual folder specialists)?

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design   [EMAIL PROTECTED]

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




Re: [Zope-dev] ZPatterns question

2001-01-03 Thread Christian Scholz

Hi!

Actually should answer to these posts... ;-)

On Thu, Dec 28, 2000 at 03:11:37PM -0500, Steve Spicklemire wrote:
 
 Hi Christian,
 
 Well, nobody else answered that I saw... so I'll take a crack
 at your questions 
 
  "CS" == Christian Scholz [EMAIL PROTECTED] writes:
 
 CS Hi there!
 
 CS Finally I managed to get a basic understanding of how to do
 CS things with ZPatterns ;-) So seems quite cool :) (and
 CS hopefully I find some time to write some basic howto about it)
 
 CS But I have some little questions:
 
 CS 1. Is it possible to retrieve the set of known IDs from a
 CS specialist?  Or would I need to add my own method to it which
 CS does this (and change it accordingly if I switch to another
 CS storage method)?
 
 If you store persistently you can use the Rack's method:
 
 "defaultRack.getPersistentItemIDs()"

Thanks, also found this out in the meanwhile.

 but a couple of notes: 1) this returns a BTree object, not a simple
 list, so you can't iterate through it in DTML. You'll need to copy
 it to a simple list for that.. and 2) If you change to a different
 storage you'll need to create your own method (ZSQL Method?). What I've
 found is that if you have a large number of objects you'll either want
 to query a Catalog, or an SQL database to get Ids that match some criteria
 that limit the number of hits to something that makes sense to display 
 in a browser.

I am now using some method I create inside the specialist for it.

 CS 2. Is it planned to provide something like a virtual folder
 CS which acts like a normal object manager but is controlled via
 CS ZPatterns (so actually something like Folder with Customizer
 CS Support just without the "anchor" in ZODB.  (would also
 CS require some mechanism asked for in 1.)
 
 Hmmm... I'm not sure what you're after here. Why not just use
 a Specialist? In what sense do you want it to be virtual?

Well, virtual in the sense as a specialist is no real folder but can
provide content from different sources. Thus what I mean is some mechanism
which emulates objectIds() etc. so it looks to the user (and the ones
using it via dtml) like a normal folder object.
Somehow like the Customizer but without the need for actually creating 
Zope objects. Something inbetween Specialist and Customizer this would be
I guess.

 (Are you looking for a dynamic traversal interface that 
 would allow you to map URLs to objects that are managed by
 ZPatterns? Can you give an example?)

yes, something like this comes close I guess.

e.g. I have some sql database consisting of people's addresses and
I want to create some specialist which queries this database (or how
ever this specialist is configured right now in order to get the
object ids) and shows it as if it's a normal folder.
(seems to me more transparent at some point).

But I assume it's not suited for all applications e.g. if the number
of objects gets a little bigger.

And I guess I can create this myself if I subclass from Specialist and
add the rest of the ObjectManager's interface to it.

 CS 3. Is it possible to use ZPatterns also without some exta
 CS ZClass defined in a Product? At least if I don't need methods
 CS for my objects but simple want to define the attribute they
 CS know.  Would be nice as I could then hold everything together
 CS in one place (the specialist that is) without requiring to
 CS install something also in the Products folder of the Control
 CS Panel.
 
 I believe you need to either create a Python subclass, or a ZClass
 subclass of DataSkin. "Raw" DataSkins don't have the right permissions
 to allow for TTW access. If you're creating a 'product' anyway... just
 make a 'dummy' class that you can use for storage.

ok, but I still need to define the attributes I want to handle inside a
propertysheet of this ZClass, right?
Actually what I would like is something which directly resides inside the
Specialist and not somewhere outside in some Product folder.
So everything is close together in one place.

 CS That's it for now, I will keep experimenting then.. :)
 
 Good Luck!

Oh, it's working better than I thought :)

but thanks,
  christian

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




Re: [Zope-dev] ZPatterns question

2001-01-03 Thread Christian Scholz

Hi Steve!

On Thu, Dec 28, 2000 at 10:45:46PM +, Steve Alexander wrote:
 Steve Spicklemire wrote:
 
  
  CS 2. Is it planned to provide something like a virtual folder
  CS which acts like a normal object manager but is controlled via
  CS ZPatterns (so actually something like Folder with Customizer
  CS Support just without the "anchor" in ZODB.  (would also
  CS require some mechanism asked for in 1.)
  
  Hmmm... I'm not sure what you're after here. Why not just use
  a Specialist? In what sense do you want it to be virtual?
  (Are you looking for a dynamic traversal interface that 
  would allow you to map URLs to objects that are managed by
  ZPatterns? Can you give an example?)
 
 Reading this just after reading the source to Specialists.py, I had a 
 thought; and tried it out; and it works! :-)
 
 You can use SkinScript to define __bobo_traverse__ for a particular kind 
 of DataSkin in a Specialist.
 
 For example:
 
WITH SELF COMPUTE __bobo_traverse__=traversal_method

that's very cool :)
I just created some base class for this from which my ZClasses are derived
but nice to know that it's also possible without this base class.
(though for this application it's easier with this base class as
it's easier to configure then)

cheers,
  Christian


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




[Zope-dev] some suggestion..

2000-09-28 Thread Christian Scholz

Hi!

While trying to code some python Product I had the need for extending
manage_delObjects in some Folderlike object. I simply want to call the
the ObjectManager's version of it and then do my own stuff afterwards
(like deleting some other dependant objects).

Unfortunately when calling manage_delObjects() one cannot decide
if some error occured or everything went ok as in both cases
I get back some string (be it some html formatted error message or
the manage_main dialog).

So what about splitting these methods in two, e.g. one _delObjects()
and one manage_delObjects(). The first one would the the actual work
like testing for error conditions and deleting the objects and the
other one would be the one called by the management interface.
manage_delObjects() would then call _delObjects() and checks for
errors afterwards generating some error message or the next dialog.
The errors could then be passed via exceptions or similar methods
from _delObjects() to manage_delObjects().

This would make subclassing a lot easier and would be at least a
start in separating layout from logic.

Just an idea :)

cheers,
  Christian

PS: Maybe it would even make XMLRPC more usable as there I also get
back only html formatted error messages instead of something making
more sense for a script (like an error code or something).

-- 
COM.lounge  http://comlounge.net/
communication  design   [EMAIL PROTECTED]

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




[Zope-dev] Redirection and Authentication

2000-08-29 Thread Christian Scholz

Hi!

I had a little problem and just wanted to ask if someone knows an explanation..

The goal: 
I want to show a list of newsitems to the user. If an administrator wants
to change it he should be able to log in and see the same list but with edit-
buttons.

The setup is:

/folder/list- public accessible dtml method which show the list
/folder/edit- protected dtml method

The edit method is protected so that the login requester pops up and asks
for a passwort.
Originally I was simply redirecting back to the list page inside the edit document by

dtml-call "RESPONSE.redirect('./list')"

(the only line in the document)

In list I then check for a login with

dtml-if "REQUEST['AUTHENTICATED_USER'].has_permission('whatever',this())"
.. show edit button here ...
/dtml-if

The problem is now that after the Redirect AUTHENTICATED_USER is again set to
Anonymous (which I tested by printing AUTHENTICATED_USER). If I do no redirect
but put a normal link back to the list document, everything works as expected
(thus showing the edit button).

So has anyone an explanation? (Version is 2.2.0)
(right now I directly include the list again in the edit document by
using dtml-var. Works for this little thing but I assume this only being
a workaround..)

(I also remember having some strange problems with a redirect from python some
time ago. Back then it did not commit the database transaction in Oracle. After
putting a get_transaction().commit() before the redirect made things work again.)

cheers,
  Christian

-- 
Christian Scholz   MrTopf@IRC
COM.lounge  http://comlounge.net/
communication  design   [EMAIL PROTECTED]

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




[Zope-dev] The new SiteAccess and __no_before_traverse__?

2000-06-25 Thread Christian Scholz

Hi!

I am playing around with SiteAccess and Zope 2.2b1 right now and I wonder
if it's still possible to disable SiteAccess (actually an AccessRule) by
using __no_before_traverse__?
It seems not to and I am a bit trapped right now.. ;-)

Even deleting SiteAccess from the Products-Directory didn't work as then
Zope encountered a missing doc string error for the directory when trying
to access it.

Hope, someone can help.. otherwise I might have to use 2.1 again until this
is fixed..

regards,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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




[Zope-dev] Re: The new SiteAccess and __no_before_traverse__?

2000-06-25 Thread Christian Scholz

Hi!

 - Original Message -
 From: "Christian Scholz" [EMAIL PROTECTED]
  I am playing around with SiteAccess and Zope 2.2b1 right now and I wonder
  if it's still possible to disable SiteAccess (actually an AccessRule) by
  using __no_before_traverse__?
  It seems not to and I am a bit trapped right now.. ;-)
 
 This has changed, and I need to make it clearer in the documentation.  There
 is no longer a global "disable all __before_traverse__ hook" URL.  Instead,
 there are specific SiteAccess object-disabling environment variables.

Actually I looked up the documentation and there is still mentioned this
hook.

 You need to start Zope with environment variable SUPPRESS_ACCESSRULE set.
 There is a similar SUPPRESS_SITEROOT variable for SiteRoots.

Hm, is there a way of doing this without having to restart Zope. In some
environments this might not be the best solution (e.g. if you want to
move your application to a production server and have to set up a special
SiteRoot and then notices that you mistyped something.. )

 Fire up a command shell and type (*nix):
 
 SUPPRESS_ACCESSRULE=1
 export SUPPRESS_ACCESSRULE

Ok, thanks, that's working :)

  Even deleting SiteAccess from the Products-Directory didn't work as then
  Zope encountered a missing doc string error for the directory when trying
  to access it.
 
 That's because the fundamental mechanism is built into Zope 2.2, rather than
 grafted on by SiteAccess 2.  It does look like we'd better wrap the hook
 call in a try..except pass, though.

It's a little confusing the way it is right now.. 

Thanks for the fast answer :)

-- christian


-- 
COM.lounge  http://comlounge.net/
communication  design [EMAIL PROTECTED]

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