Re: [Zope-dev] More comments on ZPatterns

2000-07-05 Thread Phillip J. Eby

At 03:10 AM 7/6/00 +, Scott Parish wrote:
>
>Anyway, Under Zope 2.2, the 'Upon' property of a trigger doesn't have a list 
>of 'event_kinds'.  I think this is related to an earlier post where i 
>complained about zope 2.2 not being able to get such values (for select 
>types) from aquisition, or in this case from a seperate property in its 
>class.  Has anybody thought of a way to address this problem, as it didn't
>sound like the official zope distribution wants to act the way that would
>allow the 'Upon' property to get its proper values right now. (no, i'm
>not going to go off about that )  

In our working copy of ZPatterns, Ty has patched ZPatterns to make the list
a property.  Personally, I think this recent behavior of 2.2 is broken, and
I hope to submit a patch soon to the Collector to fix it, so that we can
back out the ZPatterns patch.  It should not be necessary for the value of
a select/multiselect property to be another *property*, as this will break
other people's code besides ZPatterns.  The Zope documentation in
OFS/PropertyManager.py explicitly states:

For 'selection' and 'multiple selection' properties, there is an
addition item in the property dictionay, 'select_variable' which
provides the name of a property or method which returns a list of
strings from which the selection(s) can be chosen.

So this is pretty clearly broken in 2.2.


>Also, should i not be trying to use ZPatterns 4aX under Zope 2.2?  I thought
>i read that to use triggers a person should use Zope 2.2, but it doesn't
>appear this has been tested under 2.2. (although it is alpha, i haven't 
>forgotten that)

Yeah, you can use it under 2.2, although as you've pointed out, there is a
problem with the property issue.  It has been tested rather extensively
under 2.2, it's just that this one item hasn't been put out in a fix
release, because we were going to report it to the Collector as a bug (I'm
not sure if Ty has done so yet; it was right before my vacation that he
found the problem).

As for the warning about transactional issues with triggers under 2.1.x,
they have to do with triggers that update things stored in the ZODB, and
they will not always have problems.  It's just that transaction ordering
semantics are very different between 2.1.x and 2.2; 2.2 is pure FIFO where
2.1.x is a LIFO stack, even during the commit process.


>ZPatterns is starting to taste pretty sweet.  Keep up the good work!

Thanks.


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




Re: [Zope-dev] More comments on ZPatterns

2000-07-05 Thread Scott Parish

Thus spake Phillip J. Eby ([EMAIL PROTECTED]):

> >and when I ask one of my TableInfo instances for their footnote it
> >comes right out of MySQL! Cool. Now.. I can't seem to figure out how
> >to *change* the data in the database when the user 'edits' the
> 
> Here's some more top-secret documentation...  Use a GenericTrigger to
> implement attribute changes.  Set up your trigger to be activated on object
> changes, and set the trigger expression to call an SQL method, e.g.:
> 

First off it is amazing what a rush it is to fight ZPatterns, and finualy start
winning. 

Anyway, Under Zope 2.2, the 'Upon' property of a trigger doesn't have a list 
of 'event_kinds'.  I think this is related to an earlier post where i 
complained about zope 2.2 not being able to get such values (for select 
types) from aquisition, or in this case from a seperate property in its 
class.  Has anybody thought of a way to address this problem, as it didn't
sound like the official zope distribution wants to act the way that would
allow the 'Upon' property to get its proper values right now. (no, i'm
not going to go off about that )  

Also, should i not be trying to use ZPatterns 4aX under Zope 2.2?  I thought
i read that to use triggers a person should use Zope 2.2, but it doesn't
appear this has been tested under 2.2. (although it is alpha, i haven't 
forgotten that)

ZPatterns is starting to taste pretty sweet.  Keep up the good work!
sRp

-- 
Scott Parish
http://srparish.net/

 PGP signature


Re: [Zope-dev] ZEO and Mountable Fses?

2000-07-05 Thread Anthony Baxter


It's on my list, but I'm not going to get to it for a week or so.

Anthony, building a MountRegistry...


>>> Bill Anderson wrote
> 
> Subject carries the question. Anyone tried this yet, or have any
> insights about it?
> 
> I am considering giving a go this week, thought I'd see if there are any
> heads-up notices I should be aware of. :)
> 
> Back-to-the-migrations-to-ZEO-ly y'rs Bill
> 
> -- 
> "Linux: the operating system with a CLUE...
> Command Line User Environment".
> 
> seen in a posting on comp.software.testing
> 
> ___
> 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 )
> 

-- 
Anthony Baxter <[EMAIL PROTECTED]>   
It's never too late to have a happy childhood.


___
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] ZEO and Mountable Fses?

2000-07-05 Thread Bill Anderson


Subject carries the question. Anyone tried this yet, or have any
insights about it?

I am considering giving a go this week, thought I'd see if there are any
heads-up notices I should be aware of. :)

Back-to-the-migrations-to-ZEO-ly y'rs Bill

-- 
"Linux: the operating system with a CLUE...
Command Line User Environment".

seen in a posting on comp.software.testing

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




Re: [Zope-dev] zpatterns-0.4: creating an item in "virtual mode"

2000-07-05 Thread Phillip J. Eby

At 11:14 AM 7/5/00 +0400, Jephte CLAIN wrote:
>Hello,
>
>I use virtual attribute access to provide access to my SQL database.
>However, I want to use the Rack.newItem facility to create new records
>in the database.
>But it fails because in virtual mode, an item always exists.
>This patch solves the problem, at least for me
>
> 
> # XXX What if all items potentially exist?
> 
>comments?
>

The XXX comment shown above says it all.  :)  Actually, all it says is that
I knew the problem you're having would happen.  However, if I put your
patch in, I now have to have one that said:

  # XXX What if object already exists in virtual mode?

That having been said, I will think about adding your patch, or
alternatively a storage setting that tells the Rack whether to check for
existence before adding new items.  This setting would default to being
true, so you could change it for your circumstance, which is a fairly
special case, I think.


___
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] ZClass inheriting from ObjectManager and DataSkin?

2000-07-05 Thread Phillip J. Eby

At 01:58 PM 7/5/00 +0300, Itamar Shtull-Trauring wrote:
>Are there (or better yet, what are) any potential problems here?  My gut
>feeling was that it wouldn't work, but you can at the very least add objects
>in instances of the ZClass - deleting and renaming don't work though.

When you say deleting and renaming don't work, I'm not following you.  Are
you using these ObjectManager dataskins in a Rack, or in a Folder
w/customization support?  If the latter, have you set up a customizer for
that meta-type?  And when you say they don't work, do you mean no triggers
fire, or that they just plain don't work.  (Tracebacks would be nice in the
latter case.)


___
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] Proposed interface: Restricted creation

2000-07-05 Thread Phillip J. Eby

At 12:01 PM 7/5/00 -0400, Shane Hathaway wrote:
>Itamar Shtull-Trauring wrote:
>> I propose a Restricted Creation Interface - when an ObjectManager
constructs
>> it's Add list in manage_main, it first checks with each addable class if
>> it's instances can be added in this specific ObjectManager.
>
>The place where this is needed most (IMHO) is for ZClass factories.  So
>there needs to be a way to create meta type filters through the Web.
>
>On the other hand, the plugins framework by Phillip Eby solves this
>problem in a nice way.  I'm hoping to eventually modify the plugins
>framework so it's more accessible for ZClass development.

I am too.  :)  If you have any ideas on how to make a ZClass constructor
object that could work with PlugIns, I'm all ears.  Right now, PlugIns have
to be Python classes, although I think that it might be possible to make
the PlugIn registry walk the entire ZClass registry, looking for things
with a __plugin_kind__.  That's something I'll want to look into when I get
a chance.

If you'd like to champion getting PlugIns into Zope as a standard feature,
I am willing to contribute the code for ZPL use.  Personally, given the
small handful of other things I'd like to do to polish off PlugIns (such as
documentation), I'm not sure now is the right time for making such a
transition.


___
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] Yesterdays CVS: I can add broken products! :/

2000-07-05 Thread Bill Anderson

OK, I am working on a CVS dump from yesterday of Zope2. I am upgrading
from 2.1.6. I did so by making new folder, copying products that I
actually used over, and building Zope, then bringing over the Data.fs.

Oh, and ZEO is there too (Damn that thing is cool!).


And now I have a very weird problem...
I have a couple of ZProducts that are 
  o _not_ listed as broken in Control_Panel/Products
  o Instances of them appear as "This object from the unknown Product is
broken!"

Here is the kicker: I can add new instances of them, and they too
magically appear as broken, with no complaints about creating them!

Also, I can't seem to  pack the database. it claims it has already been
packed to a later date. This db hasn't been packed in at least a month.

ISTR something about the last one, so I'll be hunting the list archives,
but if someone has a moment, and the answer, don't be afraid to shoot it
my way.

TIA, Bill

-- 
"Linux: the operating system with a CLUE...
Command Line User Environment".

seen in a posting on comp.software.testing

___
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] ExtensionClass and __radd__()?

2000-07-05 Thread Greg Ward

Hi all --

looks like ExtensionClass doesn't recognize/implement the '__radd__()'
protocol.  Speculation below; first, a demonstration.  Normal case: a
regular class Number that knows how to add itself to other number-like
things:

  class Number:
  def __init__ (self, n):
  self.n = n

  def __str__ (self):
  return str(self.n)

  def __add__ (self, other):
  return self.n + other

  __radd__ = __add__

  n = Number(37)
  print n, n + 5, 5 + n

The output of this is exactly what you'd expect:

  37 42 42

(I have convinced myself that '__radd__()' is called in the "5 + n" case
by writing a separate '__radd__()' with a print statement.  Everything
is sane!)

Now the same thing as an ExtensionClass:

  from ExtensionClass import Base
  class ECNumber (Base):
  def __init__ (self, n):
  self.n = n

  def __str__ (self):
  return str(self.n)

  def __add__ (self, other):
  return self.n + other

  __radd__ = __add__

  ecn = ECNumber(37)
  print ecn, ecn + 5, 5 + ecn

The output of this is puzzling, to say the least:

  37 42 134883149

IOW, "5 + ecn" evaluates to 134883149 -- that's a plain int, I checked
with 'type()' on it.  If I put this code:

  print id(ecn), id(5), id(ECNumber), id(Base), id(ExtensionClass)

immediately after the last print, I get

  135530536 135220848 135568720 1075195712 1075195488

... which just tells me that the result of "5 + ecn" looks a lot like an
id(), but isn't the id() of anything obvious.  (Or 5 + any obvious
id().)

Happens the same with the ExtensionClass code from Zope 2.1.5 or
2.2beta1, and with Python 1.5.2 and the latest CVS Python.

Speculation time: I'm guessing that this is similar to the problem with
'isinstance()' and ExtensionClass that I found several months ago, which
was heroically debugged by Barry.  To recap, it's a mutual
finger-pointing bug: Python (Guido) can claim that it's up to
ExtensionClass (Jim) to emulate the full semantics of Python
classes/instances, but ExtensionClass can claim that Python should be
more relaxed in what it accepts as a "class object" or "instance
object".

I think the relevant code in Python is in Objects/abstract.c,
specifically 'PyNumber_Add()' and the BINOP macro:

#define BINOP(v, w, opname, ropname, thisfunc) \
if (PyInstance_Check(v) || PyInstance_Check(w)) \
return PyInstance_DoBinOp(v, w, opname, ropname, thisfunc)

[...]
PyNumber_Add(v, w)
PyObject *v, *w;
{
PySequenceMethods *m;

BINOP(v, w, "__add__", "__radd__", PyNumber_Add);
[...]

My guess is that PyInstance_Check() returns false for ExtensionClass
instances.  Two possible fixes: loosen up PyInstance_Check(), or loosen
up BINOP.

Well, it's a nice theory.  It doesn't explain why '__add__()' works for
ExtensionClass while '__radd__()' does not; perhaps ExtensionClass
implements that much of Python's class semantics, but doesn't go as far
as '__radd__()'.

Other opinions?

Greg

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




Re: [Zope-dev] ZPatterns: DropZone example

2000-07-05 Thread Phillip J. Eby

At 03:12 PM 7/5/00 -0500, Jimmie Houchin wrote:
>"Phillip J. Eby" wrote:
>[snip]
>> Peter Coad's design approach (which ZPatterns is heavily based on/biased
>> towards) emphasizes four major layers of classes in an application:
>> 
>> 1) User Interface (GUI, forms, etc.)
>> 2) Problem Domain (the actual application purpose)
>> 3) Data Management (object persistence/lifecycle management)
>> 4) System Interaction (interfaces w/hardware or other software)
>
>Is this from one of his books? If so, which one? 

"Object Models: Strategies, Patterns, and Applications"


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




Re: [Zope-dev] ZPatterns: DropZone example

2000-07-05 Thread Jimmie Houchin

"Phillip J. Eby" wrote:
[snip]
> Peter Coad's design approach (which ZPatterns is heavily based on/biased
> towards) emphasizes four major layers of classes in an application:
> 
> 1) User Interface (GUI, forms, etc.)
> 2) Problem Domain (the actual application purpose)
> 3) Data Management (object persistence/lifecycle management)
> 4) System Interaction (interfaces w/hardware or other software)

Is this from one of his books? If so, which one? 
I would be interested in gaining more enlightenment. :)

Thanks,

Jimmie Houchin

___
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] Looking for Zope webmaster or web developer job

2000-07-05 Thread Loren Stafford

I'm looking for a new job where I can continue to use Zope for website
management and applications development.

Contract or full-time.

Silicon Valley California or telecommute.

If you know of any openings, please let me know.

-- Thanks
-- Loren Stafford

[EMAIL PROTECTED]

http://www.dynalogic.com/resume.html


___
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] why does my externalmethod generate a ZODB transaction

2000-07-05 Thread Joachim Schmitz

Hi,

I wrote an external method from which I call a ZSQL-method, this runs fine
and returns the correct results, but when I look at the ZODB transactions,
I see that for each call of the method a transaction is recorded. Even
worse, when I make an error in my method, the folder from which I invoked
the method is no longer accesseble. I have to undo the transaction first,
that's how I found out that there is a transaction happening.


here is the code of the External-method:

import string
import sys
sys.path[0:0]=["/usr/local/Zope-2.1.4/Extensions"]
from DocumentTemplate import *
def dump(self,EA,**kwa):
#return EA,kwa
s = ""
if hasattr(self,EA):
ea = apply(getattr(self,EA),(),kwa)
#return ea._names,"",ea._schema
ead = ea.__dict__
for r in ead.keys():
s = s + r + ""
i=getattr(ea,r)
if type(i) == type([]) and len(i) > 0:
s = s + str(i) + "  "
for n in i:
s = s + str(n) + " | "
s=s+""
elif type(i) == type({}):
s = s + str(i) + "  "
for n in i.items():
s = s + str(n) + " | "
s=s+""
return s

def workform(self,REQUEST):
"Die Masken EinAusgabe"
scol = "movie_id"
sval = "a%"
srel = "like"
return dump(self,"Row_search",scol=scol,sval=sval,srel=srel)

this dumps the result of the ZSQL-method, I call it from a dtml-method
"testForm" like this:


<--- this calls workform


when invoking this like .../Movies/testForm

I have an entry in the undoable transactions:

...Movies/testForm by super on Jul 4 at 21:21:31  

By the way why is the day one day off the machine REDhat 6.2 Zope-2.1.4
has the correct date and shows now:
 

Wed Jul  5 21:49:01 CEST 2000 

Mit freundlichen Grüßen

Joachim Schmitz  

  
AixtraWare, Ing. Büro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven  
Telefon: +49-2464-8851, FAX: +49-2464-905163


___
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] 'issubclass' and 'isinstance' on ExtensionClasses

2000-07-05 Thread Chris McDonough

According to Andrew Kuchling's and Moshe Zadka's "Python 2.0 what's new
list", isinstance() and issubclass() already works on
ExtensionClass-based stuff in Python 1.6.  See
http://starship.python.net/crew/amk/python/writing/new-python/new-python
.html#SECTION00090

That said, as for right now, I'm not sure if your extended functions do
the right thing.  Maybe someone else can comment.

> -Original Message-
> From: Greg Ward [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 05, 2000 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: [Zope-dev] 'issubclass' and 'isinstance' on ExtensionClasses
> 
> 
> Hi all --
> 
> surely I'm not the first to deal with this: I use 
> 'isinstance()' a lot,
> and 'issubclass()' occasionally, for run-time type-checking.  This
> breaks when using ZODB Persistent classes, or any other type of
> ExtensionClass for that matter.
> 
> I see no use of 'issubclass()' in the Zope lib/python directory, and
> only a few scattered uses of 'isinstance()'.  (Checked both 2.1.5 and
> 2.2b2.)  So maybe I *am* the first to worry about this.  I'm surprised
> that ExtensionClass doesn't include enhanced versions of 
> 'issubclass()'
> and 'isinstance()', though.
> 
> So, here are my versions.  Critiques welcome.  In particular, is
> "type(X) is not ClassType and hasattr(X, '__bases__')" an adequate
> determination that X is indeed an extension class?
> 
> If you folks want to include these with ExtensionClass (possibly with
> the leading "ec_" trimmed from the names), be my guest.
> 
> --snip 
> snip-
> def ec_issubclass (class1, class2):
> """A version of 'issubclass' that works with extension classes
> as well as regular Python classes.
> """
> 
> # Both class objects are regular Python classes, so use the
> # built-in 'issubclass()'.
> if type(class1) is ClassType and type(class2) is ClassType:
> return __builtin__.issubclass(class1, class2)
> 
> # Both so-called class objects have a '__bases__' attribute: ie.,
> # they aren't regular Python classes, but they sure look 
> like them.
> # Assume they are extension classes and reimplement what 
> the builtin
> # 'issubclass()' does behind the scenes.
> elif hasattr(class1, '__bases__') and hasattr(class2, 
> '__bases__'):
> # XXX it appears that "ec.__class__ is type(ec)" for an
> # extension class 'ec': could we/should we use this as an
> # additional check for extension classes?
> 
> # Breadth-first traversal of class1's superclass tree.  Order
> # doesn't matter because we're just looking for a "yes/no"
> # answer from the tree; if we were trying to resolve a name,
> # order would be important!
> stack = [class1]
> while stack:
> if stack[0] is class2:
> return 1
> stack.extend(list(stack[0].__bases__))
> del stack[0]
> else:
> return 0
> 
> # Not a regular class, not an extension class: blow up 
> for consistency
> # with builtin 'issubclass()"
> else:
> raise TypeError, "arguments must be class or 
> ExtensionClass objects"
> 
> # ec_issubclass ()
> 
> 
> def ec_isinstance (object, klass):
> """A version of 'isinstance' that works with extension classes
> as well as regular Python classes."""
> 
> if type(klass) is ClassType:
> return isinstance(object, klass)
> elif hasattr(object, '__class__'):
> return ec_issubclass(object.__class__, klass)
> else:
> return 0
> 
> # ec_isinstance ()
> --snip 
> snip-
> 
> -- 
> Greg Ward - software developer[EMAIL PROTECTED]
> MEMS Exchange / CNRI   voice: +1-703-262-5376
> Reston, Virginia, USAfax: +1-703-262-5367
> 
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
> 

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




[Zope-dev] 'issubclass' and 'isinstance' on ExtensionClasses

2000-07-05 Thread Greg Ward

Hi all --

surely I'm not the first to deal with this: I use 'isinstance()' a lot,
and 'issubclass()' occasionally, for run-time type-checking.  This
breaks when using ZODB Persistent classes, or any other type of
ExtensionClass for that matter.

I see no use of 'issubclass()' in the Zope lib/python directory, and
only a few scattered uses of 'isinstance()'.  (Checked both 2.1.5 and
2.2b2.)  So maybe I *am* the first to worry about this.  I'm surprised
that ExtensionClass doesn't include enhanced versions of 'issubclass()'
and 'isinstance()', though.

So, here are my versions.  Critiques welcome.  In particular, is
"type(X) is not ClassType and hasattr(X, '__bases__')" an adequate
determination that X is indeed an extension class?

If you folks want to include these with ExtensionClass (possibly with
the leading "ec_" trimmed from the names), be my guest.

--snip snip-
def ec_issubclass (class1, class2):
"""A version of 'issubclass' that works with extension classes
as well as regular Python classes.
"""

# Both class objects are regular Python classes, so use the
# built-in 'issubclass()'.
if type(class1) is ClassType and type(class2) is ClassType:
return __builtin__.issubclass(class1, class2)

# Both so-called class objects have a '__bases__' attribute: ie.,
# they aren't regular Python classes, but they sure look like them.
# Assume they are extension classes and reimplement what the builtin
# 'issubclass()' does behind the scenes.
elif hasattr(class1, '__bases__') and hasattr(class2, '__bases__'):
# XXX it appears that "ec.__class__ is type(ec)" for an
# extension class 'ec': could we/should we use this as an
# additional check for extension classes?

# Breadth-first traversal of class1's superclass tree.  Order
# doesn't matter because we're just looking for a "yes/no"
# answer from the tree; if we were trying to resolve a name,
# order would be important!
stack = [class1]
while stack:
if stack[0] is class2:
return 1
stack.extend(list(stack[0].__bases__))
del stack[0]
else:
return 0

# Not a regular class, not an extension class: blow up for consistency
# with builtin 'issubclass()"
else:
raise TypeError, "arguments must be class or ExtensionClass objects"

# ec_issubclass ()


def ec_isinstance (object, klass):
"""A version of 'isinstance' that works with extension classes
as well as regular Python classes."""

if type(klass) is ClassType:
return isinstance(object, klass)
elif hasattr(object, '__class__'):
return ec_issubclass(object.__class__, klass)
else:
return 0

# ec_isinstance ()
--snip snip-

-- 
Greg Ward - software developer[EMAIL PROTECTED]
MEMS Exchange / CNRI   voice: +1-703-262-5376
Reston, Virginia, USAfax: +1-703-262-5367

___
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] Searching in a MySQL-Database

2000-07-05 Thread Andre Schubert

Hi,

i have a very important question. Is there a way to search in a
mysql-database with the ZCatalog.
Could i create a temporary file from a table and search it with the
ZCatalog.
If there are any Ideas please tell me.

Thanks, as


___
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] Proposed interface: Restricted creation

2000-07-05 Thread Itamar Shtull-Trauring

Shane Hathaway wrote:

> The place where this is needed most (IMHO) is for ZClass factories.  So
> there needs to be a way to create meta type filters through the Web.

Yes, but in Python products too, where you have Items that should only go in
specific ItemHolders.  This is very common.

> On the other hand, the plugins framework by Phillip Eby solves this
> problem in a nice way.  I'm hoping to eventually modify the plugins
> framework so it's more accessible for ZClass development.  Do you have
> an application where plugins won't suffice?

Not right now - but I'm sure someone will at some point, so why limit
yourself?  And why limit this to ZClasses only?

-- 
Itamar S.T.  [EMAIL PROTECTED]
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C

___
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] Proposed interface: Restricted creation

2000-07-05 Thread Shane Hathaway

Itamar Shtull-Trauring wrote:
> I propose a Restricted Creation Interface - when an ObjectManager constructs
> it's Add list in manage_main, it first checks with each addable class if
> it's instances can be added in this specific ObjectManager.

The place where this is needed most (IMHO) is for ZClass factories.  So
there needs to be a way to create meta type filters through the Web.

On the other hand, the plugins framework by Phillip Eby solves this
problem in a nice way.  I'm hoping to eventually modify the plugins
framework so it's more accessible for ZClass development.  Do you have
an application where plugins won't suffice?

Shane

___
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] Zope contract job in Atlanta

2000-07-05 Thread Frank Steele

Description: Zope/Python contract programmer. MTNI is a wireless media
startup in Atlanta, GA. We're seeking a freelance developer with experience
in Zope and Python to develop a messaging app. We offer wireless
software/hardware solutions to a potential market of nearly 10 million US
users/day.

We need a smart, web-savvy developer who will need a minimum of handholding.
Experience with SQL integration a plus, Zope on Unix/Linux experience
preferred. If you're a good fit, this could very well turn into a permanent
gig with equity. You will play a crucial role in our business.

Preference for local developer(s), but willing to work with web-commuters.

Company: MTNI
Location: Midtown Atlanta, GA
Contact: [EMAIL PROTECTED]
mailto:[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 use document templates

2000-07-05 Thread Steve Alexander

Jarkko Veijalainen wrote:
> 
> Hi!
> 
> Where can i find S_I_M_P_L_E example of using document templates with
> zope/python. I have this external method, wich return several variables from
> object class. I want to embed to results in DTML page.
> 
> The method is called from Zope by HTML form with 3 input attributes. Right
> now i have only managed to get obj.member in return plain screen. I can't
> use  tag, because i need to send those input values to the
> external method. ( i must be sound like real newbie, in fact i'm  :) )
> 
> How i get those results in DTML page? Is the templates the answer or this
> there better way to this.

This question really belongs at on the [EMAIL PROTECTED] mailing list, as it
is to do with using Zope in a standard way, rather than developing Zope.


Sounds to me like you're not really sure where to start. Try going
through the Job board tutorial, as it will give you an idea of how
things work together.

  http://www.zope.org/Members/mukhsein/job_board_howto


If you want something that is easier to follow, with screenshots and
fuller explanations, and you don't mind paying for it, you might want to
look at Beehive's ZClass Tutorial.

 
http://hive.beehive.de/Beehive/www.beehive.de/Zope/ZClassTutorialEnglish_html


Also, take a look at the Zope documentation project.

  http://zdp.zope.org

Furthermore, there's a tutorial that comes packaged with the latest 2.2
beta versions of Zope. You might like to try that, too.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
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] How to use document templates

2000-07-05 Thread Jarkko Veijalainen

Hi!

Where can i find S_I_M_P_L_E example of using document templates with
zope/python. I have this external method, wich return several variables from
object class. I want to embed to results in DTML page. 

The method is called from Zope by HTML form with 3 input attributes. Right
now i have only managed to get obj.member in return plain screen. I can't
use  tag, because i need to send those input values to the
external method. ( i must be sound like real newbie, in fact i'm  :) )

How i get those results in DTML page? Is the templates the answer or this
there better way to this.

jarkko

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




[Zope-dev] ZClass inheriting from ObjectManager and DataSkin?

2000-07-05 Thread Itamar Shtull-Trauring

Are there (or better yet, what are) any potential problems here?  My gut
feeling was that it wouldn't work, but you can at the very least add objects
in instances of the ZClass - deleting and renaming don't work though.

-- 
Itamar S.T.  [EMAIL PROTECTED]
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C

___
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] Proposed interface: Restricted creation

2000-07-05 Thread Itamar Shtull-Trauring

(URL:
http://www.zope.org/Members/michel/Projects/Interfaces/RestrictedCreation)

Restricted Creation of Objects

The problem - certain types of objects should not be added except in certain
places or with certain restrictions. For example, we may want to make sure
Laundry objects are only added inside Luggage objects, and nowhere else. Or
we may want to make sure that an object is added only if there's a MailHost
in it's acquistion path. How do we ensure this?

I propose a Restricted Creation Interface - when an ObjectManager constructs
it's Add list in manage_main, it first checks with each addable class if
it's instances can be added in this specific ObjectManager.

We do this by calling a class method called _addableIn(), that receives as a
parameter the ObjectManager to which we may want to add objects. If the
result is not true, instances of this class can't be added, and won't be
listed in the Add list.

For example, the following code will make the Laundry class show up in the
Add menu only in objectmanagers whose meta_type is "Luggage":

class Laundry(SimpleItem):
""" A Fruit class """

def _addableIn(parent):
if parent.meta_type == "Luggage": return 1
else: return 0


I'm not sure how to get from meta_type to class, so I can't show working
code, but something like this in ObjectManager.py would do the trick:

def filtered_meta_types(self, user=None):
# Return a list of the types for which the user has
# adequate permission to add that type of object.
user=getSecurityManager().getUser()
meta_types=[]
if callable(self.all_meta_types):
all=self.all_meta_types()
else:
all=self.all_meta_types
for meta_type in all:
>   klass = getClassFromMetaType(meta_type)
>
>   # If the class has a function _addableIn, it must return true or
>   # that means the class doesn't want to be added to this ObjectManager:
>
>   if not hasattr(klass, '_addableIn') or klass._addableIn(self):
>   if meta_type.has_key('permission'):
>   if user.has_permission(meta_type['permission'],self):
>   meta_types.append(meta_type)
>   else:
>   meta_types.append(meta_type)
return meta_types

Comments?

-- 
Itamar S.T.  [EMAIL PROTECTED]
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C

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




[Zope-dev] zpatterns-0.4: creating an item in "virtual mode"

2000-07-05 Thread Jephte CLAIN

Hello,

I use virtual attribute access to provide access to my SQL database.
However, I want to use the Rack.newItem facility to create new records
in the database.
But it fails because in virtual mode, an item always exists.
This patch solves the problem, at least for me

--- Rack.py.origMon Jun 26 11:35:25 2000
+++ Rack.py Wed Jul  5 11:13:04 2000
@@ -125,7 +125,8 @@
 
 # Create a new object, identified by key
 
-item = self.getItem(key)
+a = self.loadAttrib
+item = not a and self.getItem(key) or None
 
 # XXX What if all items potentially exist?
 
@@ -134,7 +135,6 @@
 
 item = self._RawItem(key)
 
-a = self.loadAttrib
 if not a:
 slot = self._writeableSlot(key)
 slot[SelfKey] = item.aq_base# strip acquisition
wrapping

comments?

regards,
[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 )