[Zope-dev] RE: Additional Quoting; Exposing Auxiliary Tag Functions via _

2000-07-31 Thread Casey Duncan

Dieter Maurer writes:
 The existing "quote features" name the context for which quoting
 is needed. The context determines what needs to be quoted and
 how quoting has to be done.
 Your proposal does not state the context but only the how.
 Otherwise, I would think such an extension would be good.

You are right here. I just came up with "slash_quote" off the top of my
head. "string_quote" is a good language-neutral name I think that is similar
in spirit to the present format options.

 Thus, I propose:

 1. new quoting directive "string_quote" quoting Python strings
i.e. ", ' and \ are quoted.
This would work for Javascript (and other languages with
C-like quotation and string literals), too.

 2. all auxiliary functions for DTML tags, especially quoting,
should be available via the namespace.

To avaid namespace pollution, they may go into a separate
module, say 'aux'.
E.g. I would like to use quoting, formatting etc.
inside DTML embedded Python expressions in a form like that:

   dtml-var "... _.aux.fmt(x,'%m/%d/%Y')..."
and
dtml-var " _.aux.sql_quote(x)..."

This idea has merit, and extends the usefulness of these options to parts of
an expression rather than just the whole thing. I think calling the module
'aux' might not be the best for code readability sake though. Perhaps it
should just be called fmt or format. Perhaps like so:

dtml-var "... _.fmt.expr(x, '%.2f') ..."
and
dtml-var "... _.fmt.string_quote(x) ..."

newbie format methods could be added too (Feature creep alert!) like:

dtml-var "... _.fmt.currency(x) ..."

in place of the first one.


___
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] Z SQL Method Patch

2000-09-07 Thread Casey Duncan

In debugging some Z SQL methods I found it quite hard to diagnose certain
errors returned by the database backend because Zope doesn't return the SQL
sent to the server, instead it returns "Could not render the query
template!" which is not really true for this case.

In looking at the source code of DA.py (lib/python/Shared/DC/ZRDB), and I
think I found a simple solution:

in manage_test insert the following indented after line 343 (except:)

try: src=self(REQUEST, src__=1)
except: pass

This re-renders the query template if possible without sending it to the
backend and returns the SQL in src. The result is your backend error message
followed by the SQL generated. This should really save time debugging any
dynamic Z SQL methods.

It was moderately tested on Zope 2.2.1/PostgreSQL 7 via PyGreSQLDA. It
should not be database dependant though.

Enjoy.
-Casey Duncan


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

2000-10-23 Thread Casey Duncan

I am making it my mission to enhance the beast that is ZCatalog. This is the
first of many improvements I hope to make to it as time goes on.

DISCLAIMER
This patch has only been moderately tested, and all side affects are not
known. I am submitting it here for review before adding it to the collector.
You take full risk in using this patch on your installation.
/DISCLAIMER

OK, what this patch does is allow you to concatenate ZCatalog result
sequences (Lazy sequences) without loading the whole enchilada into memory.
It also dispenses with the funky workaround/hack notation that currently
exists (although it still works AFAIK). Once this patch is in place, you
will be able to write code as follows:

dtml-in "Catalog(args)+Catalog(other args)+..."
   ...
/dtml-in

or even:

dtml-in "Catalog1(args)+Catalog2(args)"
   ...
/dtml-in

The latter might be useful for dealing with ZCatalog scaling issues, or
combining completely objects from entirely different locations.

The patch changes Lazy.py and Catalog.py (very slightly). These files can be
found in your {Zopedir}/lib/python/Products/ZCatalog directory.

Add the following code into the Lazy class definition in Lazy.py. I added it
at the end following line 118 (slice=__getslice__):

def __add__(self,other):
# Concatenate result sequences together while remaining lazy

# Make sure the object we are concating is also Lazy
try:
if other.__class__.__bases__[0].__name__ != 'Lazy':
raise TypeError, """Cannot concatenate objects. Both
must be lazy result sequences (ie ZCatalog results)"""
except:
raise TypeError, """Cannot concatenate objects. Both must be
lazy result sequences (ie ZCatalog results)"""

if self.__class__.__name__ == 'LazyCat':
# Don't nest LazyCat objects unnecessarily
if hasattr(self,'_seq'):
seq = self._seq
else:
seq = [self._data]
else:
seq = [self]

if other.__class__.__name__ == 'LazyCat':
# Don't nest LazyCat objects unnecessarily
if hasattr(other,'_seq'):
seq = seq + other._seq
else:
seq = seq + [other._data]
else:
seq = seq + [other]

return LazyCat(seq)

The change to Catalog.py is a single line as follows:

Change line 603 (if not r: return r) to:
if not r: return LazyCat(r)

The change to Catalog.py prevents empty catalog search results from throwing
an exception when concatenating it with a non-empty search result. This is
the only part that I see as a risk to break existing code. If you, for
whatever reason, relied on a ZCatalog returning an empty list ([]) when the
search came up empty, your code will no longer work. Here is an example:

dtml-let result="Catalog(args)"
dtml-if "result == []"--- This no longer works
   ...
dtml-else
   ...
/dtml-if
/dtml-let

However this still does:

dtml-let result="Catalog(args)"
dtml-if result
   ...
/dtml-if
/dtml-let

And this does what you expect of it when both searches come up empty:

dtml-in "Catalog(args)+Catalog(other args)"
   ...
dtml-else
   ...
/dtml-in

IMHO this is a very minor side affect, and well worth the gain.

Please scrutinize this patch and pick it apart and let me know what works
and what doesn't or if I've missed something.

Enjoy,
Casey Duncan


___
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] ACL users and Packing the DB

2000-10-30 Thread Casey Duncan

Keith Larsen Wrote:
 I have found a way to kill the user via a link or straight html url


http://username:[EMAIL PROTECTED]:8080/testfolder?ids:list=acl_users;
manage_delObjects:method=Delete
 now if I can get my lynx to run it ok I will be set. ( lynx does not like
 it so far but works fine from a browser url )

If Lynx isn't working, try the -force_html switch. I think Lynx gets
confused by the fact that the URL does not point to a .htm or .html file.

-Casey D.


___
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] calling dtml method with same name up the hierarchy.

2000-11-06 Thread Casey Duncan

The following should work in your nested standard_html_footer to call the
higher level one without infinite recursion:

dtml-with "PARENTS[1]"
   dtml-var standard_html_footer
/dtml-with

hth,
Casey D.


___
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] JPython Product?

2000-11-07 Thread Casey Duncan

I have been toying with the idea of creating a Zope product for creating
JPython applets within Zope. I thought this might be a way to increase the
capabilities of Zope on the client-side while remaining firmly grounded in
Python and simultaneously giving me an excuse to play with JPython and maybe
create a useful Zope product too.

I wanted to throw this out to the group to see if others thought this was a
worthwhile capability.

The basic idea would be to write JPython scripts and applets in Zope either
via the web or otherwise and automagically "compile" them into transparent
.jar files that are served to the client on request. Sounds so simple!
Right?? Somehow I doubt it will be, but...

From what I see no one has done this so I figure at least one of following
is true:

1. Nobody thought of it or felt compelled to act on the thought.
2. Its gonna be hard to do.
3. Somebody else already did it and I don't know about it.
4. The idea blows.

Any thoughts on this idea, + or - are appreciated.

-Casey D.





___
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] JPython Product?

2000-11-08 Thread Casey Duncan

Steve:

That is good to know, being a Mac fan myself. I'll have to play with and
test the different browsers on the client side as well as server-side jdks.
From what I have learned so far on the server end, the project seems
reasonably feasible.

I think the interesting part will be creating the precise dividing line
between the JPython and CPython worlds. I doubt much JPython will exist in
the product excepting some "glue" to get Zope/CPython to interact with it in
a robust way. That will probably be the fun part.

Thanks for the comments,
Casey D.

-Original Message-
From: Steve Spicklemire [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 08, 2000 5:33 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [Zope-dev] JPython Product?



Hi Casey,

   I think this is a fine idea. The main thing that keeps me from
doing it is that JPython doesn't work on Netscape (Mac) and so (at this
point at least) I can't use it, unless I have a context where I can
insist that users use a particular browser.

The other annoyance is the long download time for the JPython
implementation

The other annoyance is the general flakiness of Java VMs out there

But.. I think the concept is a good one.. and once the JPython
implementation is cached it should be pretty fast. Then you just
have to worry about all the JVM bugs. ;-)

good luck!
-steve


___
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] objectValues performance

2000-11-28 Thread Casey Duncan

Brett Carter wrote:

 I have a folder with greater than 5000 ZClass instances in it.  It
 takes  5mins to do an objectValues for every object in the folder -
 is there a higher perfomance call I could make?
 -Brett

Standard folder performance degrades pretty quickly once you get
a lot of objects in it. There are two solutions to this:

Subdivide your objects into multiple folders.
Use a BTreeFolder which should be much faster.

You can download the BTreeFolder product
here: http://www.zope.org/Members/hathawsh/BTreeFolder/

hth,
Casey Duncan






___
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] objectValues performance

2000-11-28 Thread Casey Duncan

Brett Carter wrote:

 Ok, I'll bite.  Why doesn't the standard folder scale?  Seems like a
 design flaw to me - why doesn't the default folder use catalogs or BTrees?
 -Brett

AFAIK a standard folder uses a linear search when you request an object from it
(ala Python dictionaries, someone please correct me if I'm wrong). This works
great except that the search time grows linearly (by n) as you add objects. The
BTreeFolder as the name implies creates a binary tree of the objects where the
search time grows by only log n. For small folders the search time difference
is minimal to non-existant, but as n increases the BTreeFolder search time
increases minimally. B-trees are fairly complex entities to manage and for the
vast majority of folders are total overkill. That is why standard folders work
the way they do, the implementation is simple and efficient for 99.9% of
applications. Your case is fairly atypical of most Zope folders.

Perhaps a future implementation of Zope folders could automatically use a
b-tree after a certain threshold is reached, for now you must explicitly select
them.

Andy's idea of using objectIds instead of objectValues is also a good one which
will save significant amounts of memory. You can always access each object
individually via id if you need to. Using a  ZCatalog could also help in this
because you can query the objects without loading them into memory and the
returned result does not load the objects themselves, only the meta-data and
only once a result item is explicitly accessed (By using so-called lazy
sequences). However the catalog will not speed up your actual object access
time unless you divide them up amongst several folders or use a BTreeFolder.
The latter being a simpler solution from a design standpoint.

Good luck!

Casey Duncan


___
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] file references

2000-12-07 Thread Casey Duncan

Dan Sashko wrote:
 
 ~~~sorry for double post if you get it twice... I think I sent it first from
 the wrong email address
 
 is there a way in zope to reference a document on a server without having it
 to be in the
 zope database???
 
 if I want to display say a microsoft document, with content type of
 application/msword so that
 the Internet explorer displays it as formated word document and so that it
 can be saved back to server???
 
 or is there other ways of accomplishing the same thing?
 
 thank you for any help
 
 Dan S.
 

You can view access files in a local file system through Zope using the
LocalFS product. You should also be able to access shares mounted from a
remote server through this as well (nfs, smb, etc). However this will
not let you save the document back once it is opened. For this you could
perhaps use WebDAV ("Web Folders" in MS-speak), although I am unsure
whether LocalFS supports this. My guess would be that it does. You will
need IE5/Office 2000 for the WebDAV support on the client side, Zope
already has the server-side support built in.

Another perhaps better option would be to simply share the files via smb
and link to them from the Zope pages via a "file://" link that opens
them directly off the file server rather than through Zope. This would
prevent you from having the jerry-rig Zope into being a file server.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] zPoPyDA and DB Transactions

2000-12-13 Thread Casey Duncan

I had been using Postgres with the zPyGreSQLDA and recently switched to
zPoPyDA for a new project. I noticed that zPoPyDA does not seem to
implicitly wrap each zSQL method in a database transaction as
zPyGreSQLDA did.

Reading the code for zPoPyDA seems to confirm this. Is this behavior by
design or a bug or am I missing something? 

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Catalog class--does it support boolean queries?

2000-12-14 Thread Casey Duncan

Marc Conley wrote:
 
 I am working on a project which requires the use of the Catalog class
 (versus ZCatalog) for
 indexing and querying. I have basic full text indexing and querying working
 correctly but
 boolean queries seem not to work. Should boolean queries work using Catalog
 or is it
 necessary to use ZCatalog instead to get that functionality?
 
 This is how I am submitting the query to the Catalog object:
 
 results = sdb.cat({"content" : query})
 
 where sdb is a ZODB, cat is the catalog object, and content is the name of
 the full-text index. query is
 the query the user typed, which could be
 
 "(apples and oranges) or plums"
 
 (without the quotes) for instance. Thanks in advance for any assistance
 anyone can provide on this question.

You should be able to do what you want using just catalog.

If your example query is an example of something you are really using,
try it without parens.

e.g. "apples and oranges or plums"

AFAIK grouping in query strings is not supported.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Search Interface [was 'case insensitive sorts']

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Rik Hoekstra wrote:
 
  Hm, reading this... just a loose comment.
  In light of the awkward search interface of ZCatalogs, would it be a good
  idea to make a search interface for ZCatalog ZPatterns based? T
 
 I'm starting to feel like a stuck record on this, but lots of people
 seem to be asking for it in their own way... ;-)
 
 If the ZSearch Interface was properly documented and fully featured (ie
 defined how you search an object that supports the interface, and how
 you would index objects using that interface) then we wouldn't be stuck
 with the ZCatalog. It would enable people to write SQLIndexers,
 ZPatterns-based Catalogs and anything else they want, all of which would
 be freely interchangeable with the ZCatalog.
 
 Comments?
 
 Chris
 

I would love to see this happen. Sounds like a fishbowl project to me!

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Marc Conley wrote:
 
  boolean queries seem not to work. Should boolean queries work using Catalog
  or is it
  necessary to use ZCatalog instead to get that functionality?
 
 I'm not sure boolean queries work in either. If they do, anyone know
 where their syntax is documented?
 
 cheers,
 
 Chris

From digging around in the code, here is the general text index query
syntax (if you can call it that):

"one two three" and "one or two or three" are equivilant, multiple words
are "orified" by default. Hits are scored according to the number of
words matched, so by default, objects matching all words will be first
in the results. 

"one and two and three" and ['one','two','three'] will return only
objects containing all three words.

"one and not two" ('andnot' also works) works as advertised.

Wildcard characters "*" and "?" can be used to match multiple word
forms. e.g. a query for "great*" would match "great", "greats",
"greatest", "greatly", etc.

There is also a mentioned support for "near" searching in the code using
a '...' operator, although in practice this does not work 8^(. It seems
as though all non-aphanumerics are stripped from the query somewhere.
IMHO this should probably just use the word "near" as an operator
anyway.

For those interested, the indexing/searching code lives in {Zope
Dir}/lib/python/SearchIndex.

In doing some more digging in UnTextIndex.py there I do see support for
parens and quoted phases, although in practice they do not work. If I
find time I will delve into this further.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Casey Duncan wrote:
 
  In doing some more digging in UnTextIndex.py there I do see support for
  parens and quoted phases, although in practice they do not work. If I
  find time I will delve into this further.
 
 Cool, if you document it anywhere, please let us know...
 
 Chris

2.3.0a1 seems to be a bit more friendly toward near, and parens and
quoted phrase searches. I will be looking into this further. Perhaps a
howto is in order?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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: objectIds accessiblilty and a proposal

2000-12-18 Thread Casey Duncan

Paul Erickson wrote:
 
 If it is an issue for XML-RPC users, maybe there should be a
 "Traversable" permission on Folder objects that could default to not
 allowing web-traversal, but allowing it to be enabled if desired.
 
 Would this affect FTP access to folders?
 
 -Paul
 
I agree. That would temper any grumbling and solve the problem (although
not the problem of the ever growing security list).
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] zPoPy oid issues

2000-12-26 Thread Casey Duncan

On my Zope instance (2.2.4) using zPoPyDA (0.7) and PoPy (1.4.1) any
select query trying to return an oid from postgres (7.0.3) crashes Zope.

i.e. SELECT oid FROM foo;

After doing some digging around, trying to do the same query directly in
Python using the PoPy module results in a seg fault. So the problem
would seem to be with PoPy and not the DA.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: zPoPy oid issues

2000-12-27 Thread Casey Duncan

[EMAIL PROTECTED] wrote:
 
 Hi,
 
 The problem is inside postgresql ! They use OID type for LOB and for table'oid, PoPy 
(to simplify LOB handling) detect automagically LOB and returns them to the end user 
who can handle them easily.
 I study the postgresql sources on the CVS and they haven't resolv this problem.
 We have to write this in the BUGS file we plan to add soon in our release.
 
 If you have any proposals to resolv this BIG problem ?
 
 I'm sorry for this but postgresql types are very confused.
 
 Best regards.
 
So, if I understand correctly, oids are handled as large binary objects?
From what I see, oids are 6 bytes in length (using SELECT
length(oid)...) since they have a max value of 4 billion, that leads me
to believe that only 4 bytes are used as a numeric value. So, they are
really just a glorified int4 with 2 extra bytes tacked on for some
reason.

Anyhow, why exactly does this cause PoPy to crash? I can surely work
around this problem for now, but I can certainly see cases where
returning an oid would be an essential function, especially if you are
working on a generalized database tool.

I am certainly willing to help get this fixed. Any additional
information you (or anybody) has regarding this would be greatly
appreciated.

Thanks for your help.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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: zPoPy oid issues

2000-12-27 Thread Casey Duncan

Actually I found that the Postgres length function returns the string
length (i.e. number of digits) of a number, so my previous message was
wrong about the byte length of an oid. AFAIK they are 4 byte integers.

I have found a way to retrieve oids without crashing Python or Zope. You
must do an explicit type conversion to a 4 byte integer like so:

SELECT int4(oid) FROM foo;

This behaves in a much friendlier manner. I would still like to see the
problem resolved, as I find the fact that an innocuous SELECT query
could crash Zope a bit troubling.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] case insensitive sorts

2001-01-03 Thread Casey Duncan

Andy Dawkins wrote:
 
  Your analogies imply that this behavior is a bug or an unintended flaw
  in the design. I would argue that it is intentional. Unix file systems
  work the same way. Try doing an "ls" with mixed case files and you'll
  see what I mean.
 
 
 It isn't a flaw.  It seems as though it was overlooked.
 
 The sort on text works by sorting the data by its ascii value.
 Capital letters have a lower ascii value than lower case letters.
 i.e.
 A-Z = 65 - 90
 a-z = 97 - 122
 
 The arguement is that the sort should probably go
 AaBbCcDdEeFf.etc
 
 -Andy
 
My point is that the sorting is intentionally Unix-like and case
sensitive on purpose. Not due to laziness. But, perhaps the reason Unix
is like that to begin with is due to laziness anyhow 8^). We'll never
know for sure.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: Spitter.c Hack

2001-01-05 Thread Casey Duncan

Jason Spisak wrote:
 
 Zopists,
 
 I finally got Splitter.c to let me index numbers and 'C++' in a TextIndex.
 I have about 50,000 objects in that index, and search performance is nearly
 instantaneous still.  I am running on a big machine though.  If anyone
 wants those changes there's really easy.  Just mail me directly, since it's
 a long file to post.

Could you maybe post just the diff for poserity?

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] New UI for 2.3

2001-01-10 Thread Casey Duncan

--- Steve Alexander [EMAIL PROTECTED] wrote:
 However, I do not like the 3-frame interface. I feel
 that the top frame 
 is wasted space. The Zope logo and "Logged in as
 username | Logout" 
 could as easily go at the bottom of the tree-view
 frame on the left. 
 This would leave extra screen space for doing work.
 

I agree 100%. please change this! I like the look of
it, but it serves little purpose for the space it
uses.

 
 I also much prefer blue to black as a background
 colour for the tabs and 
 the "Root Folder" link. The black seems a bit
 overbearing.
 

I agree here as well. Why does the root folder need to
look different anyway? Just labelling it "Root Folder"
is sufficient IMHO. I think it will cause confusion
for it to look so different.


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.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 )




Re: [Zope-dev] ZCatalog and 'fuzzy logic'

2001-01-10 Thread Casey Duncan

--- "Morten W. Petersen" [EMAIL PROTECTED] wrote:
[snip]
 
 It seems I misunderstood the term fuzzy logic
 myself.  Fuzzy logic means
 if I search for a word, for example 'programmer', it
 will return matches
 to the words 'program', 'programming','programmable'
 etc.
 
 I.e., it will somewhat intelligently return words
 that are similar in
 what they mean, using grammar rules (chopping off
 endings of words and
 making them match others).
 
 Hmm.
 
 Cheers,
 
 Morten
 

ZCatalog TextIndexes support this type of "wildcard"
searching. I posted a message a couple of weeks ago
that describes the query syntax. Search the mailing
list archives for it.


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.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 )




RE: [Zope-dev] New UI for 2.3

2001-01-11 Thread Casey Duncan

I agree that it looks better. The addition of another
whole frame for this though is my main beef with it.
Perhaps this could be integrated some other way.
Frames should only be added when there is no other
option.

It's just that browsers waste so much space up there
anyway, and the extra 32 pixels are in addition to
that "waste".

I personally don't care how it "looks" so much as how
efficient it is. All of the other aethestic changes I
feel enhance both looks and efficiency. The top frame
does not IMHO. Form should definitely follow function
here.

BTW: I have been know to use Zope on an old machine
with a 640X480 screen. Although I generally eschew the
frames altogether then and open manage_main by itself.
It's not really fun, but it works.

--- Brian Lloyd [EMAIL PROTECTED] wrote:
 Are you guys working on 486's with 13in. monitors at
 640x480
 or 
 something? :^)
 
 Seriously - Zope has been criticized for a very long
 time
 for
 being, ah, aesthetically challenged :) It is a valid
 criticism 
 - we have been (and quite honestly, will continue to
 be)
 more 
 concerned with function over form. But is it really
 so bad
 to 
 make a 32 pixel-high concession to a small pittance
 of
 branding? 
 
 I know that "branding" isn't important for those who
 are
 already 
 believers, but Zope has grown enough that its
 reasonable to
 put 
 some effort into "first impression factor". It
 doesn't help
 the 
 community for reviews to come out that waste words
 on the 
 visual appeal shortcomings of the UI and totally
 miss the 
 point. A better first impression is a Good Thing.
 
 The top frame is also a place where we might want to
 put
 more
 "placeless" operations like logout in the future.
 You can
 only 
 jam so much into the tree pane without it looking
 very much 
 like way too much is being jammed into the tree pane
 :)
 FWIW,
 one of the things we may put there later is a way to
 do
 "browser 
 preferences" via cookies to control things like
 default text 
 area sizes. That could also have a "hide top frame"
 option
 for 
 those who really can't spare the 32px. :^)



=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.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 )




Re: [Zope-dev] How do I create a folder with subfolders, docs etc?

2001-01-11 Thread Casey Duncan


--- Espen Sorbye Frederiksen [EMAIL PROTECTED]
wrote:
 Thank you for your reply. I relised that my example
 was not quite what I
 ment. What if newfolder is a variable taking a
 random string value. How
 can I emediatly after creating the folder, with the
 variable
 newfolder id, create a subfolder within the one I
 just made?
 
 My sample code should look like this:
 
 dtml-call expr="manage_addFolder(id="newfolder")"
 
 dtml-call


expr="newfolder.manage_addFolder(id="anotherfolder")"
 
 If you have any further suggestions I would be
 grateful,
 
 Espen
 

Try this:

dtml-call expr="manage_addFolder(folder_id)"
dtml-call expr="_[folder_id].manage_addFolder('subFolder')"

=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.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] Z Search Interface/ZCatalog bugs

2001-01-15 Thread Casey Duncan

There is a bug in 2.3.0a2 that prevents you from adding a Z Search
Interface. It is basically a pathing issue to a dtml file that moved.
The following is a patch for Aqueduct.py to temper this issue:

102c102
 dtml_dir=Globals.package_home(globals())
---
 dtml_dir=os.path.join(Globals.package_home(globals()),'dtml')

There is also a bug in the Z Search Interface implementation of
ZCatalog. Basically ZCatalog returns the list of Meta Data fields for
both the searchable arguments and results. This means the search form
created for a ZCatalog will probably not contain the correct fields.
This patch corrects ZCatalog so that it returns its indexes as the
searchable arguments.

448c448
 for name in self._catalog.schema.keys():
---
 for name in self._catalog.indexes.keys():

I will be sumitting these to the collector as well.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] manage_changeProperties in a loop

2001-01-17 Thread Casey Duncan

Arno Gross wrote:
 
 If I try your suggestion wiht _.getitem(_['sequence-item'])
 (If I remember well this was the first I tried).
 
 dtml-call "REQUEST.set('rangList','folder1;folder2;folder2')"
 dtml-in " _.string.split(rangList,';')"
dtml-with "_.getitem(_['sequence-item'])"
 dtml-let index=sequence-index
   dtml-call "manage_changeProperties({'rang':index})"
 /dtml-let
   /dtml-with
 /dtml-in
 
 I get this error: File
 D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_In.py, line 691, in
 renderwob (Object:  _.string.split(rangList,';'))   File
 D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_With.py, line 133, in
 render (Object: _.getitem(_['sequence-item']))   File
 D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_Util.py, line 337, in
 eval (Object: _.getitem(_['sequence-item']))(Info: _)
 
 Still any hints. Thanks.

Try this:
dtml-call expr="REQUEST.set('rangList','folder1;folder2;folder2')"
dtml-in expr="_.string.split(rangList,';')"
dtml-let folder="_[_['sequence-item']]"
  index="_['sequence-index']"
dtml-call expr="folder.manage_changeProperties({'rang':index})"
/dtml-let
/dtml-in

Also, why are you passing the folder ids in a string like this? Where
are these names coming from, a form?

If so, there are ways to eliminate the whole string.split. Also, the
code would not need to be this complex if the objects themselves can be
passed instead of a delimited string of ids.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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 block parsing

2001-01-23 Thread Casey Duncan

Steve Alexander wrote:
 With your patch applied, will nested dtml-comment tags still work?
 
 dtml-comment
Some code commented out
  dtml-comment
Documentation in a comment
  /dtml-comment
Rest of code commented out
 /dtml-comment
 
 --
 Steve Alexander
 Software Engineer
 Cat-Box limited
 http://www.cat-box.net

In present form no. It also does not support block continuation tags.

I will see what I can do about this.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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 block parsing

2001-01-23 Thread Casey Duncan

Casey Duncan wrote:
 
 Steve Alexander wrote:
  With your patch applied, will nested dtml-comment tags still work?
 
  dtml-comment
 Some code commented out
   dtml-comment
 Documentation in a comment
   /dtml-comment
 Rest of code commented out
  /dtml-comment
 
  --
  Steve Alexander
  Software Engineer
  Cat-Box limited
  http://www.cat-box.net
 
 In present form no. It also does not support block continuation tags.
 
 I will see what I can do about this.

OK, I have developed a new patch that almost completely fixes this
issue. In fact I am happier with it in general than my first patch.
There is only one flaw, although you can nest comments inside of one
another, and you can have any manner of broken dtml inside, if you open
another comment tag inside it, it must be properly balanced or you will
get a parse error. Here are some examples:

These do not generate errors with my new patch:
dtml-comment
dtml-if blah
/dtml-comment

dtml-comment
/dtml-with
/dtml-comment

dtml-comment
dtml-asdfsadf
/dtml-comment

dtml-comment
dtml-comment
Blah Blah
/dtml-comment
/dtml-comment

These do:

dtml-comment
dtml-comment
/dtml-comment

dtml-comment
dtml-if foo
dtml-comment
/dtml-if
/dtml-comment
/dtml-comment

I am a bit concerned that dtml-comment should ever generate errors at
all, but this is certainly an improvement. Anybody have any thoughts?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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: [Zope-Annce] DTML Eval Tag Released

2001-02-03 Thread Casey Duncan

--- Phill Hugo [EMAIL PROTECTED] wrote:
 Hi Casey,
 
 This looks good but I got the feeling that it may be
 better to use the
 RESPONSE object to store variables in since this
 won't taint the input
 REQUEST. I'm not sure what your feeling is in this
 regard (I'm not sure
 the RESPONSE object is ever used for variable lookup
 as the REQUEST is
 (albeit last of all)) - this could actually be a
 good thing though as it
 would force people to use RESPONSE['variable'] in
 all cases rather than
 sometimes using variable and sometimes
 REQUEST['variable'] depending on
 the variable's name.
 
 The other option would be to pop them on top of the
 namespace as the
 _.namespace method and dtml-let tag seem to do. This
 would remove the
 need to alter either REQUEST or RESPONSE. I'm not
 sure how
 straightforward this would be though.
 
 Let me know your thoughts,
 
 Phill
 
 
Hi Phill,

Thanks for the feedback. As for the REQUEST vs.
RESPONSE usage, the latter can't be used to store
values and is really there as a way to communicate to
the browser. The former is used pretty regularly to
store scratch variables already.

I agree that a better solution is to use a namespace.
That was my original intention. However, namespaces
must be explicitly scoped (ala dtml-let). That is, you
can't create (push) one without explicitly popping it
back off later down the road before the method ends.
One of the primary goals of the eval tag was that you
can assign variables that implicitly have the same
scope as the method they are in, just like any other
decent language.

I also considered just manipulating whatever namespace
happened to be on top of the stack, but there is no
guarantee that the top NS is a mutable object, so that
wouldn't work.

A possible solution to this is for the method to push
an empty scratch namespace for itself when it starts
and pop it when it finishes. Then the eval tag can
just use this namespace to store variables. I
considered that too complex for my first release, but
I certainly will reconsider it for future ones.

Again thanks for the feedback.

=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.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] Bug in DateTime?

2001-02-09 Thread Casey Duncan

I have been working on a calendar for a web site and I came across some
strange behavior with DateTime.

Using the isCurrentDay() method returns true if only the day number of
the month is the same as today's.

For instance, today is Feb 9, 2001. The following returns true however
in both Zope 2.2 and 2.3:

DateTime('3/9/2000').isCurrentDay()

Is this the expected behavior? Checking the code leads me to believe the
other isCurrent* methods behave in a similar way.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] DateTime Patch

2001-02-12 Thread Casey Duncan

I have concluded that DateTime has bugs in its isCurrent* methods.

Basically isCurrentMinute, isCurrentHour, isCurrentDay and
isCurrentMonth all would return true at inappropriate times. For
instance, isCurrentDay will currently return true if the day number of
the date is equal to the current day number regardless of current month
or year. The others behave in a similar manner.

Attached is a patch for DateTime.py that fixes the above. I am also
submitting it to the collector.

Enjoy.
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

*** DateTime.py.old Mon Feb 12 08:40:23 2001
--- DateTime.py Mon Feb 12 09:40:22 2001
***
*** 1153,1180 
 that falls within the current month, in the context
 of this object\'s timezone representation"""
  t=time()
! return safegmtime(t+_tzoffset(self._tz, t))[1]==self._month
  
  def isCurrentDay(self):
  """Return true if this object represents a date/time
 that falls within the current day, in the context
 of this object\'s timezone representation"""
  t=time()
! return safegmtime(t+_tzoffset(self._tz, t))[2]==self._day
  
  def isCurrentHour(self):
  """Return true if this object represents a date/time
 that falls within the current hour, in the context
 of this object\'s timezone representation"""
  t=time()
! return safegmtime(t+_tzoffset(self._tz, t))[3]==self._hour
  
  def isCurrentMinute(self):
  """Return true if this object represents a date/time
 that falls within the current minute, in the context
 of this object\'s timezone representation"""
  t=time()
! return safegmtime(t+_tzoffset(self._tz, t))[4]==self._minute
  
  def earliestTime(self):
  """Return a new DateTime object that represents the earliest
--- 1153,1186 
 that falls within the current month, in the context
 of this object\'s timezone representation"""
  t=time()
! gmt=safegmtime(t+_tzoffset(self._tz, t))
! return gmt[0]==self._year and gmt[1]==self._month
  
  def isCurrentDay(self):
  """Return true if this object represents a date/time
 that falls within the current day, in the context
 of this object\'s timezone representation"""
  t=time()
! gmt=safegmtime(t+_tzoffset(self._tz, t))
! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day
! 
  
  def isCurrentHour(self):
  """Return true if this object represents a date/time
 that falls within the current hour, in the context
 of this object\'s timezone representation"""
  t=time()
! gmt=safegmtime(t+_tzoffset(self._tz, t))
! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day and 
gmt[3]==self._hour
  
  def isCurrentMinute(self):
  """Return true if this object represents a date/time
 that falls within the current minute, in the context
 of this object\'s timezone representation"""
  t=time()
! gmt=safegmtime(t+_tzoffset(self._tz, t))
! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day and 
gmt[3]==self._hour and gmt[4]==self._minute
! 
  
  def earliestTime(self):
  """Return a new DateTime object that represents the earliest



Re: [Zope-dev] Programmatic way to get the Zope Version

2001-02-12 Thread Casey Duncan

Steve Alexander wrote:
 
 Chris Withers wrote:
 
  Hi,
 
  I was if do something like:
 
  if zope_version = 2.3:
# balh
  else:
# blah
 
  Where do I get the zope_version bti and what format will it be in?
 
 You can get it as version_txt from Control_Panel. For example, from DTML:
 
 dtml-with Control_Panel
   dtml-var version_txt
 /dtml-with
 
 However, this won't do you much good, as when you have a version
 of Zope from CVS, it gets called "(unreleased version)".
 
 The way some Products detect the version is to try to import a
 module that only exists in one version of Zope, or try to look up
 an attribute that is only in one version of Zope, and then catch
 the Exception. Ideally, this will be the attribute or module that
 has changed that made you want to detect the version in the first
 place.
 
 Make your choices based on whether there is an Exception or not.
 
 --
 Steve Alexander
 Software Engineer
 Cat-Box limited
 http://www.cat-box.net
 

dtml-var SERVER_SOFTWARE

should do it. It is an attribute of REQUEST. I'm not sure what this
looks like on CVS versions though.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Calling Catalog from python script

2001-02-14 Thread Casey Duncan

"R. David Murray" wrote:
 
 I'll probably figure this out as soon as I post like last time, but I've
 been staring at it and can't see my mistake.  The following code returns
 a list of None's:
 
 objs = []
 for catent in container.Catalog(context.REQUEST):
   objs.append(container.Catalog.getobject(catent.data_record_id_))
 return objs
 
 I've checked, and catent is a mybrains instance and catent.data_record_id_
 has an increasing number as its value.  So why doesn't this work?
 
 Also, and this is a better reason for posting this to zope-dev than
 asking for help is grin: why can't I say
 
   catent.getobject()
 
 That would seem to be a lot more OOish.
 
 This is under Zope-2.3.0, by the way.
 
 --RDM
 
That code looks pretty good to me. Did you try updating the Catalog?
Also, what happens if just append catent. Do you get something other
than None then? I would assume so, but it might help to see exactly what
the meta data is to identify the objects it "should" return.

I agree that getobject should be a method of the result item, although
implementing it might be a bit tricky to do. I looked into that a while
back. Perhaps I should take another look at that...

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Using Zope for Groupware/Messaging applications

2001-02-16 Thread Casey Duncan

"R. David Murray" wrote:
 
 Let me be a bit less cryptic.  Design your system, and use ZPatterns, and you
 can defer questions about which storage suits the parts of the app until
 later, and can change your mind at need.  For the kind of project you
 are embarking upon, the time needed to learn ZPatterns is well worth it.
 
 --RDM
 

I concur. It would be best to abstract the storage. Using this technique
you could scale the underlying storage theoretically without changing
the top level code. That would also facilitate more experimentation on
which scheme or combination of schemes would work best.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] how to create third party Product?

2001-02-19 Thread Casey Duncan

Huayin wang wrote:
 
 It would be great if someone can tell me how to create
 a third party product in 1) dtml, 2) python method.
 Does it depend on whether the product is a ZClass
 product?
 
 Where's the documentation that I can read to get a
 clue?
 
 thanks!
 

Check out:
http://www.zope.org/Documentation/Guides/ZDG-HTML/ZDG.html
http://www.zope.org/Members/kedai/BuildSimpleZClass
http://www.zope.org/Members/AlexR/CatalogAware
http://www.zope.org/Members/maxm/HowTo/minimal_01
http://www.zope.org/Members/gtk/Boring/HowTo-Boring

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] ZCatalog Lazy Results

2001-02-20 Thread Casey Duncan

--- Johan Carlsson [EMAIL PROTECTED] wrote:
 Hi,
 I need to check an assumption I have made on the
 ZCatalog Brains and Lazy Results from reading the
 source.
 
 1. The Brains gets its schema from the ZCatalog and
 this
 schema is basicly fixed. E.g. a search result
 always has
 the attributes defined by the Meta Data in the
 ZCatalog?

Yes, you always get all the meta-data. However, does
anyone know how the "used" argument of
ZCatalog.searchResults works, or why you would use it?

 
 I would rather be able to construct a Brain Schema
 at search time
 equivalent to the way theSELECT statement sets up
 the result attributes
 in SQL. 
 Example: 
 resultset =

Catalog.searchResults(query,schema=('id','title','keywords'))

Why is this important? I would suggest not putting big
stuff in the meta-data that might warrant this. Just
use the nifty new (v2.3) getObject method of the brain
to access whatever properties/methods of the actual
object you might need.

 
 2. The laziness of the ZCatalog search result means
 it's batched?
 

Lazy sequences work by not loading the result items in
memory until they are actually accessed.

 Regards,
 Johan Carlsson

=====
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.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 )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Casey Duncan

--- Andy McKay [EMAIL PROTECTED] wrote:
  I disagree but it's not worth arguing about.
 However, the people who pay
 my
  salary feel that way which means I care ;-)
 
 Ive been taking the Larry Wall approach to this when
 people tell me the
 correct way to do things:
 
 "A Perl script is "correct" if it gets the job done
 before your boss fires
 you."
 
[snip]

Well hell, what's good enough for Perl is good enough
for... *slaps self silly*

C'mon, are you really seriously gonna back up
reasoning for Zope features by quoting Larry Wall???
8^)


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.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 )



Re: [Zope-dev] ZCatalog distinct in SQL

2001-02-23 Thread Casey Duncan

--- Valérie Aulnette [EMAIL PROTECTED] wrote:
 Hi, 
 
 I am using PTK and it does work with ZCatalog.
 I need to do the list of values that are in the
 catalog  but I need do do like a "select distinct"
 in
 SQL to have each value only once.
 Do you know how to do that in ZCatalog ?
 
 Thanks.
 Valerie.
 


For fieldindexes there is a catalog method
uniqueValuesFor(name) which when passed the name of
the index returns the unique values within it.

hth,

=====
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.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 )



Re: [Zope-dev] ZCatalog hackery

2001-03-01 Thread Casey Duncan

Casey Duncan wrote:
 
 "Morten W. Petersen" wrote:
 
  Hi guys,
 
  I've got a problem with ZCatalog.  I've got plenty of large
  objects, ranging from 100KB to 100MB in size.  Needless to
  say, these take up a lot of processor time when indexed by
  the ZCatalog.
 
  Now, these object have to be moved from time to time, only
  moved, so that one or two of the related columns and indexes
  are affected (the path and the parent container id); is
  there a way to go around this so that those two, the
  one column and the index are updated, and not, let's say
  the indexed body (which is 100KB - 100MB in size) ?
 
  Thanks,
 
  Morten
 
 
 There is no built-in way. however I see no reason that the Catalog could
 not be extended to do this with a bit of python coding.
 
 A catalog contains a collection called indexes that contains the indexes
 themselves (what else?). An External method could be written like so
 (not tested):
 
 def partialReindexObject(catalog, indexes, uid, object):
 rid = catalog.uids.get[uid]
 
 for idx_key in indexes:
 idx = catalog.indexes[idx_key].__of__(catalog)
 idx.unindex_object(rid)
 idx.index_object(rid, object, None)
 
 I think that will do it. Pass the names of the indexes as a sequence in
 indexes, and data_record_id_ as the uid.
 
 The above does not update any meta-data in the catalog.
 

Actually what I wrote assumes you are passing a Catalog not a ZCatalog.
So you will need to change it for a ZCatalog to:

 def partialReindexObject(zcatalog, indexes, uid, object):
catalog = zcatalog._catalog 
rid = catalog.uids.get[uid]
 
for idx_key in indexes:
idx = catalog.indexes[idx_key].__of__(catalog)
idx.unindex_object(rid)
idx.index_object(rid, object, None)

Sorry about that.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Class attr hotfix

2001-03-02 Thread Casey Duncan

I noticed that the most recent hotfix completely
denies access to the getClassAttr, setClassAttr and
delClassAttr from DTML. Is this going to be the
behavior for future Zope versions?

I know this will break code, so it might be prudent to
alert people when the fix is rolled into the next Zope
release.

I would like to argue for deprecating these functions
in favor of making the ZClass act like a dictionary so
that:

ZClass.set('name',value)
ZClass.get('name'[,inherit])
ZClass['name']

could be called securely from scripts. I would be
willing to write the code for this if you think it
would be a good idea.

=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.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 )



Re: [Zope-dev] Class attr hotfix

2001-03-05 Thread Casey Duncan

Brian Lloyd wrote:
 
  I noticed that the most recent hotfix completely
  denies access to the getClassAttr, setClassAttr and
  delClassAttr from DTML. Is this going to be the
  behavior for future Zope versions?
 
 Yes - I think that manipulating actual class objects from
 DTML is a Bad Thing.
 
 
  I know this will break code, so it might be prudent to
  alert people when the fix is rolled into the next Zope
  release.
 
  I would like to argue for deprecating these functions
  in favor of making the ZClass act like a dictionary so
  that:
 
  ZClass.set('name',value)
  ZClass.get('name'[,inherit])
  ZClass['name']
 
  could be called securely from scripts. I would be
  willing to write the code for this if you think it
  would be a good idea.
 
 I'm not sure why you're wanting to do that, so it scares
 me :) I think that manipulation of class objects is
 beyond the scope of what "DTML scripters" should reasonably
 expect to be able to do.
 

Oh nothing too scary. Mostly I have used it to store a counter to
automatically assign ids to new ZClass instances.

I was really thinking of this as a way to store properties across all
instances of a ZClass. I agree that manipulating objects from DTML is
BAD. My intention was to just store a property value or three.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] QuickTime VR Movies

2001-03-12 Thread Casey Duncan

Andre Schubert wrote:
 
 Hi all,
 
 I have found an error or bug in handling QT VR Movies with Zope.
 I have uploaded three qt files into Zope as File objects.
 
 I also have installed this files in the normal appache directory.
 
 Now comes the error? If i do a wget with the files from the apache
 directory and thi files from Zope i get always two different version of
 the same file. That means that a QT File that comes from Zope has a
 different content than a file comes from apache.
 The problem is that this litte difference makes a qt plugin to crash.
 
 I'am using zope 2.2.4 on Immunix 6.2(redhat).
 
 Who can help???
 

What is Content-Type you are getting from Zope?
What is the correct Content-Type?
What is the extension of the QTVR file that was uploaded (if any).

Zope uses the file extension or mime type of the uploaded file to try to
determine the content-type of the file/image object . I don't see QTVR
files listed specifically (although .mov and .qt are listed and map to
'video/quicktime'). If you don't have that many files, you can set the
content-type manually in the Properties tab of the file object.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] QuickTime VR Movies

2001-03-13 Thread Casey Duncan

Andre Schubert wrote:
 
 Hi,
 
 the content-type of the files is video/quicktime. If i get such a file with
 wget i got the correct content-type, but the binaries of the file are
 different to a file got from apache.
 
 mfg
 

My question then is, what is the "correct" type that apache returns?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] (Z)Catalog searches

2001-03-15 Thread Casey Duncan

[EMAIL PROTECTED] wrote:
 
 We're using the internals of ZCatalog to do searching stuff in our Python
 Product. I've managed to get it working at a basic level by constructing a
 Catalog instance and adding indexes and calling searchResults(). Only now I
 need to get into more advanced features, like partial word matches and
 multiple or'ed search fields.
 
 I tried just passing a GlobbingLexicon() to Catalog instantiation, but that
 completely failed to work. As far as I can tell, it's not using the
 GlobbingLexicon at all (I put a print statements in all the methods and
 nothing is printed).
 
 I then tried using ZCatalog.Vocabulary(globbing=1) and that didn't seem to
 work either (still no hits on the GlobbingLexicon methods).
 
 Also, any hints as to how to have a "match any" multiple field "or" search
 would be greatly appreciated. I _think_ I can somehow pass a list of the
 fields to searchResults() as some sort of argument, but I'm really not sure
 how.
 
 Richard
 
 --
 Richard Jones
 [EMAIL PROTECTED]
 Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)
 

Globbing support is part of the Vocabulary object which must be turned
on when it is instanciated AFAIK. Are you passing the Catalog an
existing Vocabulary when you create it or are you having it create one
for you?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] manage_main select ... / don't work with Mozilla

2001-03-15 Thread Casey Duncan

Cyril Elkaim wrote:
 
Hi,
 
The last builds of Mozilla do not accept anymore this kind of HTML tags:
 select  /
I have discuss with Moz developers and they say it's not in the standard.
 So now we must use something like select  All the other tags must follow
 the same syntax, of course.
 
 The problem with the management interface of Zope is it uses '/' in many
 places. So it's not possible to use Moz for creating new objects for example.
 
 So should it be possible to do something about it :-)
 
 Cyril
 

So then Mozilla doesn't support XHTML?? That is where that whole
trailing slash
convention is coming from.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] (Z)Catalog searches

2001-03-15 Thread Casey Duncan

[EMAIL PROTECTED] wrote:
 
 I tried both
 
my_catalog = Catalog(GlobbingLexicon())
 
 and
 
my_catalog = Catalog(Vocabulary(globbing=1))
 
 and neither resulted in any calls to any GlobbingLexicon methods!
 
  Richard
 

Catalog doesn't take the Vocabulary object itself as an argument. It
takes the (string) id of an acquirable Vocabulary. If you don't specify
a string, it creates a standard non-globbing lexicon (Although a
ZCatalog creates a globbing lexicon, go figure). Something like this
should work (Assuming your product is an acquisition wrapper e.g. by
subclassing Acquisition.Implicit):

my_vocab = Vocabulary(globbing=1)
my_cat = Catalog(vocabulary='my_vocab')

I'm completely unsure why it was implemented this way. I can kinda
understand for ZCatalog, but not really for Catalog. Anyone care to
explain??

or you could do this without using acquistion, but you wind up creating
the vocabulary twice:

my_cat = Catalog()
my_cat.lexicon = Vocabulary(globbing=1)

-- 
| Casey Duncan
| Kaivo, Inc.
| [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 Casey Duncan

"[EMAIL PROTECTED]" wrote:
 
 Hello
 
 I am playing around with the DateTime module in order to adapt it to other formats 
than the American one. However, I would like not to start a work that someone is 
already doing or that is already done. I have found a little patch that solves 
temporarily the problem, but I would like to do something more definitive.
 
 However, I need to be careful due to the large use that is done internally by Zope. 
To whom can I get in touch regarding this issue?
 
 Best regards
 Stefano Vedovelli
 

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.

My $.02
-- 
| Casey Duncan
| Kaivo, Inc.
| [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 ZClass Instances via Python

2001-03-16 Thread Casey Duncan

Edmund Goppelt wrote:
 
 Ok, I know there's a howto with a working solution to this problem,
 but this is *still* killing me:
 
 How does one add a ZClass Instance in a way analagous to adding, say,
 a DTML Document in a Python script?
 
 With the dtml document, it's easy:
 
 container.manage_addProduct['OFSP'].addDTMLDocument('anid', 'atitle','a file')
 
 I've tried the following, which don't work, as well as a variety of
 permutations and combinations involving container  context.
 
 constructor.Bill_add(None, context)
 constructor.Bill_add(container, cons, REQUEST)
 
 # Is this how one sets the REQUEST variable from a script?  Can the
 # REQUEST variable be set from any valid Zope object, e.g,:
 # Anywhere.Anyobject.REQUEST.set('dfkjd', 123) will change the
 # variable dfkjd in the REQUEST object?
 
 container.REQUEST.set('id', '9389483484')
 container.REQUEST.set('title', 'a title')
 constructor=container.manage_addProduct['Bill']
 
 The problem seems to have something to do with the getting the
 contexts right and getting the REQUEST info. passed to the
 constructor, but I'm just guessing at this point.
 
 Bill_add is the standard dtml method constructor created by the ZClass product.
 

self = self.this()
ob = self.Control_Panel.Products.SomeProduct.SomeZClass(id)
ob._setId(id)
...Other inits such as property sheets, etc...
self._setObject(id, ob)

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Comment on CVS change of default textindex search operator

2001-03-20 Thread Casey Duncan

"R. David Murray" wrote:
 
 To: [EMAIL PROTECTED]
 Date: Mon, 19 Mar 2001 19:47:31 -0500 (EST)
 From: [EMAIL PROTECTED] (Chris McDonough)
 Subject: [Zope-Checkins] CVS: Zope2  - UnTextIndex.py:1.33.2.9
 
 Update of /cvs-repository/Zope2/lib/python/SearchIndex
 In directory korak:/home/chrism/sandboxes/2_3Branch/lib/python/SearchIndex
 
 Modified Files:
   Tag: zope-2_3-branch
UnTextIndex.py
 Log Message:
 Changed default query operator to 'AND' instead of 'OR' (way improved search 
results).
 
 This strikes me as a Very Bad Thing.  Not the idea of having AND be the
 default query operator, but the fact of *changing* the default.  If I
 remember correctly the default is documented (insofar as it is documented)
 as being AND, but the default has been OR for so long that I'm sure there
 are many sites that will break if this change is committed to a release.
 Worse, the behavior of a site as seen by end users will change.  Finally,
 it is my experience that most search engines use OR as the default operator.
 I prefer AND myself, but OR appears to be something of a defacto standard.
 
 I'm willing to be convinced, though grin.
 
 A way to set the default would be cool, but might open up a can of worms.
 
 --RDM
 

I'm a little torn between being alarmed at this and agreeing with it. I
think if this is done there should be an TTW interface in ZCatalog to
switch between AND and OR as the default. That would be the best
solution IMHO. Also a _documented_ way to switch it in Catalog as well.

My $0.02

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] 2.3.x Catalog Brains

2001-03-20 Thread Casey Duncan

In doing some development using Catalogs in 2.3.x, I have run across
some interoperability bugs between the various Catalog classes.

1. Catalog brains are slightly broken when applied agains plain
Catalogs. Looking at __getitem__ in Catalog.py (line 225 and 231 in
2.3.1b2 in particular), the result record is made into a brain which is
an aquisition wrapper of the parent of the Catalog object.

When using a ZCatalog this is fine because the ZCatalog is the parent of
the Catalog. However, when a Catalog is used alone the getPath, getURL,
getObject, etc. methods of the brain do not work because they expect to
find a getpath method which only exists in ZCatalog. Since this is
merely a lookup into the Catalog's paths dictionary, I see no reason why
this getpath method can't be in Catalog. 

A patch will be needed for Catalog.py and CatalogBrains.py to accomplish
this, and I would be happy to provide one. However, I need to know why
exactly the brains are wrappers of the Catalog's parent rather than the
Catalog itself. Is this a security issue of some kind?

Another fix for this would be to use slightly different brains for
Catalogs vs. ZCatalogs. From what I see the mechanism for this is
already in place.

2. This one is less of a bug than a feature request. I have created a
CatalogPlus class that basically enhances the Catalog so that is plays
well with CatalogAware. This entails just adding the catalog_object and
uncatalog_object methods from ZCatalog to Catalog. It would seem to me
to be quite easy to modify Catalog or CatalogAware to account for this
automatically. Also why are subtransactions part of ZCatalog and not
Catalog? My guess is that it is a ZODB specific feature so it doesn't
belong in Catalog, is that right?
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Comment on CVS change

2001-03-21 Thread Casey Duncan

Chris McDonough wrote:
 
  I've gotta weigh in here, too;  the breakage induced by this change
  will be large.  Give that what *real* users expect is *neither* a
  Boolean "AND" *nor* a Boolean "OR", but instead a DWIM/Googlesque
  "affinity" search, I don't think the win is clear enough to warrant
  the breakage:
 

I think long term, the Catalog machinery should support such "affinity"
searching.

* "AND" searches return *small* result sets;  non-programmers
  will be surprised by the often-empty lists they get back,
  and won't have any clue how to broaden their search.  False
  negatives suck.
 
 I think most people are getting used to narrowing their search by adding
 terms.  Google, Yahoo, Lycos and the like have trained them to do this.  I
 think the idea that folks, even nonprogrammers, don't know to do this in the
 post-1995 world may be a little flawed.
 

I rarely find myself using any explicit boolean operators when I use
Google. And even when it returns 657,340,269 pages, the ones I wanted
tend to be in the top 30. I think "OR" searching is fine if the result
scoring can be done intelligently somehow.

  Given that any site manager can override the policy trivially, using
  only two lines of DTML, should we really be switching the (admittedly
  arbitrary) existing polciy embedded in the core?
 
 No, I suppose not.  I'll change it back.  :-(  Not happy about it.
 

I still say a toggle in the Catalog management interface is the best
solution.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] call pythonscript from python

2001-03-21 Thread Casey Duncan

Tim McLaughlin wrote:
 
 Anybody know how I can call  a pythonscript from python?  Currently I can
 call it, but I seem to have no context or security context, because it
 either will not let me access anything or fail with an attribute error in
 the context.  What are the params that I NEED to pass in so that it can do
 its bindings (and if you know how to get them automagically, that would be
 incredible)?
 
 Tim
 

The Bindings parent class of PythonScript defines a method 
__render_with_namespace__(namespace) that looks like it grabs the
arguments
and bindings from whatever namespace mapping you provide it and then
executes
the script.

You could also use the _bindAndExec(args, kw, caller_namespace) method
if you want to
also pass arguments from outside the namespace.

Take at looksie at lib/python/Shared/DC/Scripts/Bindings.py for the
source.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Deleting objects by the users

2001-03-21 Thread Casey Duncan

Menno Brandsen wrote:
 
 Hello all, I have a question conserning deleting objects(images) by the user
 
 The situation is this :
 
 I have a page that lists the contents of the folder below, containing images
 of a site.
 In that list a want to let the user/client delete the image that he wants.
 
 I've tried using this syntax :
 
 a href="#" onClick="dtml-call
 "image_folder.manage_delObjects(ids=_['id'])"" DELETE /a
 
 What happens now is that as soon as the page loads it inmediatly deletes the
 images.
 Can anybody tell me a sollution for this problem ?
 I would be very gratefull ! =)
 
 Greetings,
 Menno Brandsen
 
This is a question better served on the main Zope mailing list. That
said, here is the answer:

All DTML is executed on the server before the page goes to the client.
That is why your images get deleted by viewing the page. The onclick
attribute is only useful for executing client side scripts like
JavaScripts, etc. To execute server side code, you must make the user
request the method that deletes the images. This is done by sending the
server a page request. So, you need to create two objects in Zope to
accomplish this. One that displays the images and another that deletes
the requested image and redraws (by a redirect) the image display page.
Here's an example:

dtml method view_images:

dtml-in name="objectValues('Image')"
dtml-var name="sequence-item"
a href="dtml-absolute_url;/delete_image"Delete this image/a
/dtml-in

dtml method delete_image:

dtml-if expr="meta_type == 'Image'"
dtml-call expr="manage_delObjects(getId())"
dtml-call expr="RESPONSE.redirect(URL2 + '/view_images')"
/dtml-if

This code is generic enough so that it would work in any folder. You
could place these methods above the folder(s) containing the images for
greater generality.

It might seem a bit confusing how this works if you don't understand
acquisition. The view_images method creates a link to each image in the
folder you call it for. The link is to the image object itself with the
delete_image method appended. This tells Zope to call delete_image in
the context of the image the user selects.

manage_delObjects is not a method of the image, but the image acquires
it from the Folder that contains it. So delete_image passes the id of
the image (using getId()) to the manage_delObjects method of the folder
containing it. It then redirects back to the view_images method which
will be sans the deleted image.

hth
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Comment on CVS change of default textindex search operator

2001-03-21 Thread Casey Duncan

"R. David Murray" wrote:
 
 On Tue, 20 Mar 2001, Casey Duncan wrote:
   It's so broken with OR for large datasets that the search results are
   virtually meaningless.  We see this first-hand on Zope.org (which is now
   ANDed after an upgrade) and in most of our consulting projects.
  
   I strongly agree that there should be an easy way to switch textindex
   default queries between OR and AND on a per-index basis.
  
 
  I'd even be happy with a per catalog basis.
 
 Likewise.  But this is the can of worms I alluded to.  Another
 approach would be to allow the default operator to be specified at
 query time grin.
 

Agreed. This should be part of the ZCatalog search API in addition to
the default specified.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Deleting objects by the users

2001-03-22 Thread Casey Duncan

Rik Hoekstra wrote:
 
 one small correction:
 
 the line:
  dtml-call expr="manage_delObjects(getId())"
 should read:
  dtml-call expr="manage_delObjects([getId(),])"
 
 as the manage_delObjects takes a list as argument
 
 hth
 
 Rik

Actually manage_delObjects will take a string argument if it is a single
id. However a list with one item is also acceptable. Although you can
declare a list with the trailing comma, it is not strictly necessary.
That is only necessary for tuples because parens have double meaning in
Python. List brackets are unambiguous.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] sql_quote problem?

2001-03-22 Thread Casey Duncan

Chris Withers wrote:
 
 Hi,
 
 When I do the following in a ZSQL Method:
 SELECT * from x WHERE y=dtml-sqlvar sec type=string
 
 it works fine, however, when I do:
 SELECT * from x WHERE y=dtml-var sec sql_quote
 
 I get:
 
 exceptions.AttributeError
 
 Traceback (innermost last):
  File /usr/zope/zope-2_3_1b3/lib/python/ZPublisher/Publish.py, line
 223, in publish_module
  File /usr/zope/zope-2_3_1b3/lib/python/ZPublisher/Publish.py, line
 179, in publish
  File /usr/zope/zope-2_3_1b3/lib/python/Zope/__init__.py, line 240,
 in abort
  File /usr/zope/zope-2_3_1b3/lib/python/ZODB/Transaction.py, line
 179, in abort
  File /usr/zope/zope-2_3_1b3/lib/python/Shared/DC/ZRDB/TM.py, line
 126, in abort
  File /usr/zope/zope-2_3_1b3/lib/python/Shared/DC/ZRDB/TM.py, line
 119, in _abort
 AttributeError: rollback
 
 What gives? ;-)
 
 Chris
 

It looks like the DA is trying to do a rollback, but tanking (perhaps a
bug in the DA). Those two operations are different however. dtml-sqlvar
adds quotes around the value, whereas dtml-var does not even with
sql_quote. So the output SQL of the two respective examples you gave
would be:

SELECT * from x WHERE y='value'

SELECT * from x WHERE y=value

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] sql_quote problem?

2001-03-22 Thread Casey Duncan

Chris Withers wrote:
 
 Casey Duncan wrote:
 
  sql_quote. So the output SQL of the two respective examples you gave
  would be:
 
  SELECT * from x WHERE y='value'
 
  SELECT * from x WHERE y=value
 
 Okay, so dtml-var sec sql_quote is broken? ;-)
 
 cheers,
 
 Chris

No, that behavior is intentional. dtml-var has no way of knowing the
intended type of the value like sql-var does, so it makes no
assumptions. What I think is confusing you is the name 'sql_quote'. This
refers to escaping SQL significant characters (like ' or ;) not putting
quotes around the output. It is analagous to the html_quote and
url_quote options.

Because of this, dtml-var can be used places that sql-var cannot. For
instance you could use it to affect different parts of the SQL other
than just the WHERE clause, such as the ORDER BY clause for example.
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] ANN: Proposal for ZCatalog drop-in indexes

2001-04-02 Thread Casey Duncan

Dieter Maurer wrote:
 
 Chris McDonough writes:
   I'd like comments on this proposal if you've got the time:
  
   http://dev.zope.org/Wikis/DevSite/Proposals/DropInIndexes
 Looks good.
 
 When you are changing the indexing and catalog stuff:
 
   *  make the interface "index" public, such that
  it can be used from outside the ZCatalog
 
   *  standardize the result type of index searches
  such that partial search results can easily be
  combined
 
   *  provide operators "union", "intersection"
  and "difference" on search results.
 

That would be sweet. This whole proposal could take Catalogs to a new
level of functionality. I think the last two points would be especially
helpful. They might be a bit challenging to implement with Lazy
sequences however.

It would be nice to make the result sequence even more virtual and even
more closely tied to the Catalog. If search results were abstracted a
bit further, implementing combine operations and even sub-searching
could be made highly efficient.

Perhaps this is not in the scope of the current proposal, but I think we
should at least aim in that direction.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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 performance

2001-04-05 Thread Casey Duncan

Brett Carter wrote:
 
 What can I do to maximize the peformance of a dtml-in statement?
 When iterating over a 2000 row database query, it takes about 20
 seconds - time mostly spent doing security checks, and calling
 __getitem__ in DT_InSV.py.  Is the performance of dtml-in just slow?
 -Brett
 

Another performance consideration with looping in DTML is that whatever
is in your DTML block is reinterpreted each time through. Although it is
parsed (hopefully) only the first time through, this overhead is still
considerable when multiplied over 2000 rows. You are essentially using
an interpreter (Python) as an interpreter for DTML. I would seriously
consider moving this entire operation (query, iteration and html
generation) to native Python if performance is a big consideration.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] cvs checkin?

2001-04-16 Thread Casey Duncan

Andy McKay wrote:
 
 Im assuming I dont have a right to do cvs checkins... so how do I get this
 tiny stupid little change made, just email Brian ;P?
 

Collector? Works for me 8^)

http://classic.zope.org:8080/Collector

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] How to choose: Or, Not and And when using searchResults().

2001-04-18 Thread Casey Duncan

Chris McDonough wrote:
 
 Erik Enge wrote:
 
  On Wed, 18 Apr 2001, Chris McDonough wrote:
 
   You need to manually do unions or intersections on results from multiple
   calls to searchRequest currently.
 
  Is this a feature to be implemented?  If not, why not?
 
 DC has no no concrete plans to implement operators or precedence in
 catalog queries, although I think it's a really super-worthwhile idea.
 We're currently focusing on the things in the Zope 2.4 plan (see
 http://dev.zope.org/Resources/zope_240_plan.html).  If someone wanted to
 try to implement it, they could create a fishbowl project and I can
 provide assistance.
 
 
  Oh, and by the way, "searchRequest"?
 
 __call__ works too.  ;-)
 
 - C

This is a project I have been keeping in the back of my mind for a while
now. At present I do not have the resources to devote, but it is my hope
that this will change. I feel strongly that that ZCatalog should have a
general query language on par with an SQL where clause. Much of the work
to implement this exists in various places, it really just needs
fleshing out and tying together.

I have also been waiting for the ZCatalog changes that have just taken
place in 2.3.1. Now that this has happened, it may be a good time to
start the discussion in the Fishbowl. I would be willing to draft this
proposal, but it will be a few weeks before I realistically can do it.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] How to choose: Or, Not and And when using searchResults().

2001-04-18 Thread Casey Duncan

Chris McDonough wrote:
 
 BTW, some changes are coming to the way we allow contributions to the Zope
 codebase which have the potential to reduce the DC "drag factor" for this
 and other similar projects.
 
 - C

I await this process change with great curiousity.

As for the ZCatalog proposal, I am approaching from a fairly selfish
perpective. It would just make Zope that much better for me to use! Plus
I think it would be a fun, doable and useful project.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: [Zope] CatalogAware does not work?

2001-04-18 Thread Casey Duncan

John Morton wrote:
 
 
   Why couldn't CatalogAware do this? If nobody has a good reason, I might
   push forth a patch to CatalogAware to implement this.
 
 A simple case for the present flexibility is that you don't need to reindex
 for every property change, just the ones that are actually indexed.
 

Agreed, CatalogAware should ideally check this to make sure reindexing
is necessary.

 A more complicated case would be an operation that changes several instances
 at once. It's expensive to reindex for every instance you change, so it would
 be useful to pass a flag to the ZClass's change method to tell it not to do a
 reindex, and reindex the lot once the operation over all the instances is
 completed.

I have actually done this for a Product I am developing. It allows you
to accumulate
property changes and reindex only once. Supposedly, the Catalog is more
efficient in this regard anyway as of 2.3.

 I guess that you could build this kind of functionality into CatalogAware,
 but I'm generally in favour of having flexible and optional rather than
 automatic reindexing, and just adding documentation to discuss some of the
 different cases.
 
 You could hack Property Sheet Interface to add a call to reindex if the
 ZClass is catalog aware.

I would not want to make PropertyManager directly aware of CatalogAware
if I could get away with it. Perhaps the way to deal with this is to
have PropertyManager call a hookable method afterChangeProperties or
some such, passing a list of properties changed. Then your ZClass could
simply call reindex_object if it feels it is necessary. That would give
full disclosure and behavior control back to your specific
implementation. But it would simultaneously cover property changes made
in the management screens and everywhere else.

I am moving this discussion over to zope-dev to see if anyone else there
has any ideas.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread Casey Duncan

The Doctor What wrote:
 
 * Paul Erickson ([EMAIL PROTECTED]) [010419 17:02]:
  The Doctor What wrote:
* Loosing the variable between the form and dtml-if
 
  I don't understand this.  I'm assuming that you are losing values that
  are not in your argument list.  All you have to do is add the arguments.
 
 That isn't what I mean.  Try this (typed in, so it may need to be
 adjusted):
 paramfoo=0/param
 dtml-if expr="foo != 0"Life is good/dtml-if
 
 You'll NEVER get Life is good to print out.  EVER.  This is because
 ZSQL is setting foo to 0.  But dtml-var and dtml-sqlvar both work.
 

Reason: foo=0 is actually foo='0'. foo:int=0 should work like you want.

 
  Database normalization isn't really an issue.  It sounds like you're
  really just having problems with the syntax of joins.
 
 Nope, can do joins.  Been doing joins (mainly inner).  Not the
 problem.  The problem is that if I have tables like:
 Table1
 --
 id
 name
 desc
 
 Table2
 --
 id
 Table1ID   -- Foreign Key thrown in for fun.
 name
 desc
 
 And I join them, then I MUST rename all the selects using AS:
 select
   Table1.id as id1
   Table1.name as name1
 ...etc
 
 Because I can't have zsql put the variables in the caller's
 namespace as "Table1.id".  It puts them in as "id" (without the AS).
 
 Fortunately, I found the column for sqltest (which is the other end
 of ZSQL):
 dtml-sqltest id1 column="Table1.id" 
 

This is a function of your field naming convention more than anything.
Granted you don't always have control over that. I am surprised that
name="spam.eggs" doesn't work on sqltests (it works everywhere else).
Are you explicitly saying name="..."? that could be the problem, bare
quoting assumes expr="..." where periods are significant.
 
 Can I use them from a python script?  If not, what's the point?  I
 mean: External methods are nice to have when you have *no other
 choice*, but they aren't something I'd want to debug and deal with
 for object.

Python scripts are quite helpful for calling ZSQL methods. Just remember
to pass REQUEST or the arguments explicitly.

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] CopySupport bug

2001-05-03 Thread Casey Duncan

There is a subtle bug in the CopySupport module that makes it impossible
to copy and paste a folder that contains a ZCatalog with CatalogAware
objects in indexed in the catalog also in that folder. The reason is as
follows, CopySupport calls a hookable method manage_afterClone (which is
hooked by CatalogAware). It does so after a copy is made of the object
but BEFORE the copy is mounted in the ZODB. 

manage_afterClone in CatalogAware tries to reindex the object, and in
doing so tries to derive its URL for use as the ZCatalog uid by calling
absolute_url on the object. This fails of course because the object as
yet has no URL because it is not mounted. The error reported is a
KeyError on SERVER_URL.

To make a long story somewhat shorter, I have a simple patch for this,
but there is still one more subtle bit of behavior to take note of:

When the ZCatalog is copied, all of its indexed data gets copied. Then
the new copies of the objects index themselves. This means that the
copied catalog has twice as many objects in it as the original. This
bugged me at first, but it makes sense and I don't see any obvious
solution that would be consistent.

For those interested, the patch is here:

http://classic.zope.org:8080/Collector/2205/view

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Object dereferancing Question

2001-05-10 Thread Casey Duncan

R. David Murray wrote:
 
 On Tue, 8 May 2001, Jeff wrote:
  I have created a product with a zclass that contains a zclass; classA contains 
classB.
 [...]
  Now for the part I don't understand.
  I have a page where I would like dynamically display a classB object. I used the 
following:
 
  dtml-var expr=_.getitem(index_object, 1)
 
  Where 'index_object' is the id of a classB object within the name space (same 
folder).
  I thought that this would call the 'default rendering' for the named object, but 
instead returns the object.
 
 '1' means call the object if it is callable.  ZClasses are not callable.
 Therefore you get the object back.
 
 See the Renderable Product if you want to fix this grin.
 
 --RDM
 

This strikes me as a bug. How would you all react to making ZClass
instances callable and have their behavior be: look for an instance
method index_html and call it, and failing that, just return the object.

Thoughts?

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] PropertyManagerEvents proposal: Last call for review

2001-05-10 Thread Casey Duncan

I have a proposal up for discussion on adding hookable callbacks to
property events. If you are interested in such topics as property
validation, CatalogAware syncing on property changes, etc, please take a
look within the next few days. I think this is something that many
people could use, so your comments are valued.

http://dev.zope.org/Wikis/DevSite/Proposals/PropertyManagerEvents

Next week I would like to deliver the patch to implement this, so if you
have something to say on this topic speak now!

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: oodb philosophics ;) was: Re: [Zope-dev] Experiments with ORMapping

2001-05-10 Thread Casey Duncan

Tino Wildenhain wrote:
 
 Hi shane,
 
 I think the motivation people want an RDBMS storage beneth zodb is
 because they understand RDBMSes these days are performant, relieable
 and can quiete easy maintained.
 
 I've seen Java implementations using this approach to achive persistens
 using as example Powertier[tm] to explicit map oop data to an RDBMS.
 I didnt like it because you have to map your objects each time you create
 a class, keep in mind not to infere with others etc...
 
 Would it not be better to improve the abilities of the Filestorage
 to handle updates better? May be most of the storage system in C?
 With logfiles like modern RDBMSes use to incorporate fast changes?
 However, to avoid pickling/unpickling and may be to update on
 attribute-change, we need the approach you mentioned.
 
 What about using a real oodb for zope? Dont remember any particular
 product name, but I heard something.
 
 Regards
 Tino Wildenhain
 

It would certainly be an interseting exercise to put Matisse or
Objectivity behind Zope as ZODB storage, however I think there will
always be kludgeyness because features of Zope wont directly map (like
versions).

I think the Berkeley storage option will eventually prove to be the
ticket. Probably sooner than later.

How about XML storage! 8^) You think startup times are slow now...

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: oodb philosophics ;) was: Re: [Zope-dev] Experiments with ORMapping

2001-05-11 Thread Casey Duncan

Cees de Groot wrote:
 
 Shane Hathaway [EMAIL PROTECTED] said:
 That's one reason ZODB is so nice.  You can write an application without
 writing a formal schema.
 
 One of the reasons I am seriously considering to migrate our production
 database from PostgreSQL to ZODB. I am about to implement our product
 database, and it is just too darn complex to bother maintaining SQL tables for
 it...
 
 Actually OracleStorage and bsddbstorage, recently released, are designed
 to address concerns about performance and reliability, and they do an
 excellent job at it.  And I consider ZODB as real an OODB as anything
 else.  (In some ways it's the best out there IMHO.)
 
 I heard that OracleStorage was quite a bit slower? And from what I've seen
 from FileStorage, it's a basic transaction log - what can be more reliable
 than that?
 
 Are people using ZODB for non-Zope data? I'd be very interested to discuss
 things like emulating extents, patterns for indexing, etcetera...
 

One of the biggest limitations in my mind is the lack of a general query
language for the ZODB like what you get with most OODBMS and all RDBMS.
ZCatalog is improving, but it is just not quite there yet.

I do feel that the ZODB is quite robust, and with the added option of
berkeley storage along with others, you have several back-end choices.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: oodb philosophics ;) was: Re: [Zope-dev] Experiments withORMapping

2001-05-11 Thread Casey Duncan

David Brown wrote:
 
 At 11:45 AM 5/11/2001 -0600, Casey Duncan wrote:
 
 One of the biggest limitations in my mind is the lack of a general query
 language for the ZODB like what you get with most OODBMS and all RDBMS.
 
 I used to think this as well.
 
 But isn't Python a decent query language?  Isn't it nice to be able to have
 all of the facilities of Python at your disposal when manipulating data,
 rather than hoping that whatever database you are using doesn't have a
 brain-damaged implementation of SQL?

No and yes. Python is a great oop language, it has no inherent querying
capabilites though outside of namespace lookups (with acquisition when
in Zope) and dictionaries. You would need to build in all possible
queries as Python methods none of which would be very general. This is
something you need not do with a general query language where you can
make arbitrary queries at will.

 Isn't it nice not to have to convert back and forth between SQL types and
 native types?  Isn't it nice not to have to swap in your SQL mind in the
 middle of your Python program?

I am not arguing necessarily for SQL as a query language for the ZODB.
Although it is an accepted standard, but not a perfect one by any means
especially for OODBs. Its appeal lies mainly in the high level of
community familiarity and the plethora of SQL software to borrow from.
 
 Having a general query language makes it easy for people who know that
 particular general query language to write programs.  It makes it easy to
 access a bunch of different data sources, at least until the monster named
 implementation differences rears it's ugly head.
 
 We've all spent years learning to make our programs interface with
 databases, learning how to jump the mental chasm between our programs and
 they way they want to manipulate data, and the way that the database wants
 to manipulate data.  Isn't it nice not to have to do that any more?

Yes, I would argue for a tight integration between the query mechanism
and regular Python, something that Catalogs have begun to implement.
However their query language is a very limiting argument list. Perhaps a
more general Python based query language of some kind needs to be
developed. Something like an expression that returns the set of objects
that meet its criteria. Exactly what this would be would need much
community (Python and Zope) discussion. A start to this discussion can
be found here:

http://dev.zope.org/Wikis/DevSite/Proposals/UnionAndIntersectionOperations

 
 Don't get me wrong, I believe I get your point.  SQL implementations are
 getting more and more compatible.  There are OODBMS query languages
 specified.  There's no really good way of making different programming
 languages and programming environments interoperate without some sort of
 common meeting ground, like a general query language.

A be all query language for all databases (Which would be SQL at this
point, which is not necessarily tailored to OODBs) will always have
compromises and flaws. I look at something like CORBA which is can be
used to tie programs of all different languages together. Unfortunately
the result of reconsiling COBOL, C, Python, Java, Perl, BASIC, etc. to
some common ground is not always very pretty.

I would really be happy just to get Python (and possibly C) to be able
to perform general ZODB queries without resorting to kludges like
spam_usage='range:min:max'. So what I am talking about is not really
general, but mostly Python/ZODB specific.

 
 And perhaps I'm overdoing the response, perhaps I've gone off in a
 different direction.  I've just been thinking about this quite a bit lately.
 
 dave

I think this is a very important topic of discussion. Thanks for adding
your thoughts!

-- 
| Casey Duncan
| Kaivo, Inc.
| [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: oodb philosophics ;) was: Re: [Zope-dev] Experiments with

2001-05-11 Thread Casey Duncan

Cees de Groot wrote:
 
 David Brown [EMAIL PROTECTED] said:
 But isn't Python a decent query language?  Isn't it nice to be able to have
 all of the facilities of Python at your disposal when manipulating data,
 rather than hoping that whatever database you are using doesn't have a
 brain-damaged implementation of SQL?
 
 Yup. Our business objects are sitting on top of my homebrew O/R mapping layer,
 and I find myself entering the Python shell to do ad-hoc stuff with them more
 and more often. Especially because stuff that repeats one or two times is
 easily added as a method on the object for later reference...
 
 One nice idea that should be possible in Pythonland as well: a Smalltalk O/R
 mapping layer called GLORP uses Smalltalk as a query language in a very nice
 way. Queries are given as Smalltalk blocks (say lambdas), and the mapping
 layer interprets the block's parse tree in order to spit out equivalent SQL
 code. Say:
 
 Employees.get(lambda e: e.name[:3] == 'Foo')
 
 to get all employees that have a name starting with Foo.
 

The only problem with this is that lambdas are not safe for TTW
scripting 8^(.

Although a safe lambda could probably be conceived of course...

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Fwd: [Zope] ZCatalog + Directory product question

2001-05-17 Thread Casey Duncan

Júlio Dinis Silva wrote:
 
 Any hints?
 Best Regards,
 Julio Dinis Silva
 
 From: Júlio Dinis Silva [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [Zope] ZCatalog + Directory product question
 Date: Tue, 15 May 2001 18:29:37 +0100
 
 Hi,
 
 supose you have a product with two classes:
 
 MyCategory
|
-- MyLink
 
 Both classes are CatalogAware.
 The ideia of this classes is to implement
 a Directory like yahoo (think about the Yiahw product).
 
[snip]
 
 Well the problem arises when you have 30 results in your search and
 all are Mylinks in a directory depth path of 10 category... The search
 becomes to heavy,i.e, scalability is compromised.

You should create an instance method (It will need to be a Python
script, DTML methods cannot be indexed)to return the result of the value
of active in the acquisition stack. Then index against this method. This
puts the burden on updates, so whenever a MyCategory is changed from
active to inactive, all child objects will need to be reindexed. This
can be done by creating another Python script that gets called on
updates to MyCategory objects.

The indexed instance method could be something as simple as:

return getattr(container, 'active', 0)

Only set the active property on those objects that are actually active.
Don't set the property at all on inactive objects. That way acquisition
does the work instead of doing it manually (an probably much slower). To
see if an object is active, just call the instance method.

 
 I'm thinking I could use the zope security engine to do the active/deactive
 trick, i.e, when I deactivate one MyCategory I uncheck some security entry,
 then listing my directory I do a dtml-in with skip-unauthorized, and when I
 do a search I try to getObject MyLink's
 results as a anonymous role and then skip_unauthorized.
 
 I think this skip_unauthorized could be the solution for this
 ZCatalog+Directory product scalability, because instead of running
 trough the PARENTS and check a property, I will be using zope's
 internal security mecanism.

That is a interesting idea, but I don't think it would really make it
much faster. Although I could be wrong. Basically you would make it so
that users performing the query didn't have view permissions on the
inactive Categories. It would be more challenging to test as well. It
would however make updates less intensive.

 
 Any hints,
 Júlio Dinis Silva

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Wildcards in TextIndex query. Do they work?

2001-05-24 Thread Casey Duncan

Erik Enge wrote:
 
 Hi,
 
 is it me, or is this just not working:
 
 (word1 or word*) and (wor?3)
 
 ie. wildcards in TextIndex queries.  I can't seem to make it work, and I'm
 not able to track down where it stops working.  Should it work in the
 first place?
 
 Zope 2.3.2
 
 Thanks.
 

Works great for me. Perhaps you are using a Vocabulary that has Globbing
turned off?

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Wildcards in TextIndex query. Do they work?

2001-05-24 Thread Casey Duncan

Erik Enge wrote:
 
 On Thu, 24 May 2001, Casey Duncan wrote:
 
  Works great for me. Perhaps you are using a Vocabulary that has
  Globbing turned off?
 
 I'm not sure, how do I check?
 
 This query works:
 
 wil?car*
 
 This doesn't:
 
 (wil?car* or something else) and (word1 and word2)

I'm not sure how well grouping with parens is supported right now. I
know phrase matching isn't supported very well.

 
 I can't see that the query-parsers in UnTextIndex.py transforms them
 differently, but I might be missing something obvious.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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 batching improved

2001-05-31 Thread Casey Duncan

Ivo van der Wijk wrote:
 
 On Wed, May 30, 2001 at 10:02:31PM +0100, Chris Withers wrote:
   When using batching in dtml-in, why is 'previous-sequence' only defined at
   the first iteration of the current batch? And why is 'next-sequence' only
   defined at the last iteration of the current batch?
 
  I know this problem ;-)
 
  I had it too, and stuck something in the collector about it. I did manage to
  get the layout you're after without modifying Zope though (see the search
  page on www.nipltd.com)
 
 
 I've done it myself as well using (as described in the posting) two
 dtml-in's (the second one purely for displaying the prev/next links).
 
 Is your solution any different? (The only one I can think of is storing
 the info in your REQUEST object and using it later, but that's really
 ugly.)
 

AFAIK that is what the next and previous options for dtml-in are for.
Usually
I just store the sequence (if it is a query) in a variable using a let
around
three (or more) dtml-ins. Two of which use the next or previous option
to create
the batching links.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Name space in a Script (python)

2001-06-06 Thread Casey Duncan

--- Jeff [EMAIL PROTECTED] wrote:
 Hi all,
 I'm trying to get variables from the name space in a
 python script without much luck... 
 I think I am missing something very simple, but
 after hours of searching I'm at wits end.
 
 This is what I am trying:
 A DTML document has several properties defined on
 it.
 It calls a python script that needs to access these
 properties.
 
 No matter what I try, I can not get the properties
 from the calling DTML document in the python
 script...
 What am I missing?
 
 Thanks,
 Jeff
 

This will depend on how the Python script is called,
my recommendation would be to call the script in the
context of the DTML document like in the URL:

http://myserver/DTMLDoc/pyScript

Then the DTML Document would be accessed through
context as in:

context.title

Otherwise, you would have to access it by traversing
the attributes of it's parent folders as in:

doc = context.folder.subfolder.DTMLDoc
doc.title

hth,


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.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 )



Re: [Zope-dev] How to return downloadable content from Python Method

2001-06-12 Thread Casey Duncan

 Blandford, Simon [BSS Audio UK] wrote:
 
 I am compressing files which need to be uncompressed inline before
 download. The DTML href=... calles a python method in the product
 which returns the uncompressed file data. Say this file is an MSWord
 document, how do I return this as a file to download? Presently, the
 browser just tries to display the binary file and makes a mess of it.
 
 Regards,
 Simon B.

It probably is not setting the content-type header. Add something like
this to the method that returns the data:

RESPONSE.setHeader('Content-Type', self.content_type)

Where content_type is set to the MIME type of the data, which for MSWord
is 'application/msword'
-- 
| Casey Duncan
| Kaivo, Inc.
| [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 batching badly

2001-06-18 Thread Casey Duncan

Joachim Werner wrote:
 
  That's not the behaviour I'd expect.  Can anyone confirm this is a
  bug?
 
 As LEE Kwan Soo has already said, it is not a bug, but a clever (too
 clever?) feature that should maybe not be enabled by default. Every second
 week or so somebody runs into this and thinks it is a bug.
 
 To the DC people: Do you think it would break any code badly if the default
 behaviour was orphans=0?

Here is a (again perhaps too clever?) suggestion. Make the orphan value
equal zero by default
if size = 3. Otherwise keep it at three.

I'm not oppossed to making it zero all the time either.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Fishbowl not problem centered enough

2001-06-20 Thread Casey Duncan

Jay, Dylan wrote:
 
 Fishbowl is a great idea but it seems to be that its solution focused rather
 than problem focus. Perhaps if you had a page that listed all the problems
 with zope or problems that need to be solved that isn't as easy as it could
 be with zope. 

The fishbowl is also pull technology, and so it is time-consuming to
keep up with the developments. I personally find it to be cumbersome,
limiting and not really conducive to actually getting stuff done.

The collector currently fulfills the role of a bug list, and to some
degree a feature request bin. However, I (and others) find using it for
the latter is often a waste of time.

 Problems could then be organized according to priority due to
 severity or strategy, or even voting via the comunity (ala Java bug parade
 developer.java.sun.com/developer/bugParade/)
 Then under each problem could be listed the proposals that form solutions to
 the problem. Of course some solutions may solve many problems and therefore
 appear more than once.

I agree that a community-centered bug/feature request collector would be
beneficial. One that does not rely exclusively on DC's resources. DC
just does not have the bandwidth to deal with everyone's needs. 

I know there has been talk of opening up the Zope CVS to outside
contributions, I personally think this is long overdue. In order for a
community development forum to really work, this would have to happen.

 
 I just see lots of solutions many of which attack some of the same problems
 and no clear way to get those people comunicating and making informed
 trade-offs
 

This is one of the challenges of open-source development. I think we as
a community need to leverage our own technology more to facilitate its
further development. And I think that means relying on DC less and
therefore decentralizing things more.

I know that the folks at DC are thinking seriously about these issues. I
would say that unless something is actually done soon about opening the
Zope core to outside contributors, they run the serious risk of someone
just forking the code to do it for them. I also think that Zope.org
itself could greatly benefit from direct outside contribution.

 
 Dylan Jay   mailto:[EMAIL PROTECTED]
 Avaya Communication Tel:   +61 2 9886-8961
 Level 3, 123 Epping RoadFAX:   +61 2 9352 9224
 Nth Ryde NSW 2113   Mobile: 0409 606 171
 AUSTRALIA

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Fishbowl not problem centered enough

2001-06-20 Thread Casey Duncan

Ken Manheimer wrote:
 
 On Wed, 20 Jun 2001 09:24:40 -0600, Casey Duncan [EMAIL PROTECTED]
 wrote:
 
  Jay, Dylan wrote:
  
   Fishbowl is a great idea but it seems to be that its solution focused rather
   than problem focus. Perhaps if you had a page that listed all the problems
   with zope or problems that need to be solved that isn't as easy as it could
   be with zope.
 
 I think it would be helpful to have a big picture, with goals and
 objectives, into which to fit the pieces - would that address the kinds of
 things you're talking about?
 
  The fishbowl is also pull technology, and so it is time-consuming to
  keep up with the developments. I personally find it to be cumbersome,
  limiting and not really conducive to actually getting stuff done.
 
 I've really wanted to enable people to subscribe to notification about
 changes to wiki pages, and to notifications about additions to the wiki.
 Unfortunately, i didn't have time to get to that in the WikiForNow
 project.  As soon as i'm clear form a current project i *may* be able to
 concentrate on at least formulating a reasonable quick-and-dirty way to do
 notifications, and getting it done for the short term.  Whether or not
 it's me doing it, i think we're going to be bringing more attention to
 these issues.

Opening the development process itself could enhance the resources
available to you and solve this problem. However, I have more issues
with wikis than just the notification aspect. I think they limit
accessibility of data because they are really just big globs of text. I
personally feel the whole fishbowl concept has some flaws both in
technical and administrative implementation. 

I for one don't exactly know how to proceed beyond a certain point in
the fishbowl. Some of my proposals for example end with some thing like
this from DC: I think we need to address this a different way, however
I don't have time to say exactly how right now. OK, so now what?

 
  I know there has been talk of opening up the Zope CVS to outside
  contributions, I personally think this is long overdue. In order for a
  community development forum to really work, this would have to happen.
 
 This actually is high in our priorities, but the key players have been
 swamped.  From a discussion w/paul recently i think we'll be getting
 some more attention to doing this, very soon.

I understand, but this is the way to get some more resources on your
side in the long run. I for one will shed an entire frustration level
with Zope when this happens.

 
 I think the fishbowl, as it is, is a good significant move towards
 exposing the process and enabling involvement.  Mailling lists help
 conduct the collaboration.  However, more is needed to facilitate that
 process - selectively enabling checkins, doing notifications to make
 tracking of developments manageable, fleshing out the context
 (problems/big picture).  It's an incremental process, and we may have
 lapsed too long in progressing on those increments - perhaps we need
 to chart out some of these critical pieces, so we can better formulate
 how they're being attacked - and maybe enable more help with the
 increments.

I agree that the fishbowl is beneficial, if for nothing else than a
sounding board for the possible directions of Zope. But, like I
mentioned before, I think the community needs more involvement directly
with the development of its own tools like the fishbowl. I realize there
is a risk to DC of loosing some level of direct control, but I suggest
that a democratic development approach although less decisive and
centralized is superior to a despotism.
 
 I hope to have expore this some, internally, and have more to say
 about it next week.
 

I'll await further developments.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] ZPL and GPL licensing issues

2001-06-21 Thread Casey Duncan

Federico Di Gregorio wrote:
 
 On 21 Jun 2001 11:39:37 -0400, Jim Penny wrote:
  On Thu, Jun 21, 2001 at 05:18:40PM +0200, Federico Di Gregorio wrote:
   On 21 Jun 2001 11:08:30 -0400, Jim Penny wrote:
   [snip]
OK, consider this from another point of view.  If I have an operating
system may I install a piece of GPL software on the operating system?
May I redistribute the operating system?  With the GPL software?
May I invoke/run the GPL software?
   
My understanding is that the answer to every one of these is yes.
  
   yes. only if it is free. only if it is free. yes, but only because gpl
   allows for gpl code linking with the major components of the os even if
   they are proprietary.
 
  Uh, you might want to reconsider the only if it is free parts.  After
  all Interix had a business of selling GPL software for a non-free
  OS.  Now Microsoft has that business (NT Services for Unix Pack).
  IBM distributes gcc and perl.  Cygwin sells GPL software for non-free
  OS's.
 
 ops. ok, poorly worded. third parties can distribute only if the os is
 free, vendor can do as he please, obviously...
 
 [snip]
   err, no. if you write an external module using only python code, as long
   as you use a gpl-compatible python to run zope, you can call your
   external code from zope. if you write a product suclassing dc code,
   you're effectively 'linking' and gpl limitations apply.
 
  GPL limitations apply to whom:  To you, the developer?  To a
  downstream user invoking the product via dtml-call or dtml-var or their
  pythonish equivalents?  To a downstream developer who modifies your
  product and redistibutes the modified product?  To a downstream
  developer who writes a component that invokes the GPL component?
 
  In my mind the only sensible answers are developer - no,
  user - no (but see Jerome Alet's codacil), downstream modifier - yes,
  downstream developer who uses - no.
 
  The only other sensible option is that, indeed, no one may distribute
  GPL components for Zope, including the original developer.
 
 as i said before, writing gpl code subclassing zope is a non-sense. even
 the author cannot, imho, redistribute its work with a plain gpl attached
 to it. the gpl says that if you link with gpl code *all* the code should
 be gpl or gpl-compatible (major os components like clibs, compilers, etc
 are an exception). so even the author cannot do that without licensing
 under gpl plus some exception (as a special exception you're allowed to
 link this code with zope or any other zope product distributed under the
 zpl.) see the (in)famous gpl vs. qt thread in the debian mailing lists
 for an in-depth analisys of this problem.
 

To me this is the key point. If you GPL license a product (or other
software) for Zope, you cannot subclass ZPL coded classes in your
product without violating the GPL. This makes a strict GPL license
nearly useless for Zope development and incompatible (license-wise) with
Zope itself. What bugs me is when people point to the ZPL being the
problem, it is the GPL that is the limiting factor IMEHO. 
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] ZPL and GPL licensing issues

2001-06-21 Thread Casey Duncan

Gregor Hoffleit wrote:
 
 On Thu, Jun 21, 2001 at 10:02:34AM -0600, Casey Duncan wrote:
  To me this is the key point. If you GPL license a product (or other
  software) for Zope, you cannot subclass ZPL coded classes in your
  product without violating the GPL. This makes a strict GPL license
  nearly useless for Zope development and incompatible (license-wise) with
  Zope itself. What bugs me is when people point to the ZPL being the
  problem, it is the GPL that is the limiting factor IMEHO.
 
 But that's a little bit like standing in front of a mountain and saying Go
 away, isn't it ?
 
 From the viewpoint of the GPL, the ZPL is the limiting factor, since it
 employs restrictions (does it really ???) regarding the distribution of
 binaries, and since it has a advertisement clause that restricts your right
 to distribute Zope.
 
 On the other side, from the viewpoint of the ZPL, these requirements of the
 GPL are the limiting factor.
 
 But I'm afraid the discussion on who's guilty won't solve the problem, which
 indeed is perceived by all of us (is it ?).
 
 Gregor
 

You are correct my friend. And both sides (DC and FSF) are unwilling to
change their licenses for compatibility with the other. So, the
incompatibility stands and there is little we can do about it; except
understand that it exists and make informed choices that are acceptable
to ourselves as developers. That may mean if you are a staunch GPL
advocate, adding a Zope clause to you license.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Hey Chris, question for you

2001-06-26 Thread Casey Duncan

Chris:

I am working on getting a decent query language for ZCatalog/Catalog and
I have been able to make good progress, however I am running into a bit
of an issue that I thought you might know something about:

In order to implement a != query operator, I am trying to do the
following:

From the index, return the result set that match the value (easy)
Subtract that from the set of all items in the index (not so easy)

I see that there is the difference method available from IIBTree,
however I seem to be unable to use it on the entire index (Which is an
OOBTree and not really a set I guess). Here is a snippit of my code
which doesn't work:

if op == '!=' or op[:3] == 'not':
w, rs = difference(index._index, rs) # XXX Not a warm fuzzy...

(where rs is the index result set that matches the value and index is
the Catalog index OOBTree)

What can I supply for the first argument to get a set of all items in
the index, or is there any easier and better approach to this whole
issue?

BTW: I realize I could step though _index.items() and create an IISet
but that seems awful inefficient...

Thanks in advance for any ideas you might have...

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Hey Chris, question for you

2001-06-26 Thread Casey Duncan

Chris McDonough wrote:
 
  Chris:
 
  I am working on getting a decent query language for ZCatalog/Catalog and
 
 Very cool...
 
  I have been able to make good progress, however I am running into a bit
  of an issue that I thought you might know something about:
 
  In order to implement a != query operator, I am trying to do the
  following:
 
 Tricky.
 

Ok, I was able to get it to work by instantiating a IISet around
_unindex.keys() and passing that to difference (Thanks!), however, I
notice an interesting side effect. Let's say you have a TextIndex on
title and you do the following query:

title != 'foo*'

Which to me means: all cataloged objects whose title do not match the
substring 'foo*'

However, this is not what you get exactly, instead you get:

all cataloged objects that have a non-empty title that does not match
the substring 'foo*'

Because from what I am seeing, objects with empty (or no) titles are not
included in the index *at all*. So the set of all objects does not
include ones without titles. I could fix this by making all objects be
instead All objects in the catalog (via catalog.data.keys()) instead
of all objects in the index, but I wanted to see if anyone had
additional thoughts about this.

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Hey Chris, question for you

2001-06-27 Thread Casey Duncan

Chris McDonough wrote:
 
 Hi casey,
 
 Changes were recently made to Field/Keyword Indexes so that they will
 store empty items.  An equivalent change could be made to TextIndexes...
 we'd need to think about that a bit.
 
 But for your purposes, you might want to start out attempting to write
 your operator implementation using Field and Keyword indexes...
 
 - C
 
 Michel Pelletier wrote:
 
 
  Hmm the reason for the current behavior was optimization by saving space
  not indexing empty values.  The problem with your latter aproach is that
  all objects in the catalog may include object that don't have a title
  attribute at all.
 
  I'm not against indexing empty values though.
 
  -Michel
 

My implementation does not modify the behavior of the indexes in any
way, and I would like to keep it that way if possible. I have been able
to (thus far) pull this off without compromises, which was my hope in
the beginning.

I guess the question here is given the query:

spam != 'eggs'

Should objects be returned that do not have an attribute spam at all.
For the behavior to be intuitive, I would say yes, but that is just my
opinion. I also though of an optimization that could eventually be
included if this behavior is adopted. for example, take the following
query expression:

title == 'foo' and spam != 'eggs'

As implemented, my query engine does the following:

1. Find items where title  matches 'foo' (exact behavior depends on
index type)
2. Find items where spam matches 'eggs'
3. Take the difference of all items in the index spam and the result of
#2
4. Return the intersection of #3 and #1

To be intuitive (I use that term loosely) I think it should be:

1. Find items where title  matches 'foo'
2. Find items where spam matches 'eggs'
3. Take the difference of all items in the catalog and the result of #2
4. Return the intersection of #3 and #1

Which can be optimized as:

1. Find items where title  matches 'foo'
2. Find items where spam matches 'eggs'
3. Return the difference #1 and #2

If an or is used in place of the and, then the optimization doesn't
apply though.

One other thing:

I noticed (with a colleague) that passing a list of values to a
FieldIndex and a TextIndex results in nearly opposite behavior. The
fieldIndex does a union on the results of querying against each item in
the list whereas TextIndex does an intersection. This seemed highly
inconsistent to me, another thread perhaps...

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Re: [Zope-dev] Re: Zcatalog bloat problem (berkeleydb is a solution?)

2001-06-26 Thread Casey Duncan

Chris McDonough wrote:
 
 abel deuring wrote:
  A text index (class SearchIndex.UnTextIndex) is definetely is a cause of
  bloating, if you use CatalogAware objects. An UnTextIndex maintains for
 
 Right.. if you don't use CatalogAware, however, and don't unindex before
 reindexing an object, you should see a huge bloat savings, because the
 only things which are supposed to be updated then are indexes and
 metadata which have data that has changed.
 
[snip]

What if any disadvantages are there to not calling unindex_object first?
If there aren't any good ones, I think I'll be rewriting some of my own
CatalogAware code...
-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Traversal Barf

2001-07-10 Thread Casey Duncan

seb bacon wrote:
 
 I've been getting a puzzling error.  It's not reliably reproduceable.
 It occurs perhaps one time in four when I'm using Opera.  At first, it
 appeared only to be related to Opera, but now I'm getting the same
 error in netscape.  I can just hit refresh and it works again.
 There's no sign of anything like ConflictErrors or the like on the
 console.
 
 Has anyone seen this before?  What could it be?
 
  snip 
 
  File /usr/local/Zope/lib/python/DocumentTemplate/DT_Let.py, line 146, in render
 (Object: rootpath=absolute_url())
   File /usr/local/Zope/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval
 (Object: absolute_url())
 (Info: absolute_url)
   File string, line 0, in ?
   File /usr/local/Zope/lib/python/OFS/Traversable.py, line 119, in absolute_url
 (Object: Traversable)
 KeyError: SERVER_URL
 
 Cheers,
 
 seb
 

I have seen a similar traceback which was due to a bug in CopyPaste.py,
to which I have submitted a patch. It had to do with a lack of an
acquisition wrapper at an inopportune time. It looks as though
absolute_url() is being called without a proper wrapper around the
object it is begin called for.

What object is it begin called for?

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Traversal Barf

2001-07-11 Thread Casey Duncan

seb bacon wrote:
 
 * Steve Alexander [EMAIL PROTECTED] [010711 07:59]:
  KeyError: SERVER_URL
 
   I have seen a similar traceback which was due to a bug in CopyPaste.py,
   to which I have submitted a patch. It had to do with a lack of an
   acquisition wrapper at an inopportune time. It looks as though
   absolute_url() is being called without a proper wrapper around the
   object it is begin called for.
 
  Looks to me like absolute_url() is being called when absolute_url(1)
  should be used.
 
 I didn't know about the absolute_url(relative=1) switch.  Do virtually
 hosted envirnoments not have a SERVER_URL variable?
 

This actually points to a lack of an acquireable REQUEST object. If you
look at the code in absolute_url, it tries to acquire REQUEST and if it
can't, it sets it to {}. Then when it does a REQUEST['SERVER_URL'] later
on it gets a KeyError. I personally think this code is very brittle, but
it does work 99.99% of the time.

 However, I don't think this is the problem.
 
 (1) I'm not in a virtual hosting scenario
 (2) it happens at fairly random intervals *on the same page*.

This is very weird. I would expect it to act consistently. I hate that!

 
 I can be working on a page, then reload it, and I get the KeyError.
 Then I can reload it again and the error goes.  Then I go back to it,
 reload it again, and the error appears.  Reload it again and the error
 remains.  Reload it again and it disappears again...  You get the
 idea.

Is it truely random or an every-other reload sort of regularity? I have
a feeling you'll pick the former.

 
 This makes it very difficult to debug.  I left my computer on
 overnight, without changing any app settings, and haven't seen the
 error yet today.
 
 My feeling is that Casey's right.  It's happening on a CMF object
 to which I've added BeforeTraverse hooks, which could possibly have
 something to do with it.  

Can you experiment with removing/changing these hooks?
Can you post the code for your object?

 However, I've actually seen this problem
 before, about a year ago, with a completely unrelated ZClass-based
 objects.  I remember then noticing that the error occured more often
 with Netscape and Opera than IE.  Of course, that theory is utter
 nonsense seeing as HTTP is a connectionless protocol and the headers
 each browser sends are effectively the same.  However, in the absence
 of a reproduceable error, I have to clutch at straws ;-)
 
 seb

The browser differences may point to caching differences that make it
seem as though it is working.

Any DCians have any insights?

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Traversal Barf

2001-07-11 Thread Casey Duncan

seb bacon wrote:
 
 OK, I've found out some more stuff about the problem.  Of course, it
 wasn't really random.  The culprit is a linked stylesheet.  Every time
 I alter the sheet in some way, I get the SERVER_URL KeyError.

Good, at least we know *when* it happens.
 
 I can't really see why this should be happening, though.  The
 absolute_url() in question is in the main body of the document, not
 the stylesheet.

Can we see the code for your page? What is the stylesheet, a DTML obj,
ZStyleSheet, etc?
 
 Is perhaps the acquisition wrapper not getting applied to the document
 until after the linked objects are also downloaded, or something
 strange like that?

No, that is client-side stuff.

 
 I haven't the time time to pursue this right now, but I'll attempt to
 make a simple, reproduceable example and submit it to the Tracker.
 But just in case I get time to debug it, where might I start?  I'm not
 very familiar with the Traversal / Publishing stuff.

I'm happy to help if I can.
 
 seb
 

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] masquerading python products as functions

2001-07-11 Thread Casey Duncan

Mick wrote:
 
 Hi,
 
 I am trying to make a product act like an external method, or dtmlmethod.
 Basically I have taken the minimal product and added a __call__ function.
 It works fine, and can be called as a function of the object that contains
 it.  The problem is that the minimal objects namespace is also pushed onto
 the stack, and to get out of it I need to go through self.aq_parent.
 Reading though all the help I could find I tried adding the following (as
 DTMLMethod suggests.)

Yes, the current object is at the top of the namespace in general.

DTML Methods get around this with the client argument which defaults to
None. AFAIK This represents the containment namespace to use for
execution.

 
 #Documents masquerade as functions
 class func_code: pass
 func_code=func_code()
 func_code.co_varnames='self','RQUEST','RESPONSE'
 func_code.co_argcount=3

From what I read, this tells ZPublisher what arguments to pass by
default to the object when it is called by traversal. Since client is
omitted from co_varnames, it defaults to None, which tells the DT_String
machinery (Which executes the DTML code) to do a containment-less
execution.

The DTML interpreter just does lookups though a namespace mapping
passed in. Perhaps you could do something similar in your
implementation.

 
 This doesn't seem to do anything to the namespace problem.  Actually,
 reading through DTMLMethod and ExternalMEthod aren't helping at all.
 mapply.py seems equally unhelpful, though I can see some of what it is
 trying to do.  Reading it also made me wonder why people say the above code
 make Documents masquerade as functions, it seems in mapply, that if __call__
 is defined, then it is bound to f in mapply anyway.  It seems to me to be in
 the __call__ method that things are important where namespaces are passed to
 HTML.__call__
 
 I am obviously missing some fundamental points or sequences that would help
 me to understand this, I was hoping someone could point me in the right
 direction, either documentation, or some simple explanation, that would make
 reading through that code more obvious.
 
 I am running Zope 2.4.0b2 on python 2.1.
 
 regards
 Mick
 

-- 
| Casey Duncan
| Kaivo, Inc.
| [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] Vulnerability: attacking can get file list and directory

2001-09-24 Thread Casey Duncan

On Sunday 23 September 2001 08:24 pm, Joachim Werner allegedly wrote:
  Vulnerability: attacking can get file list and directory
  Tested on Win32 platform
 
  Example:
  telnet zopeserver 8080
  PROPFIND / HTTP/1.0
  enter
  enter
  enter
 
   list files and directory 
 
  This tested on my site:
  security.instock.ru 8080

 This one really seems to be the old WebDAV is not safe one. I guess it
 has been tackled already. You should be able to switch the file listing off
 for the Anonymous User in Zope 2.4.1 ...

 Joachim

I totally agree. Tracebacks should not be visible to anonymous users! 
Although I would hesitate to call this a vulnerability, it ranks up there 
with the old ability to call objectIds by URL as anonymous.

The less information that anonymous users can glean about the server, the 
better.

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] Vulnerability: attacking can get file list and directory

2001-09-24 Thread Casey Duncan

On Monday 24 September 2001 10:59 am, Shane Hathaway allegedly wrote:
[snip]
 PDV just yields information you might give out anyway.  But maybe we
 could deal with it anyway by writing an error.log instead of sending
 the traceback to the browser.  What do you think?

 Shane


My suggestion would be to hide it for all users except Managers by default. 
So that you aren't hosed if you don't have access to the server log files...

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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: Re: [Zope-dev] WebDav Bug? -- id != name?

2001-09-20 Thread Casey Duncan

On Thursday 20 September 2001 11:03 am, Kevin Dangoor allegedly wrote:
[snip]

 Less magic is good.

 Longer term, it seems like this can be addressed by the Component
 architecture, can't it? Ideally the WebDAV Presentation Component would be
 given some clues about how to represent the object in WebDAV. Or maybe
 there will be a selection of WebDAV components that provide a variety of
 ways to deal with it.

  soapbox
 
  IMHO, I'd rather see the things that make using file extensions
  a pain in the first place go away. The death to index_html part
  of my proposal is a first step toward that. If web-oriented
  tools expect to be able to use file extensions, then Zope needs
  to do what people expect.

 ...while still balancing the desire to easily access objects and methods
 via Python. Tricky.

 Kevin

Possibly just giving the user the ability to specify a name for an object 
separate from it's id so that an extension could be used could be a 
short-term solution. 

Or even just a property DAV_extension that lets you specify the file 
extension when using webDAV. When files are uploaded via WebDAV, the ext is 
stripped from the id and stored in this property. It is reappended by Zope 
when accessing the object through WebDAV.

At least that way it is magic is under your direct control.

-Casey

___
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] KeyError on UnIndex.keyForDocument

2001-10-01 Thread Casey Duncan

On Saturday 29 September 2001 04:29 pm, Chris McDonough allegedly wrote:
 Yeah, I could see this error being raised if you had just added an index
   to use as the sort index and it didn't have all objects indexed within
 it yet...

 And yes, if this is what it is, it's a bug.  But it's structural and not
 operational... we need to think a bit about what it means to add an
 unpopulated index to an existing catalog.  Currently you just need to
 know that you must reindex the catalog.

 - C

What would the reaction be to changing this behavior. I have written some 
code that automatically populates the index when it is added. I personally 
think that reindexing every index just to populate one is grossly inefficient.

I wrote this single index update because of the DocumentLibrary product which 
performs real-time document format conversions when documents are indexed. 
With a catalog of more than 100 MSWord documents, It is glacial to update the 
entire catalog.

Although I have not put this code into a DocumentLibrary release yet, I would 
prefer to see it put directly into the catalog.

Whaddya think?

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] ZCatalog: path summary indices not generated

2001-10-03 Thread Casey Duncan

On Wednesday 03 October 2001 12:54 am, Shane Rowatt allegedly wrote:
 Zope Version: 2.4.1 on linux.

 When I tried to add a ZCatalog followed by finding objects to index using
 the default indices provided (path, summary, id, title etc), the 'path' and
 'summary' indices are never generated. The 'summary' index is always an
 empty string and the 'path' index is 'None'.

Summary is not defined (as you found) for most plain objects. CatalogAware 
defines it, but unfortunately without stripping tags. You might check out my 
DTMLDocumentExt code which renders the document and strips the html tags. It 
is an extension of some code Dieter posted online a while back. You can find 
it at:

http://www.zope.org/Members/Kaivo/DTMLDocumentExt

[snip]

 Surely someone else has come across these problems before using this basic
 catalog stuff??

Yup 8^)


 Shane Rowatt
 Astracon Inc.

hth
/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] ZTables and/or Catalog plugable brains?

2001-10-05 Thread Casey Duncan

On Thursday 04 October 2001 07:34 pm, Jay, Dylan allegedly wrote:

 I tried using ZClasses but it seems to run slow and take up space. Instead
 I'm  using Catalog (without ZCatalog) to contain the data. I'm presuming
 this will be quite efficient (comments welcome).

Yup that should be pretty efficient. Plus you can index and query the thing 
fairly easily.

 Now to my question, How do Catalog plugable brains work? I've looked but
 can't see what the brain class has to look like to work. My first attempts
 don't seem to work. The classes are created but don't contain the data. Is
 the record data passed into the constructor?

I'm not an expert on brains per se, but my understanding is that they allow 
you to wrap functionality from a particular class around data stored in a 
table (such as a Catalog or an external database) without making each record 
an instance of the class.

This is how, when the Catalog returns data, you get the getURL and getObject 
methods for each record (among others). TinyTable and Z SQL Methods also 
support this functionality, and it is exposed in the management interface.

This would allow you to store the actual data as regular metadata elements in 
the Catalog, and get objects out when you query it. It would avoid storing 
the data twice, once in the objects and again in the metadata and all of the 
disadvantages this causes in terms of storage and synchronization.


 Also in my searches I came across lots of references to something called
 ZTables. This seems to be a Catalog with a UI that is about lots of tabular
 information (rather than a ZCatalog which is specialized to replicating and
 indexing existing objects). Is this dead? If not where is it? If so, why?

AFAIK, Catalog contains the only remaining remnants of ZTables in Zope. 

 It seems like a really good idea to me. It seems to be there are times when
 objects (esp ZClasses) are too heavy?

ZClasses impose a performance penalty due to their inherent complexity and 
overhead. You would do much better creating a straight Python class for 
applications where performance and overhead per record is an issue.

I personally avoid using ZClasses for everything but the simplest custom 
objects.


 Anyone with comments about how ZPatterns fits into all of this would also
 be welcome.

My understanding is that ZPatterns is for abstracting the application from 
the storage. It is most beneficial for creating storage-independent 
applications. It would benefit you if that is a requirement, no so much if 
not.

An example might be an application with data in objects, catalogs and 
external databases. ZPatterns would let you create an abstraction layer so 
that the application would not need to be aware of where any given piece of 
data was coming from. You could therefore change your data storage later and 
ideally you would only have to change the abstraction layer, not the 
application itself.

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] standard_error_message and displaying non-html content.

2001-10-18 Thread Casey Duncan

On Thursday 18 October 2001 10:19 am, Noel Duffy allegedly wrote:
[snip]
 Just to clarify, I am only concerned at present with the code in
 HTTPResponse that, in the case of an exception, scans for
 !doctype html or html, and wraps them in html if these are
 not found. (Seb, does this cover the problems you experienced?)

 I think there is a more general problem of making Zope
 content-neutral, but that is a proposal for another time.

 Regards,

 Noel Duffy.


I think the way to proceed is to create a fishbowl proposal to 
change ZPublisher so that no HTML wrapping takes place if the Content-Type is 
some thing other than text/html.

Unfortunately changing magic like this has a tendancy to break code that 
unwittingly relies on it. The fishbowl allows everyone to give that due 
consideration.

I think this is a great idea BTW.

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] How to get the FULL path of an uploaded file?

2001-10-18 Thread Casey Duncan

On Thursday 18 October 2001 02:37 pm, Craeg K. Strong allegedly wrote:
 Does anyone know offhand how to get the FULL path of an uploaded file?

Some browsers (IE notably) supply this information. Most others do not, they 
only provide the file name. It is not however, terribly useful to the server 
or secure to store this information unless such data is not publically 
accessible.


 I am using the standard HTML input type=file within a form inside a
 DTML document.

 Inside my python method, I am getting a
 ZPublisher.HTTPRequest.FileUpload object.   Fine.

 This stuff wraps the standard python cgi module to give you access to
 the headers and contents of the
 file.  You can use a FileUpload the same way you would use a file.

 The problem is:  the name of the FileUpload is the leaf name of the
 file, but not the entire path.

 Does anyone know how to get the FULL PATHNAME as listed in the input
 field in the HTML form?

 I believe Python is being too clever by half and by the time I get my
 grubby hands on it, the value is gone.

This is not a Python issue, many browsers simply do not provide this 
information when the data is posted.


 The only thing I could come up with was an awful little JavaScript hack
 where I snag the value from the
 input field into another hidden field using OnChange/OnClick/OnBlur,
 and grab it later.

That is probably the best way I can think of. Don't feel bad though, 
Javascript code is always a hack! 8^)


 Any suggestions would be greatly appreciated.  Thanks!

 (Should I repost this question on a python-dev list? hm)

 --Craeg

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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] Small ZMI enhancement

2001-10-19 Thread Casey Duncan

When working in versions, it is currently a pain to get to the current version you 
are working in. Since the ZMI displays the path to the current version at the top, 
I thought, why now make this a link to the version so that you can get there in 
one click and manage it?

Here is the patch to lib/python/App/dtml/manage_tabs.dtml:

*** manage_tabs.dtml~   Fri Oct 19 11:34:11 2001
--- manage_tabs.dtmlFri Oct 19 11:37:48 2001
***
*** 161,167 

  dtml-if Zope-Version
  div class=system-msg
! emYou are currently working in version dtml-var Zope-Version html_quote/em
  /div
  /dtml-if
  /dtml-unless
--- 161,167 

  dtml-if Zope-Version
  div class=system-msg
! emYou are currently working in version a 
href=dtml-SERVER_URL;dtml-Zope-Version;/manage_maindtml-var Zope-Version 
html_quote/a/em
  /div
  /dtml-if
  /dtml-unless

Anyone object to putting this in the core?

Enjoy.

/---\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  [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 )



  1   2   3   4   >