[Zope-dev] zpatterns-0.4a4

2000-06-26 Thread Jephte CLAIN

There is a bug (a feature?) in Specialist.getItem in zpatterns-0.4a4:

def getItem(self, key):
if hasattr(self.aq_base,'retrieveItem'):
return self.retrieveItem(key=key) # XXX need DTML check?

for rack in self.rackList:
item = rack.__of__(self).getItem(key)
return item

This code should (IMHO) read:

def getItem(self, key):
if hasattr(self.aq_base,'retrieveItem'):
return self.retrieveItem(key=key) # XXX need DTML check?

for rack in self.rackList:
item = rack.__of__(self).getItem(key)
if item is not None:
return item
return None

regards,
jephte clain
[EMAIL PROTECTED]

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




Re: [Zope-dev] zpatterns-0.4a4

2000-06-26 Thread Jephte CLAIN

mike wrote:
> I also think so, Jephte. But I thought 'for rack ...' was just a shorter
> form of
> 
> if len( rackList) > 0) :
>   return rackList[0].__of__( self).getItem( key)
> else :
>   return None
The intended behavior (at least in zpatterns-0.3) was to get an item
from one of the racks. This is why I think this is a bug. It changes the
behavior of zpatterns-0.3 because it returns the value from the first
rack, and ignore the others. I wonder then of what use is the other
racks... (or is this intended? I don't think so)
If a rack returns None, then we assume the rack is not responsible for
storage of that element, and go on with the next rack in the list


> Better you, Phillip, replace it with one of more clear forms - Jephte's
> or mine.
> 
> By the way, I do not like this Rack list at all. Racks and Specialists
> are both DataManagers with compatible interfaces (getItem, newItem).
> IMHO, Specialists should have list of DataManagers. This make much sense
> in context of combining Specialists - ZSession and ClientManager, for
> example. It is not sufficient just to tune ZSession using
> ClientManager's rack and ZClass, because in this case we are losing the
> ClientManager's aspect in sessions. Of course, one always can create
> delegating rack (and even rack-to-specialist bridge), but what do this
> for if simple replacing rackList with dataManagerList will solve all
> such problems?
I believe RackMountable/Racks/Specialist are not the same as
DataSkin/DataManagers (in the spirit at least) They are used for
different things. Or it is kept for compatibilty with old applications
(at least, LoginManager use the Specialist/Rack paradigm)

> (Oh Gott, help mine improvink mie English :-)
itoo :-)

regards,
jephte clain
[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] bug in zpatterns-0.4 ?

2000-06-26 Thread Jephte CLAIN

hello,

Rack.createItem (low level method) first calls Rack.getItem (higher
level method) to check the existence of the item.
This causes infinite loop in certain cases. It should (IMHO) call
Rack.retrieveItem instead

regards,
jephte clain
[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] bug in zpatterns-0.4 ?

2000-06-27 Thread Jephte CLAIN

mike wrote:
> Jephte CLAIN wrote:
> > Rack.createItem (low level method) first calls Rack.getItem (higher
> > level method) to check the existence of the item.
> > This causes infinite loop in certain cases. It should (IMHO) call
> > Rack.retrieveItem instead
> Could you provide an example please?
My data is located in an SQL database. I want to have some associated
data in ZODB. ZPatterns is a perfect fit for this. When I first access a
SQL record, the corresponding data is created in ZODB:

def getItem(self, key):
  if self.sql_get(key=key):
# ok it exists in the SQL database
item = Rack.getItem(self, key)
if item is None:
  # it does not exist in ZODB, create it
  item = Rack.newItem(self, key)
  else:
item = None
  return item

This causes infinite loop because Rack.newItem calls Rack.createItem
which calls my (modified) getItem

regards,
jephte clain
[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] bug in zpatterns-0.4 ?

2000-06-27 Thread Jephte CLAIN

mike wrote:
> > This causes infinite loop because Rack.newItem calls Rack.createItem
> > which calls my (modified) getItem
> 
> 1. Leave getItem untouched. Move all that SQL-related stuff into the
> retrieveItem method which *is intended* to be overriden.
> 
> 2. Move newItem stuff into Specialist. You have mixed 'Restaurant' and
> the 'FoodStore' in this snippet :-) Do this instead:
Good point. I have to remember that getItem/newItem are not for
overriding.
But the problem remains the same. a low level method (createItem) should
not call a high level method (getItem)

regards,
jephte clain
[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] bug in zpatterns-0.4 ?

2000-06-27 Thread Jephte CLAIN

mike wrote:
> There is no way to infinite recursion if Rack.getItem is leaved
> untouched. 
Ah ah. But people will touch it. Like me for example :-)
There is no way to prevent overriding getItem from a ZClass for example.
And it *will* recurse infinitely, making Zope dumping core.

> getItem/newItem are not a high level methods, they are *part
> of DataSource's protocol* which *implemented* in Rack with retrieveItem
> and buddies.
getItem/newItem are not meant to be overrided. retrieveItem/createItem
are to overrided. This is different level for me.

When Philipp wake up (I guess he's asleep right now :-)), he might give
his opinion about that.

regards,
jephte clain
[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] how to iterate on a list of DataSkins?

2000-06-27 Thread Jephte CLAIN

hello,

I have a custom Rack which have a searchResults:

-8<-
def searchResults(self, **kw):
sqlresults = self.sql_search(kw)
return map(
lambda r, self=self: self.getItem(r.key), 
sqlresults
)
-8<-

The sql query give me a list of keys to be looked up in the ZODB. I have
got an AttributeProvider on the rack which get the other attributes from
the SQL table.
However, when I try to use the results from DTML inside the specialist:





This does not work. It throws an exception (sqlvalue not found)
But:



*does* work. Why the DataSkin seems no to be pushed on the variable
stack in the first case???

any ideas?

regards,
jephte clain
[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] bug in zpatterns-0.4 ?

2000-07-03 Thread Jephte CLAIN

"Phillip J. Eby" wrote:
> >When Philipp wake up (I guess he's asleep right now :-)), he might give
> >his opinion about that.
> I've been on vacation.
I knew it. But it's always funny to play with timezone issues.

> I'm basically with Mike on this one, with a slight
> amplification on my intention here.  IMHO, what you should be doing with
> your SQL is making it an AttributeProvider, and using the "virtual" mode of
> the Rack which does not store the item in the ZODB, only its
> propertysheets.  Then you will not need to override *anything* in any of
> the ZPatterns classes.  If you need to store persistent attributes, this
> may be an issue.  I'm planning to create a "Persistent External Attribute
> Provider" to allow one to store attributes persistently even when the
> object itself isn't stored in the ZODB.
> 
> In any case, my intention for mixed-database objects in racks is that one
> should not need to override any of the built-in methods of Rack.  In
> earlier versions of ZPatterns, such overriding seemed like it would be
> necessary, but as of 0.4 there is really no reason at the framework level
> to mess with any of Rack's implementation details unless you need to create
> a special hand-tuned version for some critical bit of efficiency.  Almost
> anything you could do by overriding those methods can now be done through
> Generic Attribute Providers or other plug-ins.

Back to my first question: is it intended that Rack.createItem (a IMHO
low level method) calls Rack.getItem (a IMHO higher level method) to
check the existence of the item? Shouldn't it be Rack.retrieveItem
instead? That's why I asked the question in the first place.

About my applications now. The primary keys in the SQL database may be
integers, or tuple of integers, or strings (depending on the project, I
have several to deal with right now). I want to merge results from
several databases from a single rack.
For example I have a Site table (with SiteKey as the primary key) and a
Subdivision table (with SubdivisionKey as the primary key) which I want
to merge into the LocationRack (with the key being the tuple (SiteKey,
SubdivisionKey))
This is why I mess with the implementation of the rack. Also, my racks
are specialized to have a searchResults method, and a editItem method
(until I can find the time to write a decent SQL Attribute setter
provider)

I guess I have good reasons to mess with all that stuff :-) There might
be another mean to deal with it. Once I have a bit more 'zenpatterns'
;-)

btw, the genericattributeprovider has saved me a great deal of time.
thanks very much!

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 )




Re: [Zope-dev] bug in zpatterns-0.4 ?

2000-07-04 Thread Jephte CLAIN

"Phillip J. Eby" wrote:
> Nope.  The two levels of methods (get/retrieve and new/create) are there to
> seperate Rack-level concerns from implementation concerns.  getItem() and
> newItem() handle maintenance of Rack-level invariants such as the retrieval
> cache, while retrieveItem() and createItem() deal with object-level
> invariants.  If you called retrieveItem() instead of getItem(), the code
> would bypass the rack-level invariants managed by getItem(), which would
> mean in this case that the per-transaction cache would be bypassed.
yes, this is a bit more clear to me now.

> Hm.  Seems to me that you should just use two GAP's, one for each DB table,
> each using "self.id[0]" and "self.id[1]" respectively to determine their
> primary keys.
(cough) why didn't I think about it???

> >Also, my racks
> >are specialized to have a searchResults method, and a editItem method
> >(until I can find the time to write a decent SQL Attribute setter
> >provider)
> 
> A reasonable approach.  Although, in the case of SQL attribute setting, see
> my other e-mail from this evening about the use of Generic Triggers to do
> SQL attribute setting.
> 
> >btw, the genericattributeprovider has saved me a great deal of time.
> >thanks very much!
> 
> No problem.  Did you ever try re-casting your CatalogAwareness replacement
> to use GenericTrigger instead of a specific Agent plug-in?
I did not have the time to do so. I still stick to Zope-2.1.6 for now,
and I was afraid of the issues with transaction commit order. and the
motto is 'if it ain't break, don't fix it'. I have a contract to upgrade
the product in august though. I will look at it at that time.

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 )




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




[Zope-dev] zpatterns: how to specify default values?

2000-07-13 Thread Jephte CLAIN

hello,

a common practice is to put default values for attributes for a classe
as class variables.
if the instance hasn't got the value, it gets the value from the class.

but I can't do this with dataskins, because direct dataskins attributes
take precedence on attributes providers.

the way I do it now is to make a default_attributes attribute provider
which provides defaults. is this correct?
or is there a better way to do this?

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 )




Re: [Zope-dev] zpatterns-0.4: defaults attributes, more...

2000-07-13 Thread Jephte CLAIN

"Phillip J. Eby" a écrit :
> Try:
> data=(self.which_one and [self.second_data] or [self.first_data])[0]

wow. what a *clever* idea to use [] around self.???_data. I used to
write:

data=self.which_one and self.second_data or self.first_data

but this failed because sometimes self.second_data is a "false" value
(eg 0, '', instead of None that I use for empty values), causing
self.first_data to be returned instead.
one learns about python every day. thanks for the tip.
As I wrote in an earlier post, my initial problem was solved using
class_defaut_for_X trick

> Offhand, I'd guess that there is probably a lot easier way to do what
> you're doing, and that you probably don't even need/want "id" to be a
> sequence, let alone some of the other things you're doing here.  But
> without knowing what your app is actually trying to do, I can't suggest
> anything further.
I'm writing an application to track issues. I can not just use DC's
tracker product, because my customer's needs are very specials.
Well, various entities in my application have a so called 'location'. I
wish to be able to re-use the application I'm writing, so I abstracted
the concept of 'location'. i have then a specialist to manage locations
got from a location rack.
The rack I wrote for my customer deals with two-headed locations: (site,
subdivision). Each part of the location is managed in a different way,
but I need the two to identify one's location.
Later, when I install that program for a different customer, I want to
be able to rip out the old location rack and put another location rack
which can be more 'normal' (ie, one-headed) No one will notice except
the key to get the location is now an integer (or a string) instead of a
tuple.

So, I think I'm doing right to have an id which is a sequence.

Thanks for your great help. I'm still fighting to acquire the principle
behind zpatterns, but once I get it, I wish I could help others to
understand it as well.

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 )




Re: [Zope-dev] zpatterns: how to specify default values?

2000-07-13 Thread Jephte CLAIN

"Phillip J. Eby" a écrit :
> Yes.  Name the attributes "class_default_for_X" where X is the attribute
> name.
Thanks very much.

> This works with the currently release ZPatterns, but alpha5 will go
> one better and let you create ZClass property sheets that transparently
> implement this.  That is, if you add a "DataSkin Property Sheet" to your
> ZClass instead of the standard "Common Instance Property Sheet", that
> sheet's attributes will be translated to/from the "class_default_for_X"
> names on the ZClass.
I don't use ZClass as I wrote only in Python. I really have to
understand how do propery sheets work.

What I don't understand is where the properties are stored. This is not
clear when I read the PropertyManager source. I guess property sheets
are for grouping some related attributes, but the actual work of
storing/retrieving the attribute is done by the attribute providers,
right?

If so, so be it :-)

By the way,

- is the python programmer have to mix PropertyManager in with DataSkin
to use property sheets? I guess so, but what, I seem to be the only one
who use zpatterns directly from python. All the ZClass junkies out there
do have all the mixin classes ready even before they start :-)

- I sometimes have a dataskin that is willing to get something from its
context. What is the preferred way to do this: try to acquire the
attribute from self._v_rack, wich is guaranteed to be wrapped in the
specialist's context, or just mix Acquisition.Implicit in with DataSkin?

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 )




[Zope-dev] several permissions for the same method

2000-07-19 Thread Jephte CLAIN

Hello,

is it possible for a single method, under Zope 2.1.6, to have several
permissions? ie

__ac_permission__ = (
('edit my data', 'edit_data'),
('edit others\'s data', 'edit_data'),
)

I have the scenario where a user can edit *its* data but not other
users's data, unless he has a special role. however, the method used to
edit one's data is the same.
So I make sure inside the edit_data method that the user has the
adequate permissions if he tries to edit another one's data.

this does not work. indeed, lib/python/AccessControl/Permission.py
reads:

# Attribute names which appear in a
# permission may not appear in any other permission defined
# by the
object.

thanks in advance for any advices.

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 )




Re: [Zope-dev] several permissions for the same method

2000-07-19 Thread Jephte CLAIN

Dieter Maurer wrote:
> Jephte CLAIN writes:
>  > I have the scenario where a user can edit *its* data but not other
>  > users's data, unless he has a special role. however, the method used to
>  > edit one's data is the same.
> Can you not use the "Owner" role for this?
I suppose not, because data is taken from a SQL database, so everyone
could potentially trash others' data

Oleg advised to make edit_data unpublishable and to write wrappers
around it. However, I have thought of another way to do it. Whether it
is better or not, I like it because I do not have to rewrite edit_data
that much.

__ac_permissions__ = (
('Use edit_data', ('edit_data', )),
('Edit one\'s data', ('check_perm_1', )),
('Edit others\' data', ('check_perm_2', )),
)

check_perm1 and check_perm_2 are do-nothing methods that are protected
by the permissions. In edit_data, I call them as appropriate to check
for the user's permissions.

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




Re: [Zope-dev] several permissions for the same method

2000-07-21 Thread Jephte CLAIN

Chris Withers wrote:
> You could just check for the permissions specifically, here's a quote
> from Folder.py in Zope 2.2:
Yes. though it seems odd to create permissions not protecting any method
that are just meant to be checked.
calling a method that the current user is not not allowed to access
raises Unauthorized for you. I can just check 'manually' the permission
if I want to display a specific message.

thanks for your comments
[EMAIL PROTECTED]

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




[Zope-dev] zpatterns-0.4.0a5: problem with unregistering transactionals

2000-07-26 Thread Jephte CLAIN

hello,

I have a case where Transactional._unregister is called without
Transactional._register being called, raising an exception in
Transaction._unregister and then in
ZODB.Transaction.Transaction.__del__, causing Zope to dump core when it
is run as a daemon (because python notifies of the unhandled exception
by writin to stderr)

I have not yet found why (and how?) an object is
Transactional._unregistered without being Transactional._registered
before. (I even did not know about the existence of these methods!) But
until I understand, this patch allow me to stay alive:

--- Transactions.py.origThu Jul 20 09:58:00 2000
+++ Transactions.py Wed Jul 26 11:12:25 2000
@@ -45,7 +45,8 @@
 self._v_registered = 1
 
 def _unregister(self):
-del self._v_registered
+try: del self._v_registered
+except: pass
 
 
 # From here down, override as you see fit...

more to come when I have the time to figure out the problem. it might be
a bug in zpatterns :-)

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 )




[Zope-dev] Re: zpatterns-0.4.0a5: problem with unregistering transactionals

2000-07-27 Thread Jephte CLAIN

Jephte CLAIN wrote:
> I have a case where Transactional._unregister is called without
> Transactional._register being called, raising an exception in
> Transaction._unregister and then in
> ZODB.Transaction.Transaction.__del__, causing Zope to dump core when it
> is run as a daemon (because python notifies of the unhandled exception
> by writin to stderr)
> 
> I have not yet found why (and how?) an object is
> Transactional._unregistered without being Transactional._registered
> before. (I even did not know about the existence of these methods!) But
> until I understand, this patch allow me to stay alive:

Ok, so ZPatterns.Transactional._unregistered method is called twice for
a ZPatterns.Transactional object when an exception is raised and the
ZPatterns.Transactional object has not be freed: once from the
ZODB.Transaction.abort method, once from the ZODB.Transaction.__del__
method which call abort if objects to be aborted remain in the zodb
transaction aware object
The call is made twice for DataSkins and for TransientMapping (as far as
I know, they are at the moment the only Transactional objects in
zpatterns)

for example, try this DTML code in a specialist:






without my patch, Zope should display 'uncatched exceptions in
Transation object'

so what now? I'm lost. Is this normal or not? Is my patch sufficient
(ignore attempts to abort the object twice by trapping exceptions in
_unregister). What about Transactional.abort which check for
tpc_entered? Why is tpc_entered never set to 0?

please help

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 )




Re: [Zope-dev] Re: zpatterns-0.4.0a5: problem withunregistering transactionals

2000-07-27 Thread Jephte CLAIN

"Phillip J. Eby" a écrit :
> 
> Question...  Are you on 2.1.x or 2.2?
I'm still on 2.1.6. I cannot afford a migration of my product now since
it is still in developpement and my customer wants it to work as soon as
possible.


> Also, in your example, tpc_entered
> is not set because tpc_entered is only true if the transaction commit
> process (tpc = two-phase commit) has been started.
I thought that tpc_entered would go back to 0 when the transaction is
over. It is clear that I don't know how the transaction machinery really
works.

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 )




Re: [Zope-dev] Re: zpatterns-0.4.0a5: problemwithunregistering transactionals

2000-07-27 Thread Jephte CLAIN

> Okay, that makes sense.  2.1.6 has a weirdness in the ZPublisher exception
> hook that begins a new transaction instead of aborting the old one cleanly,
I did notice this.

> and that ultimately causes the objects to get aborted twice.  I reported
> this a month or two ago and it got fixed in 2.2.
rahhh, is Zope 2.2 the only way to go? :-)

> You're going to have to
> go with your patch, though, because there's not a simple patch you can
> apply to 2.1.6 to fix the problem in Zope itself.  Unfortunately, it is
> hard for me to tell whether your patch has any other repercussions.  :(  I
> will try to review the structure of my Transactional class and see if there
> are any side effects (besides the one you've found) of an object being
> aborted twice.
Thanks a lot.
By the way, besides new features like skinscript and proxy settings, did
you fix any bugs from 0.4.0a5 in 0.4.1a5 that would make me have to
upgrade my current ZPatterns?

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 )




[Zope-dev] zpatterns: how to invalidate the attribute cache?

2000-08-10 Thread Jephte CLAIN

Hello,

I feel a need to invalidate a dataskin attribute cache after it has been
edited, because other objects might want to use the just modified
dataskin, but with the new values.
Of course, these values come from some attribute providers that should
be re-queried.

Any thoughts? It seems that the only way is to redefine _v_attrCache.
Please comment this patch:

--- DataSkins.py.orig   Thu Aug 10 17:20:53 2000
+++ DataSkins.pyThu Aug 10 17:21:47 2000
@@ -97,6 +97,11 @@
 """Return attribute cache"""
 return self._v_attrCache
 
+def _invalidateCache(self):
+"""invalidate the current attribute cache"""
+v = self._v_attrCache = {}
+return v
+
 def _v_readableSlot(self,_v_dm_=_v_dm_):
 return
self.__dict__[_v_dm_]._readableSlotFor(self) 

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 )




Re: [Zope-dev] zpatterns: how to invalidate the attributecache?

2000-08-21 Thread Jephte CLAIN

"Phillip J. Eby" wrote:
> I don't see a need for a mass invalidation operation, just more
> documentation on these inner workings.  :)

or the lack of an attribute depencies mechanism :-)
if attribute x depends on attribute y from another generic attribute
provider, invalidation of y doesn't make y to be recomputed.

___
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] first zope-2.3.0a2 bug :-)

2001-01-10 Thread Jephte CLAIN

well, this one is easy.

8<--
--- lib/python/Shared/DC/ZRDB/Aqueduct.py.origThu Jan 11 10:59:42
2001
+++ lib/python/Shared/DC/ZRDB/Aqueduct.py Thu Jan 11 10:58:01 2001
@@ -272,7 +272,7 @@
 
 
 custom_default_report_src=DocumentTemplate.File(
-os.path.join(dtml_dir,'customDefaultReport.dtml'))
+os.path.join(dtml_dir,'dtml/customDefaultReport.dtml'))
 
 def custom_default_report(id, result, action='', no_table=0,
   goofy=regex.compile('[^a-zA-Z0-9_]').search
8<--

without this patch, sql methods cannot we tested because
customDefaultReport cannot be found (it moved in the dtml subfolder)

___
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: AW: jcNTUserFolder

2001-06-12 Thread Jephte Clain

> Thank you for the tip with the access file.
> The remote user mode with challenge\response works
> perfect if I delete the Password of the access file.
>
> But, if I delete the Password of the access file I get a
Zope Error
> when I am not using the challenge\response mode.

that is the point :-)

As far as I know, it is not possible for Zope to run in
remote user mode and normal mode together (they are mutually
exclusive)

I think that the solution is to run two Zope instances in a
ZEO cluster (on the same machine), one which talks with PCGI
(and so is in remote user mode) and one which serves
directly the requests (and is not in remote user mode)

perhaps someone on the list can give his opinion (note that
i am not on the zope-dev list, so cc: any answer)

> The error gets raised in your NTUserFolder.py in line 79 (
return
> string.lower(login) )
> when login is None. (Anonymous login)
>
> I changed it to
>
> def _normalize(self, login):
> """normalize a login name.
> Currently, it is made lowercase
> """
> if login is None: #
modification
>   login = 'Anonymous User' #
modification
> return string.lower(login)
>
> This is a very ugly hack, but it works.
You normally cannot login directly with Zope if it is
running in remote user mode. At least, with your patch, one
can browse the site anonymously

regards,
[EMAIL PROTECTED]

> -Ursprüngliche Nachricht-
> Von: Jephte Clain [mailto:[EMAIL PROTECTED]]
> Gesendet: Freitag, 8. Juni 2001 14:25
> An: Roesch, Alexander
> Betreff: Re: jcNTUserFolder
>
>
> > we are using your product "jcNTUserFolder" in
> challenge/response mode
> > together with IIS on NT4 with Zope 2.2.2.
> > It works perfect.
> what version? is it 0.0.8 or 0.1.0?
>
> > Because of bugs in Zope 2.2.2 we want to migrate to Zope
> 2.3 and
> > "jcNTUserFolder 0.1.0"
> note that 0.1.1 have been released
>
> > I managed to set up the the NT User Folder as acl_user
> folder in the root
> > level.
> > Now I still have the problem that the users don't get
> recognized by zope.
> > They always get prompted for Username / Password /
domain.
> And even if they
> > apply the correct Username / Pwd / domain they get
> rejected.
> >
> > Could you give me a tip what is going wrong?
> I need your answer to above questions. if migrating from
> 0.0.x to 0.1.x, you have to follow the instructions given
on
>
http://www.zope.org/Members/jephte/jcNTUserFolder/installation
>
> note: for remote user mode to work with zope 2.3.x, you
> *must* have the access file. it is not installed by
default
> for Zope 2.3.x
>
> regards,
> [EMAIL PROTECTED]

__
Boîte aux lettres - Caramail - http://www.caramail.com




[Zope-dev] what transaction does get_transaction().commit() really commit?

2001-06-17 Thread Jephte Clain

hello,

I have a method that reads:

8<
def do_something(self):
 from Zope import DB
 conn = db.open()
 conn.root()['name'] = 'value'
 get_transaction().commit()
 conn.close()
8<

the method can be called from everywhere, and that's the
reason why I have to open a connection, in case one is not
available.

the question is: what transaction is commited with
get_transaction().commit() ? It is only the one associated
with the connection, or also the transaction in which is the
caller?
I mean, if my method is called from within Zope, is the
transaction of the caller commited?

thanks for any response
regards,
[EMAIL PROTECTED]

__
Boîte aux lettres - Caramail - http://www.caramail.com




[Zope-dev] Re: [Zope-Annce] jcNTUserFolder 0.2.1 released

2001-12-03 Thread Jephte CLAIN

"Jay, Dylan" wrote:
> Can I ask you a question? Something I;ve tried to do in the past with
> jcNTUserFolder (maybe not tried hard enough) is this. I want all my users to
> be authenticated via challenge-response mechanism such that no one has to
> enter a username or password.
> >From what I can work out jcNTUserFolder doesn't actually help with this at
> all, or have I missed something?
I wrote jcNTUserFolder just to do that, you know :-)
But, currently, you have to go through IIS. I think there is an howto on
http://www.zope.org/Members/jephte

I have tried to look at challenge/response authentication, but it is so
hard and so much undocumented I left it. it would require to change
Medusa (IIS and IE have a no-close connection when in challenge/response
mode. it seems it must be so at least for the challenge/response part of
the protocol; I suppose it would require too much time if they have to
authenticate on each connection :), and to change Zope (you don't have
the password, just a hash, that you must ask the PDC to validate for
you, unless someone know how the hash is generated), and to have a
compatible User Folder.

however, if someone can point me to a good source of documentation about
that, and some example code, I may want to give it a try again.

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 )



[Zope-dev] Re: [Zope-Annce] jcNTUserFolder 0.2.1 released

2001-12-03 Thread Jephte CLAIN

"Jay, Dylan" wrote:
> One way is to not replicate the challenge-response functionatlity at all.
this is the solution i have opted for. it has run now for two years :-)
the problem is Zope cannot be in remote user mode and in normal mode at
the same time. I think that setting up a zeo cluster (one zope instance
that is served through IIS, and is used to update content, and one which
has the normal behavior, and serves public content) could enable this,
but I haven't tried yet.

> Put Zope behind IIS in two spots. One which is protected and thus elicits a
> challenge/response and another that has IIS anoymous access on it. Then get
> the zope security machinery to alternate between the two urls depending on
> the security required.
please elaborate: you mean that when access to
http://iis.host.com/zope_anonymous.pcgi/protected_resource is forbidden,
zope automatically redirect the user to
http://iis.host.com/zope_protected.pcgi/protected_resource?

> Then all you need is remote user mode in Zope to work
> by allowing any remote user secure access. Perhaps remembering new
> REMOTE_USER's so further roles can be associated with them.
I don't understand :-(

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 )



[Zope-dev] Re: [Zope-Annce] jcNTUserFolder 0.2.1 released

2001-12-03 Thread Jephte CLAIN

"Jay, Dylan" wrote:
> There has to be some way round that. Is the REMOTE_USER variable still pased
> in even if zope isn't in remote user mode? Couldn't a user folder be
> implemented to use it?
nope.
REMOTE_USER is passed when the web server (IIS in our case) has done the
*authentication* and said: "ok, REMOTE_USER is the name of the user
coming in, and he's ok". then, zope just has to do *authorization*:
"does this user whose name is given has the correct role to acces that
ressource?"

> > please elaborate: you mean that when access to
> > http://iis.host.com/zope_anonymous.pcgi/protected_resource is 
> > forbidden,
> > zope automatically redirect the user to
> > http://iis.host.com/zope_protected.pcgi/protected_resource?
> Yes, that's exactly what I mean.
Hum, this is an idea to explore further. this is interesting.
and no, jcNTUserFolder does not do that right now.

> I guess what I'm talking about is a user folder implementation that uses the
> REMOTE_USER variable and contructs a user object around that. It assumes
> that IIS has done it's job and the this REMOTE_USER is allowed in.
this is exactly the default behavior.

> It looks to see if it's seen this user before. If not it creates the user with some
> default role.
this is interesting. in the default implementation, if the remote user
does not exist in the acl_users, it is considered anonymous.

> If the user does exist with the same name as REMOTE_USER then
> this user is used with all it's associated roles etc.
> 
> I had thought this is what jcNTUserFolder did but I couldn't get it to work
> like this. I think what it does do is try to authenticate directly with the
> nt domain server using a name and password supplied by the user?
jcNTUserFolder, like the standard one, behave differently in remote user
mode and in normal mode (actually, it does not modify the default
behavior):
- in normal mode, it tries to log the user on the local machine, and if
it can, it assumes that the username/password pair is valid, and then
let Zope do authorization
- in remote user mode, it does not authenticate because the REMOTE_USER
has already authenticated, and let Zope do authorization.

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 )



Re: [Zope-dev] a simple example of the ZPatterns frame work

2000-05-18 Thread Jephte CLAIN




"Phillip J. Eby" a écrit :
> 
> At 08:39 PM 5/17/00 +0400, Jepthte CLAIN wrote:
> >
> >I wonder if someone can send me a simple example using the ZPatterns
> >framework. I read all the source, and I still can't figure out what is
> >the relationship between the objects instantiated by the Racks and the
> >Rackmountable objects. Also, why do the rack try to instantiate a
> >ZClass???
> 
> When created, Racks create some default Attribute and Sheet providers.
> These objects are used by Rackmountables to access data which is not stored
> directly in the rackmountable.

Indeed, attribute and sheets are not stored in the rackmountable. Where
are they stored then? in the specialist? in the rack? reading the code
does not help to answer that question.

> 
> When used, Racks create instances of the ZClass you've specified.  If you
> call newItem(key), you will receive a new instance of that ZClass, which
> will be stored in the rack under the specified key.  Whenever you call
> getItem(key), the instance will be retrieved.  Some Racks, like
> GenericUserSource, do not store items in themselves, but in external
> databases.  When you call getItem(key) on a GUS, it calls methods to access
> the external database, then creates an instance of the appropriate
> LoginUser subclass and returns that.
> 
I don't like ZClasses, because I want to use XEmacs to edit my code.
In fact, I have trouble using a python class to store my data.

say I have in MyItem.py:

class MyItem(RackMountable, Item):
""
meta_type = 'My Item'

def __init__(self, id):
self.id = id
self.i = 0
self.s = ''

and in __init__.py, MyItem is registered as a z base class

i and s are properties my objects are going to store. I would like to
use MyItem objects until I am ready to move the data into an SQL
database, where i and s will be columns in a table.

The AttributeProvider (that my rack have by default) raise an exception
in MyItem.__init__ because i and s do not exist (indeed, I want to
create them in the instance!)

Also, say I want to add the OFS.ProperyManager.PropertyManager mixin
class to MyItem to manage my properties through the standard interface.
Will it clash with the sheet provider?

> Hope that helps; I'm not 100% clear on your question.
Anyway, my question was not 100% clear neither :-)

I'm not interested in the ZPatterns framework to allow my customers to
customize the data sources or the collaborators. I'm interested in it
because I want to develop code that is independant of the data sources.
I want to store some data in the ZODB (because they are python list and
dict, or because it is easier for me to use Zope objects until I move to
a SQL database), and some of them in an SQL database (because they might
be used by externals applications), but still want to have a common
interface to the data.
I'm still figuring out how it works, but once I'm done, I will rule the
world :-)

Thanks for your good work, and thanks for the advices!
regards,
jephte clain
[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] a simple example of the ZPatterns frame work

2000-05-18 Thread Jephte CLAIN

"Phillip J. Eby" wrote:



> >The AttributeProvider (that my rack have by default) raise an exception
> >in MyItem.__init__ because i and s do not exist (indeed, I want to
> >create them in the instance!)
> 
> Could you give the traceback?  I think it is more likely your __init__ is
> failing because you are setting self.id.  You should not set self.id
> directly in your __init__ method, you should call RackMountable's __init__
> method like this:
> 
Thanks for the insight. It is a pity that I can't write e-mail from
where I work. When I'm back to the office, I will cut and paste the
traceback and send it to you tomorrow. I hope it will be useful.

You probably noticed that when you are at work, it's time to sleep for
me.
see you tomorrow :-)

we-should-definitely-have-36-hours-a-day-ly yours,
Jephte CLAIN
[EMAIL PROTECTED]

begin:vcard 
n:CLAIN;Jephte
x-mozilla-html:FALSE
version:2.1
email;internet:[EMAIL PROTECTED]
adr;quoted-printable:;;71 rue Lory les Hauts=0D=0AAppt 16;Ste Clotilde;;97490;
x-mozilla-cpt:;0
fn:Jephte CLAIN
end:vcard



[Zope-dev] ZPatterns framework improvements

2000-05-19 Thread Jephte CLAIN

sorry, I can't reproduce the error I talked about yesterday. All the
insights given by philip has lighted up my path :-)
There are four points I want to discuss:

***
Some thought about RackMountables: they should subclass
Acquisition.Implicit for bobotraversing to work. indeed, the
__bobo_traverse__ code says:

return getattr(ob, 'aq_base', ob).__of__(self)

ob has the __of__ attribute only if it subclass an extension class
(Acquisition.Implicit is an easy choice)

***
in AttributeProviders.py, around line 199, definition of
_DelAttributeFor is bogus. Instead of:

def _DelAttributeFor(self,client,name):
return self.aq_parent.aq_parent._SetAttributeFor(client,name)

it should read:

def _DelAttributeFor(self,client,name):
return self.aq_parent.aq_parent._DelAttributeFor(client,name)

***
It is desirable for me to enumerate the objects stored in the racks for
a specialist. Because the __readableStorage is not accessible from
derived classes (magic of ExtensionClasses ???), I can't add that
behavior without patching Rack.py

I'm thinking of a method 'rsValues' that enumerate values in the
readableStorage. In Rack.Rack:

def rsValues(self):
"""rsValues like 'readableStorageValues'
why on earth are there __readableStorage and __writableStorage ???
"""
values = []
slots = self.__readableStorage.values()
for slot in slots:
# the following took from retrieveItem
item = slot[SelfKey]
item._setSlot(slot)
item._clearPerTransactionCache()
# associate the rack to the item
item._setRack(getattr(self, 'aq_inner', self))
## the above line could be written
# item._setRack(self.aq_inner)
## if racks objects where always wrapped.
values.append(item)
return values

Or is it best to create a catalog in the specialist that index all
objects stored in the rack as they get added?
The default ZODB storage should give the ability to enumerate the
objects, even if it does not belong to the standard "interface" of the
rack.

***
I understand now that the RackMountable is only a placeholder class, and
that attributes and sheets are managed by AttributeProviders and
SheetProviders, right?

any comments?
jephte clain
[EMAIL PROTECTED]

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




Re: [Zope-dev] ZPatterns framework improvements

2000-05-19 Thread Jephte CLAIN

"Phillip J. Eby" a écrit :
> Good point, but ordinarily one mixes RackMountable with another Zope class
> such as SimpleItem.Item, or uses it as part of a ZClass.  In either case,
> Acquisition gets added in.
SimpleItem.Item only subclasses ExtensionClass.Base, and I got an
AttributeError on __of__ unless my RackMountable subclasses
Acquisition.Implicit also. bizarre isn't it?

> I'm not actually real fond of the DDO term, because "Dynamic Data Object"
> doesn't quite do justice to what these things actually are.  I am
> definitely open to suggestions for a better name.  (Facade?  PlaceHolder?
> InsideOutObject?  ExternalDataObject?  BrainInjectedObject?)
what about "penguin" ? :-)

> Also, while I'm babbling about versions, it's important to note at this
> point that ZPatterns versions below 1.0.0 should be considered subject to
> change even with respect to developer-level API's.  They get more stable as
> the number gets higher, which is why LoginManager changed a lot less
> between 0.8.0 and 0.8.5 than half as much as ZPatterns changed between
> 0.2.0 and 0.3.0.  The change to 0.4.0 will probably be another big jump,
> due to the DDO stuff as well as the Indexes stuff.  Predicates may even
> make it in, in some small way.
Have you got an idea of when 0.4.0 will ship ?

regards,
jephte clain
[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] catlogged specialist and rack

2000-05-22 Thread Jephte CLAIN

Hello,

for those who are in a need for search and enumeration capabilities for
specialist and racks in ZPatterns-0.3.0 right now like I am, the
following could be interesting.

Searchable.py defines:
CatalogAwareAttributeProvider,
CatalogAwareAcquiredAttributeProvider
Attribute providers that recatalog the object when its attributes are
changed

CatalogAwareRack
Rack that has a catalog inside it, and index the object created with
newItem, and modified afterward.
by default, only the id is catalogged. this can be changed in _setup
for derived classes

CatalogAwareSpecialist
Specialist that has support for CatalogAwareRack. A tab 'Contents'
provide support for enumerating the objecs in the racks. www/contents
can be customized to allow, editing, adding, and/or deleting objects if
you like.

This, in fact, is a quick hack. remember that all these will be useless
when ZPatterns-0.4.0 is out. But I'm fool enough to use evolving
software still in infant stage...

hope this is useful like it is for me.

regards,
jephte clain
[EMAIL PROTECTED]
 Searchable.tgz


[Zope-dev] how to download a entire ZWiki site?

2000-05-22 Thread Jephte CLAIN

Hello,
Where I work, I do not have access to the internet, and as such, I have
to move software and docs back and forth to my office. I understand that
it is better for collaborative work to use ZWikis, but I wonder, how do
I download the entire site to view it offline???

ok this is not really zope-dev, but I need the wikis to zope-develop...

thanks,
jephte clain
[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 download a entire ZWiki site?

2000-05-23 Thread Jephte CLAIN

Dieter Maurer a écrit :
> 
> You may try the python tool program "websucker". It should
> be in the tools directory of any Python installation.
> It can download any pages below a side.
I use wget
but websuckers don't work well with dynamically generated pages like
wikis. it download several times the same page because they have
different url

___
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: rackmountables must be of-wrapped

2000-05-24 Thread Jephte CLAIN

Hello,

I believe items got from a rack have to be wrapped in context of the
rack. I've been bitten by this (and it hurts!). When I try to use items
from DTML, only the superuser can use it, even managers can't access the
objects. When I wrap the items in the context of the rack, everything is
fine.
So: retrieveItem, createItem use vanilla objects
getItem, newItem wrap objects before returning them

regards,
jephte clain
[EMAIL PROTECTED]

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




Re: [Zope-dev] zpatterns: rackmountables must be of-wrapped

2000-05-25 Thread Jephte CLAIN

"Phillip J. Eby" a écrit :
> >So: retrieveItem, createItem use vanilla objects
> retrieveItem and createItem are not intended to be public methods; the only
> reason they don't begin with an "_" is that I wanted to make it possible
> for them to be implemented as DTMLMethods or PythonMethods.
you missed the point. I wasn't that clear neither ;-)

I know that retrieveItem and createItem are not public API, and are
meant to be overidable.
I believe that telling the rackmountable what rack it belongs to in
getItem and newItem it not sufficient. It has to be wrapped in the
context of the rack with something like:

# this works for me
item = self.retrieveItem(key)
if item is not None:
item._setRack(self.aq_inner)
return item.__of__(self) # keep other acquisition wrappers,
# no need to get aq_inner

or:

# untested
item = self.retrieveItem(key)
if item is not None:
rack = self.aq_inner
item._setRack(rack)
return item.__of__(rack)

When I don't wrap items like this, I get strange unauthorized errors.
Only the super user can use the items. All the other users (Managers or
not) can't.

Remember that I use python classes as rack-mountables, and they don't
get the fancy acquisition wrapping that zclasses get.

regards,
jephte clain
[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 download a entire ZWiki site?

2000-05-25 Thread Jephte CLAIN

Gregor Hoffleit a écrit :
> Hmm, offline browsing and Wikis don't mix very well.
> 
> For structured wikis, I had some success with wget, grabbing the root
> "Entire wiki Contents" page like this:
> 
>   wget -r -l1 http://www.zope.org/Products/PTK/ZWiki/FrontPage/map
This is the one that I needed, at least. Thanks!
I use wget too. but I missed the right options.

this is a short term measure, of course, but it will get me started.
regards,
jephte clain
[EMAIL PROTECTED]

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




[Zope-dev] zpatterns: win32 dll for DynPersist?

2000-05-25 Thread Jephte CLAIN

Hello,

Has someone compiled the DynPersist dll for win32?
if someone has done so, it would be glad to send me a copy by tomorrow.
it will help me greatly.

TIA,
jephte clain
[EMAIL PROTECTED]

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




[Zope-dev] zpatterns-0.4 ?

2000-06-06 Thread Jephte CLAIN

Hello,

I have used ZPatterns-0.3.0 to complete a project that I shipped
yesterday.
Although I had to write a CatalogAwareRack/Specialist to allow me to
search for rackmountables, I can say that ZPatterns has saved my life! I
would like to thanks Philip for this great contribution. (too bad I no
longer remember the url of that site where you can send so-called
"virtual beers" to fellows on the internet :-))

Now, for a project I have to ship by the end of june, I would like to
use zpatterns-0.4.0. I especially want to use the new search interface.
Does Philip know when ZPatterns-0.4.0 is out? If it is until the middle
of june, I can certainly wait. In the other case, I wonder if the search
plugin (in the case it has already be written) can be used with
zpatterns-0.3. In that case, I can do the work of adapting the code to
zpatterns-0.3
Also, for that project, I will have to write a sql attribute provider.
If one can give me advices on how Ty wants to implement SQL Attribute
Provides after he's done with LDAP Attribute Provider, perhaps I can
start the work (since I have a use for it) and let Ty continue the work
when he has more time / have finished LDAP Attribute Provider. I already
have some ideas on how to do it, but I lack to view how far the concept
have to be pushed. Without any help, I will end up writing a SQL
Attribute Provider that work only for me...

regards,
jephte clain
[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] DA for postgresql?

2000-06-20 Thread Jephte CLAIN

Hello,

Can anyone tell me about the various Postgresql DA currently available?
I don't know which to take between ZPoPyDA and ZPyGreSQLDA. I installed
both of them, and I can't tell the difference between the two...

This will be for a production server. Is PostgreSQL a good choice?
Actually, I don't have the choice -- I have to use PostgreSQL.

thanks for any input

regards,
jephte clain
[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] DA for postgresql?

2000-06-20 Thread Jephte CLAIN

[EMAIL PROTECTED] wrote:
> PostgreSQL should be fine.  A bit slow still, but getting better.
> There is a tuple size limitation, watch that.
What do you exactly mean by 'tuple' ? Suppose I write a query like this:

select * from mytable where value in (1, 2, 3)

the (1, 2, 3) part is autogenerated. It could be, say, 128 terms long.
Is this what you are talking about when you say 'tuple' ?

> Besides, Thierry is French!
cocorico! :-)

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