Re: [Zope-dev] Memory problems with ParsedXML ?

2001-04-06 Thread Karl Anderson

Godefroid Chapelle [EMAIL PROTECTED] writes:

 Karl Anderson a crit :

  Another thing to keep in mind is that the ParsedXML *product* is a DOM
  tree and a management interface around it.  The management interface
  only gives you a convenient UI and a place to store a few bits that
  the DOM doesn't know about (content type, namespace usage, etc.).
  It's always more efficient to just use the DOM tree and related
  utilities (parsing, printing), although it is less convenient - you
  have to know a little bit more about what you're doing.  Do you need
  each of those 2500 product instances?  See the createDOMDocument
  method to create a DOM document without the management interface.
 
 
 I am trying to use createDOMDocument, calling it from an external method:
 
 from Products.ParsedXML import ParsedXML
 
 def accessXml(document):
 return ParsedXML.createDOMDocument(document)
 
 When using the document returned in a python script,  it seems that Zope
 security prevents me from accessing any DOM attributes.
 
 Am I doing something wrong or am I forced to do everything through external
 methods ?

The DOM objects without the ParsedXML management proxies don't have
any Zope security information associated with them, so you have to
provide it yourself.  This is one of the things that the management
proxies provide.

I didn't mean to sell the proxies short; I should have mentioned that
you have to know about providing the features youself that they
provide, including security, so this is an area for Zope experts.
I've added this to the README.  Furthermore, if you're just calling
methods on the Document node, without traversing to its subnodes,
you're really not paying much of a price; you're basically just
putting more function calls between you and the DOM object until you
access a DOM subobject.

I don't use the python scripts much, but they have very restricted
security, being web-edited and all.  So yes, one way to give access is
to use external methods.  Another way is to use a python product and
the security machinery available to you there.

The unproxied DOM objects are similar to any non-Zope aware python
class instances with regards to security; if you're unfamiliar with
it, I'd play around with some non-Zope aware dummy class instances,
with nested subinstances and attributes, until you know how to make
those objects and attributes publishable.

-- 
Karl Anderson  [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 problems with ParsedXML ?

2001-04-02 Thread Godefroid Chapelle



Karl Anderson a crit :


 I didn't think that anyone would want to see a management screen with
 2500 ParsedXML instances - or 2500 instances of anything - at one
 time. Have you tried using a BTree folder?


BTree Folder is working very nicely...


 Another thing to keep in mind is that the ParsedXML *product* is a DOM
 tree and a management interface around it.  The management interface
 only gives you a convenient UI and a place to store a few bits that
 the DOM doesn't know about (content type, namespace usage, etc.).
 It's always more efficient to just use the DOM tree and related
 utilities (parsing, printing), although it is less convenient - you
 have to know a little bit more about what you're doing.  Do you need
 each of those 2500 product instances?  See the createDOMDocument
 method to create a DOM document without the management interface.


I am trying to use createDOMDocument, calling it from an external method:

from Products.ParsedXML import ParsedXML

def accessXml(document):
return ParsedXML.createDOMDocument(document)

When using the document returned in a python script,  it seems that Zope
security prevents me from accessing any DOM attributes.

Am I doing something wrong or am I forced to do everything through external
methods ?


 --
 Karl Anderson  [EMAIL PROTECTED]

Thanks

--

Godefroid Chapelle

BubbleNet sprl
rue Victor Horta, 30
1348 Louvain-la-Neuve
Belgium

Tel 010 457490
Mob 0477 363942

TVA 467 093 008
RC Niv 49849



___
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 problems with ParsedXML ?

2001-03-28 Thread Godefroid Chapelle

Hi,

I have imported about 2500 xml files in ParsedXML objects through the
use of  :

manage_addProduct['ParsedXML'].manage_addParsedXML(id, '', xmlString)

This works perfectly.

But when trying to browse the folder containing the ParsedXML instances,
a whole lot of memory is used by Zope and it took my machine down.

Have I done something wrong or does this info help you debug the product
?

Hope this help.
--

Godefroid Chapelle

BubbleNet sprl
rue Victor Horta, 30
1348 Louvain-la-Neuve
Belgium

Tel 010 457490
Mob 0477 363942

TVA 467 093 008
RC Niv 49849



___
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 problems with ParsedXML ?

2001-03-28 Thread Godefroid Chapelle



Karl Anderson a crit :


 Hm, it's been pointed out to me that the inefficiency of the get_size
 method of ParsedXML is compounded with many instances because the
 standard management interface uses it.

 It's possible that some stuff isn't getting garbage collected until
 the transaction is done, and calling get_size on many ParsedXML
 instances in one transaction is the problem.  I'll look into it.

 I didn't think that anyone would want to see a management screen with
 2500 ParsedXML instances - or 2500 instances of anything - at one
 time. Have you tried using a BTree folder?

 Another thing to keep in mind is that the ParsedXML *product* is a DOM
 tree and a management interface around it.  The management interface
 only gives you a convenient UI and a place to store a few bits that
 the DOM doesn't know about (content type, namespace usage, etc.).
 It's always more efficient to just use the DOM tree and related
 utilities (parsing, printing), although it is less convenient - you
 have to know a little bit more about what you're doing.  Do you need
 each of those 2500 product instances?  See the createDOMDocument
 method to create a DOM document without the management interface.

 It's easy to wrap a ParsedXML product around an existing DOM tree -
 see the initFromDOMDocument method.  Currently, you have to create the
 persistent ParsedXML product which wraps the DOM Document node, and
 install that product in a Zope ObjectManager (or subclass like Folder)
 somewhere, to avoid a few warts.  Someday I'd like to be able to just
 instantiate a management wrapper when I want a management interface,
 and then just throw it away, without bothering to add it to a folder.

 --
 Karl Anderson  [EMAIL PROTECTED]

Thanks answering so quickly...

I am still a newbie and will check BTree Folder and the API you point to me.
--

Godefroid Chapelle

BubbleNet sprl
rue Victor Horta, 30
1348 Louvain-la-Neuve
Belgium

Tel 010 457490
Mob 0477 363942

TVA 467 093 008
RC Niv 49849



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