Re: [Zope-dev] Site Access Rewrite Rule documentation?
From: "R. David Murray " <[EMAIL PROTECTED]> > So, clearly I don't have a clue what stack is supposed to contain or > what changing it does. Can anyone point me to docs or give me some > help? You can also tell me, "that's stupid, just solve your problem > this way"... You've got it almost right, you just have to know that it's called a stack because it's used that way by the publishing machinery. This means that the names on the stack are always in *reverse* order of how they appear in a URL; "stack[-1]" is the next name to be traversed, not "stack[0]". As you inferred, changing the stack will change the publishing path, and your code, suitably adjusted, should do what you wanted. Something like this (in "/", not "/Books"): stack = context.REQUEST['TraversalRequestNameStack'] if len(stack) >=2 and stack[-1] == 'Books' and stack[-2][:6] != 'manage': stack[-1:] = ['marketItems', 'store'] Note that unless you need it to exist for some other reason, you don't even have to have an actual "/Books" Folder for this code to work, and you could leave out the 'manage' check. Cheers, Evan @ digicool & 4-am ___ 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] Site Access Rewrite Rule documentation?
Is there any real documentation for Site Access rewrite rules anywhere? There isn't anything in the help system of 2.3.1b1, and the docs under SiteAccess on zope.org have a couple of examples but no technical explanation of how the parts of the example interact with Zope. My goal is pretty simple. I have a Specialist under /store/marketItems. I want my content managers to be able to use URLs like: /Books/someisbnnumber to refer to the object that is really at: /store/marketItems/someisbnnumber I could use a redirect, but why suffer the transaction overhead? I figured I could have a folder Books with an access rule like this: stack = context.REQUEST['TraversalRequestNameStack'] if stack[0]=='Books' and (len(stack)==1 or stack[1][:6]=='manage'): stack[0:1] = ['store','marketItems'] I figured I needed the manage thing so that I could edit the access rule. When I try to use this, no rewriting appears to happen. So I changed it to: if not stack[0][:6]=='manage': stack[0:1] = ['store','marketItems'] This didn't do anything for the URL '/Books', and gave me a notfound error on /Books/marketItems if I put something after the /Books. Changing it to stack[1:1] gives me a list index out of range. I can't figure out where *that* would be coming from. So, clearly I don't have a clue what stack is supposed to contain or what changing it does. Can anyone point me to docs or give me some help? You can also tell me, "that's stupid, just solve your problem this way"... --RDM ___ 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] ZCatalog hackery
> Will the new data be 'made ready for indexing' before it is compared to the > existing data? That is, will ZCatalog have to compute the data in some > way before it compares it to what is already stored? Yes. > I'm wondering because it would be significant overhead to 'make a data field > of 100MBs into an index-like value' and then compare it to what already > exists in the ZCatalog. Yes, it's potentially slower on update but causes less database bloat. Most importantly the update scheme causes fewer ConflictErrors on heavy-write sites because we're writing to the ZODB less often. That said, some of the operations of comparison in the indexing code are moving from Python to C, which should offset this penalty a little. ___ 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] ZCatalog hackery
> Cool. Now, in the examples I've seen for interfacing ZCatalog and > ZPatterns, the 'object updated' code does an unindex of the object > and then an index of the object. I copied that pattern for my > "the tables have been updated, reindex everything" code. > So what I should do instead is just do an index of the objects? Yup. Don't call uncatalog_object on the object before calling catalog_object. > This leaves me with a different problem, though. Sometimes when the tables > are updated objects dissapear (ie: were deleted from the external > database). I have to figure out how to delete those from the catalog. > A pain, but it shouldn't be too hard. This is a problem that ZCatalog doesn't address anyway (unless you're using "CatalogAware", blech). > > Note that the algoritm is simple - for each index, compare the what exists > > in the index to what is to be put in. If they're the same, do nothing. If > > they're different, reindex. I wasn't able to understand completely from > > your description whether the object method your're attempting to index via a > > TextIndex actually returns different data or not when you recatalog it. > > Does it? > > Yeah, it should be returning exactly the same data. I can stand the > update hit when the data actually changes (even though the change > will typically be only one or two words out of hundreds). We're working on integrating new BTree data structures into the indexes which will make the time/space hit very low when updating documents in which nothing has changed. I have no hard numbers, however, for the old or the new stuff. > > There's a huge possibility that the merge stuff isn't working completely > > because until now there have been no deterministic tests. > > Well, I don't know yet, since I was doing an unindex/reindex cycle. Well, give it a shot and tell me what happens! ;-) ___ 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] ZCatalog hackery
On Sat, 3 Mar 2001, Chris McDonough wrote: > Has the physical path of the object changed? If not, the newer (2.3.0 + ) Nope. > catalog stuff should be smart enough to figure out whether anything inside > the object has changed during catalog_object. If nothing has changed, none > of the indexes or metadata columns should be updated. We're scrambling > right now to write tests for this kind of thing. :-( Cool. Now, in the examples I've seen for interfacing ZCatalog and ZPatterns, the 'object updated' code does an unindex of the object and then an index of the object. I copied that pattern for my "the tables have been updated, reindex everything" code. So what I should do instead is just do an index of the objects? This leaves me with a different problem, though. Sometimes when the tables are updated objects dissapear (ie: were deleted from the external database). I have to figure out how to delete those from the catalog. A pain, but it shouldn't be too hard. > Note that the algoritm is simple - for each index, compare the what exists > in the index to what is to be put in. If they're the same, do nothing. If > they're different, reindex. I wasn't able to understand completely from > your description whether the object method your're attempting to index via a > TextIndex actually returns different data or not when you recatalog it. > Does it? Yeah, it should be returning exactly the same data. I can stand the update hit when the data actually changes (even though the change will typically be only one or two words out of hundreds). > There's a huge possibility that the merge stuff isn't working completely > because until now there have been no deterministic tests. Well, I don't know yet, since I was doing an unindex/reindex cycle. --RDM ___ 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] ZCatalog hackery
[Chris McDonough] | Note that the algoritm is simple - for each index, compare the what exists | in the index to what is to be put in. If they're the same, do nothing. If | they're different, reindex. I wasn't able to understand completely from | your description whether the object method your're attempting to index via a | TextIndex actually returns different data or not when you recatalog it. | Does it? Will the new data be 'made ready for indexing' before it is compared to the existing data? That is, will ZCatalog have to compute the data in some way before it compares it to what is already stored? I'm wondering because it would be significant overhead to 'make a data field of 100MBs into an index-like value' and then compare it to what already exists in the ZCatalog. Thanks, Morten ___ 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] strip_html?
On Tue, 27 Feb 2001, Dieter Maurer wrote: > I do not know about "strip_html" but you may find something > similar in > > URL:http://www.dieter.handshake.de/pyprojects/zope/CatalogSupport.html Thanks, Dieter! That was perfect (though I turned it into a simple "filterHTML" function for my purposes). --RDM ___ 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] ZCatalog hackery
Has the physical path of the object changed? If not, the newer (2.3.0 + ) catalog stuff should be smart enough to figure out whether anything inside the object has changed during catalog_object. If nothing has changed, none of the indexes or metadata columns should be updated. We're scrambling right now to write tests for this kind of thing. :-( Note that the algoritm is simple - for each index, compare the what exists in the index to what is to be put in. If they're the same, do nothing. If they're different, reindex. I wasn't able to understand completely from your description whether the object method your're attempting to index via a TextIndex actually returns different data or not when you recatalog it. Does it? There's a huge possibility that the merge stuff isn't working completely because until now there have been no deterministic tests. - Original Message - From: "R. David Murray " <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 03, 2001 2:29 PM Subject: Re: [Zope-dev] ZCatalog hackery > I've got an analogous but different problem with ZCatalog udpates. I'd > like to ask for ideas about the best way to handle this. > > I've got a ZPatterns based ap that is pulling data from a postgresql > database. But associated with the object created out of the database > are signficant chunks of html (Author bios, book descriptions). I've > stored these html chunks in the database as well, though I don't think > that matters to the problem or possible solution strategies. > > The issue is that parts of the database get updated periodically from an > external source. That is, the author and book tables get replaced > wholesale. But the Book and Author objects are cataloged using > ZCatalog, doing a full text index on a combination of fields from > the external database and the html chunks. As far as I can see > at the moment, this means that every object has to get uncataloged > and recataloged, meaning every time the database update happens > the zodb inflates considerably, even though very little data has > actually changed. > > So far I can think of two simple solutions to this problem: (1) pack > often (2) put the Catalog into a mounted storage backed by a > non-undoable storage. I'd rather not do either one of these > (the first for obvious reasons, the second simply because I don't > want to take the time to learn how to set up a non-undoable storage). > Am I missing some other obvious options? It seems like there *ought* > to be a way to avoid the overhead of updating the catalog for objects > that haven't really changed. > > --RDM > > > ___ > 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 )
Re: [Zope-dev] ZCatalog hackery
I've got an analogous but different problem with ZCatalog udpates. I'd like to ask for ideas about the best way to handle this. I've got a ZPatterns based ap that is pulling data from a postgresql database. But associated with the object created out of the database are signficant chunks of html (Author bios, book descriptions). I've stored these html chunks in the database as well, though I don't think that matters to the problem or possible solution strategies. The issue is that parts of the database get updated periodically from an external source. That is, the author and book tables get replaced wholesale. But the Book and Author objects are cataloged using ZCatalog, doing a full text index on a combination of fields from the external database and the html chunks. As far as I can see at the moment, this means that every object has to get uncataloged and recataloged, meaning every time the database update happens the zodb inflates considerably, even though very little data has actually changed. So far I can think of two simple solutions to this problem: (1) pack often (2) put the Catalog into a mounted storage backed by a non-undoable storage. I'd rather not do either one of these (the first for obvious reasons, the second simply because I don't want to take the time to learn how to set up a non-undoable storage). Am I missing some other obvious options? It seems like there *ought* to be a way to avoid the overhead of updating the catalog for objects that haven't really changed. --RDM ___ 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] DB connection pooling
Erik Stephens writes: > I've been working on an implementation of connection pooling for the > MySQLDA. Basically, Zope connections will be pooled by connection > string to reduce the number of unecessary connections to MySQL. Isn't that trivial with Zope (thanks to acquisition)? Just instantiate a single MySQL Database Connection per connect string (sufficiently high above in the site hierarchy). Use it below through acquisition. Dieter ___ 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] Authentication
Hi there, I'm using Zope for a school's homepage. There is a small team of people managing the site. Their user definitions (in acl_users) have the "team" role wich is defined at the root folder. The "team" role is allowed to do everything except managing users. The team has been able to manage DTML Documents and Folders so far. Now I've written a tiny python product (using the how-to). And now they're not allowed to manage the properties of instances. Interesting enough, my self-defined permissions don't appear under "Security". What am I doing wrong? Here is a code sniplet out of my python code: __ac_permissions__= ( ('View management screens', ('manage_main', 'manage_InfoForm'), ('Manager,')), ('View', ('', 'index_html', 'getInfo', 'getPhoto'), ( 'Manager', 'Anonymous')), ('Add Image', ('manage_addImage',), ('Manager',)) ) ... Globals.default__class_init__( CkTeacher ) Another problem: A DTML Method calls objectValues() on the folder. Calling the method on any sub-folder works, but calling it on the root folder fails, even when I'm logged in as a Manager. I figured it fails because of some sub-object's permissions. Thanks in advance Phil. -- Philipp von Weitershausen [ *pronounce: "fun Viters-houzen" ] Web http://www.philikon.de ___ 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 )