Re: [Zope-dev] _p_deactivate() and _v_ variables?

2003-10-09 Thread Toby Dickenson
On Thursday 09 October 2003 14:01, Florent Guillaume wrote:

> > I agree with this. How do we go about find code that uses the assumption
> > that _v_ stuff won't change unless it's at a transaction boundary?
>
> Note that we had a problem related to this with a client recently: In
> CMF, skin data is stored in portal._v_skindata, and is actually needed
> for the whole request, but in some ZEO setting this go cleared by a
> get_transaction().commit(1) which was unexpected and led to breakage
> because in that batch treatment we used some skin methods too...

Something after the subtransaction commit must be tickling the cache garbage 
collector. Thats generally what subtransactions are used for.

A while ago there was a discussion on zodb-dev about _v_-like attributes that 
would be automatically cleared at the end of a transaction. Do we need 
something similar that guarantees it will _not_ be cleared until the end of 
the transaction?

-- 
Toby Dickenson


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


Re: [Zope-dev] relations in objects

2003-10-09 Thread Jason Corbett
  I'm sorry for my ignorant use of the terms relation
and relationship.  I'll try to use the terms more
appropriately in the future.

  I think I understand where I've become confused.  In
many of the persistance mechanisms I've looked at
references to other objects were handled specially,
and had rules associated with them.  I think I
understand now that it is mearly just a design
problem, nothing having to do with zope.  When
creating objects I will need to pass the reference to
the other object, or have a manager for the
relationship.

  I had assumed that objects were somehow self aware
in some way of the zope environment, and therefore
coule access it.  I appologize for any time I might
have wasted.  The solution is simpler than I had
thought.

Jason Corbett

--- Leonardo Rochael Almeida <[EMAIL PROTECTED]> wrote:
> On Fri, 2003-10-10 at 00:46, Jason Corbett wrote:
> > Thanks for your reply.  I've actually been
> thinking in
> > an object oriented form for a while.  I've looked
> at
> > implimenting this project in Java using either
> > prevailance or a object persistence model that
> mapped
> > to a RDBMS.  I like the idea of zope, so maybe I
> > should clarify my question:
> > 
> > How does an object in zope know where it sits in
> the
> > hirearchy, and how does it reach other objects. 
> > That's what I'm really looking for, I can probably
> > code the rest of the parts.
> 
> In my experience, you should put an object inside
> another if and only if
> they have an explicit containment relationship, e.g.
> a car has 4 tires
> and a steering wheel. The steering wheel can belong
> to (at most) one car
> at any moment in time, so it would make sense to put
> the steering wheel
> object inside the car object. The same is not true
> of, for instance,
> students and school classes. In this case you either
> store a reference
> to the student in the school class (eg a student id
> in a "lines" or
> "tokens" property) or you create an object to
> represent the
> class-student relationship (for example an
> enrollment) and store it
> somewhere.
> 
> Tip: always use methods that return the objects you
> need, for instance
> aSchoolClass.students() this way you can more easily
> change the storage
> of the relationship information when you change your
> mind. And you will
> change your mind a lot of times.
> 
> Tip2: a lot of times you'll implement the above
> mentioned methods as
> catalog queries, like: what objects in the other
> side of the
> relationship reference me?
> 
> Tip3: look mxmRelations
> 
> Cheers, Leo
> 
> PS: just because this is a pet peeve of mine, I'll
> explain that a
> "relation" and a "relationship" are two very
> different things.
> "Relation" is the mathematical term for a table, a
> set of distinct
> elements (rows) with the same kinds of attributes
> (columns). You can
> think of a relation (table) of cars, or a relation
> (table) of students.
> Relational databases get their names because they
> store relations and
> allow you to do some relational algebra with
> (usually) SQL.
> 
> A relationship, on the other hand, is a link, or
> association, between
> elements.
> 
> RDBs allow you to model relationships relatively
> easily thru either
> relational operations:
> 
> SELECT * from cars, steering_wheels
> WHERE steering_wheels.carId = car.carId AND
> steering_wheels.wheelType = "sport"
> 
> or by storing relationship information in relations
> (sometimes known as
> "link relations" or "link tables"):
> 
> SELECT * from enrollments, classes, students
> WHERE classes.classId = enrollments.classId
> AND
> enrollments.studentId =
> students.studentId AND
> students.studentName = "Jason Corbett"
> 
> But RDBs themselves have absolutely no concept of
> "relationships".
> 
> So, next time you read the word "relation", think
> "table" :-)
> 


__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Re: [Zope-dev] relations in objects

2003-10-09 Thread Leonardo Rochael Almeida
On Fri, 2003-10-10 at 00:46, Jason Corbett wrote:
> Thanks for your reply.  I've actually been thinking in
> an object oriented form for a while.  I've looked at
> implimenting this project in Java using either
> prevailance or a object persistence model that mapped
> to a RDBMS.  I like the idea of zope, so maybe I
> should clarify my question:
> 
> How does an object in zope know where it sits in the
> hirearchy, and how does it reach other objects. 
> That's what I'm really looking for, I can probably
> code the rest of the parts.

In my experience, you should put an object inside another if and only if
they have an explicit containment relationship, e.g. a car has 4 tires
and a steering wheel. The steering wheel can belong to (at most) one car
at any moment in time, so it would make sense to put the steering wheel
object inside the car object. The same is not true of, for instance,
students and school classes. In this case you either store a reference
to the student in the school class (eg a student id in a "lines" or
"tokens" property) or you create an object to represent the
class-student relationship (for example an enrollment) and store it
somewhere.

Tip: always use methods that return the objects you need, for instance
aSchoolClass.students() this way you can more easily change the storage
of the relationship information when you change your mind. And you will
change your mind a lot of times.

Tip2: a lot of times you'll implement the above mentioned methods as
catalog queries, like: what objects in the other side of the
relationship reference me?

Tip3: look mxmRelations

Cheers, Leo

PS: just because this is a pet peeve of mine, I'll explain that a
"relation" and a "relationship" are two very different things.
"Relation" is the mathematical term for a table, a set of distinct
elements (rows) with the same kinds of attributes (columns). You can
think of a relation (table) of cars, or a relation (table) of students.
Relational databases get their names because they store relations and
allow you to do some relational algebra with (usually) SQL.

A relationship, on the other hand, is a link, or association, between
elements.

RDBs allow you to model relationships relatively easily thru either
relational operations:

SELECT * from cars, steering_wheels
WHERE steering_wheels.carId = car.carId AND
steering_wheels.wheelType = "sport"

or by storing relationship information in relations (sometimes known as
"link relations" or "link tables"):

SELECT * from enrollments, classes, students
WHERE classes.classId = enrollments.classId AND
enrollments.studentId = students.studentId AND
students.studentName = "Jason Corbett"

But RDBs themselves have absolutely no concept of "relationships".

So, next time you read the word "relation", think "table" :-)


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


Re: [Zope-dev] relations in objects

2003-10-09 Thread Jason Corbett
Thanks for your reply.  I've actually been thinking in
an object oriented form for a while.  I've looked at
implimenting this project in Java using either
prevailance or a object persistence model that mapped
to a RDBMS.  I like the idea of zope, so maybe I
should clarify my question:

How does an object in zope know where it sits in the
hirearchy, and how does it reach other objects. 
That's what I'm really looking for, I can probably
code the rest of the parts.

Jason Corbett


--- [EMAIL PROTECTED] wrote:
> Hi Jason,
> 
> I am not a zope developer, I am a semi-new user who
> started with zope
> coming from the same mindset as yourself. One of the
> biggest challanges(at
> least for me) is to wrap your mind around object
> oriented programming. The
> zope database is an object oriented database. This
> means that you will
> want/need to design your product differently than if
> you were using
> mysql/php to present and store your data. Think of
> the information you
> want to track as real world objects, and it is. Then
> think about how these
> real world objects relate to one another. You will
> start to see a pattern.
> Use this pattern to create a hierarchical
> folder(object) structure. This
> structure along with python's object inheritance
> will allow you to develop
> your relationships. Play with zope. Write your
> product. Discover that you
> need to rewrite your product because you did not
> understand some
> fundamentals. Complete the rewrite. Rinse and repeat
> until you get it
> right.
> 
> Cheers,
> Mike
> 
> > Hello Zope developers,
> >
> >   I'm a newbie (sorry most people have this curse
> at
> > one point or another).  I have read the zope book
> (or
> > at least most of it), and the zope developer
> manual.
> > I can't quite figure out how to have relationships
> > between instances of classes in the database.
> >
> >   Let me first ask if I'm using zope for the
> correct
> > thing.  I see that a lot of zope products deal
> with
> > content management, while mine doesn't really.
> > Basically I want to do what I would normally do
> with
> > mysql and php, but use zope instead.  So I need a
> way
> > to reference in some intelligent way between
> objects
> > in zope, and I need a way to query for a list of
> them.
> >
> >   I read about ZCatalogs, etc and how you can use
> that
> > for querying and indexing.  That isn't my first
> > priority, so I'll worry about that a little later.
> >
> >   Basically I have an instance of a class 'A'.  As
> > part of it I need to reference either a single or
> in
> > some cases multiple instances of class 'B'. 
> Basically
> > I'll have a mix of one-to-one relations and
> > one-to-many.  When I'm coding my python class (I'm
> > going to do a product if you can't tell), how
> would I
> > get a list of the 'B' instances that relate to
> this
> > object, and how would I store that?  The zope
> > developer manual was pretty good for writing
> classes,
> > and making views on it, but I need to be able to
> call
> > methods on those instances and return lists of
> them.
> >
> >   Sorry for the long email, I just don't want to
> leave
> > details out.  If you think I'm barking up the
> wrong
> > tree, and shouldn't be using zope for this, don't
> be
> > afraid to let me know.  Although I will be pretty
> > disappointed, I think zope is exactly what I've
> been
> > looking for, I can't find anything like it in any
> > other language.
> >
> > Jason Corbett
> >
> > __
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product
> search
> > http://shopping.yahoo.com
> >
> > ___
> > Zope-Dev maillist  -  [EMAIL PROTECTED]
> > http://mail.zope.org/mailman/listinfo/zope-dev
> > **  No cross posts or HTML encoding!  **
> > (Related lists -
> > 
> http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope )
> >
> 


=
.   _ ___   
   /  __//  /  (_)__  __   __
  /  /_/ __  / /__/ / _ \/ // /\ \/ /   
 /_//_/ //_/_//_/\_,_/ /_/\_\  
 /_/ === 
   Caldera OpenLinux

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Re: [Zope-dev] relations in objects

2003-10-09 Thread mlong
Hi Jason,

I am not a zope developer, I am a semi-new user who started with zope
coming from the same mindset as yourself. One of the biggest challanges(at
least for me) is to wrap your mind around object oriented programming. The
zope database is an object oriented database. This means that you will
want/need to design your product differently than if you were using
mysql/php to present and store your data. Think of the information you
want to track as real world objects, and it is. Then think about how these
real world objects relate to one another. You will start to see a pattern.
Use this pattern to create a hierarchical folder(object) structure. This
structure along with python's object inheritance will allow you to develop
your relationships. Play with zope. Write your product. Discover that you
need to rewrite your product because you did not understand some
fundamentals. Complete the rewrite. Rinse and repeat until you get it
right.

Cheers,
Mike

> Hello Zope developers,
>
>   I'm a newbie (sorry most people have this curse at
> one point or another).  I have read the zope book (or
> at least most of it), and the zope developer manual.
> I can't quite figure out how to have relationships
> between instances of classes in the database.
>
>   Let me first ask if I'm using zope for the correct
> thing.  I see that a lot of zope products deal with
> content management, while mine doesn't really.
> Basically I want to do what I would normally do with
> mysql and php, but use zope instead.  So I need a way
> to reference in some intelligent way between objects
> in zope, and I need a way to query for a list of them.
>
>   I read about ZCatalogs, etc and how you can use that
> for querying and indexing.  That isn't my first
> priority, so I'll worry about that a little later.
>
>   Basically I have an instance of a class 'A'.  As
> part of it I need to reference either a single or in
> some cases multiple instances of class 'B'.  Basically
> I'll have a mix of one-to-one relations and
> one-to-many.  When I'm coding my python class (I'm
> going to do a product if you can't tell), how would I
> get a list of the 'B' instances that relate to this
> object, and how would I store that?  The zope
> developer manual was pretty good for writing classes,
> and making views on it, but I need to be able to call
> methods on those instances and return lists of them.
>
>   Sorry for the long email, I just don't want to leave
> details out.  If you think I'm barking up the wrong
> tree, and shouldn't be using zope for this, don't be
> afraid to let me know.  Although I will be pretty
> disappointed, I think zope is exactly what I've been
> looking for, I can't find anything like it in any
> other language.
>
> Jason Corbett
>
> __
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
>


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


Re: [Zope-dev] relations in objects

2003-10-09 Thread Paul Winkler
On Thu, Oct 09, 2003 at 05:07:28PM -0700, Jason Corbett wrote:
> to reference in some intelligent way between objects
> in zope, and I need a way to query for a list of them.

google for mxmRelations.  It does many-to-many
relationships so yuo might have to modify it a bit
if you really need to constrain that.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's THE MAN!
(random hero from isometric.spaceninja.com)

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


Re: [Zope-dev] Initial ZODB permissions

2003-10-09 Thread Leonardo Rochael Almeida
On Wed, 2003-10-08 at 18:45, Andy McKay wrote:
> > Yeah, wrong but toothless. Feel free to fix on appropriate branches I 
> > guess :-)
> 
> Well yeah but Im betting its there for a reason, I just dont know what 
> it is yet. Changing that is sure to break something...

The best I could find out is this snippet in Zope 2.6.2 CHANGES.txt

 - A new permission "Copy or Move" was added.  This permission
   may be used respective to an object to prevent objects
   from being copyable or movable while within the management
   interface.  The "old" behavior stipulated that users whom
   possessed the "View management screens" permission to an object's
   container could copy or move the object arbitrarily, even if they
   had limited access to the object itself.  Once the object was
   moved or copied, the user became the owner of the new object,
   allowing them to see potentially sensitive information in
   the management interface for the object itself.  This permission
   is granted to Manager and Anonymous by default, and must be
   revoked on an object-by-object basis if site managers intend
   to provide management screen access to folders which contain
   sensitive subobjects.  This patch came as a result of
   Collector #376 (thanks to Chris Deckard).

Cheers, Leo


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


[Zope-dev] relations in objects

2003-10-09 Thread Jason Corbett
Hello Zope developers,

  I'm a newbie (sorry most people have this curse at
one point or another).  I have read the zope book (or
at least most of it), and the zope developer manual. 
I can't quite figure out how to have relationships
between instances of classes in the database.

  Let me first ask if I'm using zope for the correct
thing.  I see that a lot of zope products deal with
content management, while mine doesn't really. 
Basically I want to do what I would normally do with
mysql and php, but use zope instead.  So I need a way
to reference in some intelligent way between objects
in zope, and I need a way to query for a list of them.

  I read about ZCatalogs, etc and how you can use that
for querying and indexing.  That isn't my first
priority, so I'll worry about that a little later.

  Basically I have an instance of a class 'A'.  As
part of it I need to reference either a single or in
some cases multiple instances of class 'B'.  Basically
I'll have a mix of one-to-one relations and
one-to-many.  When I'm coding my python class (I'm
going to do a product if you can't tell), how would I
get a list of the 'B' instances that relate to this
object, and how would I store that?  The zope
developer manual was pretty good for writing classes,
and making views on it, but I need to be able to call
methods on those instances and return lists of them.

  Sorry for the long email, I just don't want to leave
details out.  If you think I'm barking up the wrong
tree, and shouldn't be using zope for this, don't be
afraid to let me know.  Although I will be pretty
disappointed, I think zope is exactly what I've been
looking for, I can't find anything like it in any
other language.

Jason Corbett

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Re: [Zope-dev] _p_deactivate() and _v_ variables?

2003-10-09 Thread Dieter Maurer
Chris Withers wrote at 2003-10-8 21:22 +0100:
 > Casey Duncan wrote:
 > 
 > > I would argue that a better plan would be to only use _v_ vars for completely 
 > > disposable data only. The application should expect that this values will be 
 > > gone at any random time, not just at transaction boundaries.
 > 
 > I agree with this. How do we go about find code that uses the assumption that 
 > _v_ stuff won't change unless it's at a transaction boundary?

This will invalidate many current uses:

  *  use for database connections

  *  use for skin data

  *  ...


Dieter

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


[Zope-dev] Creative Commons Support

2003-10-09 Thread Wouter Vanden Hove
Are there any plans or is there any interest in supporting the Creative
Commons Licenses for metadata in Zope-documents?
Has there ever been any talk of such a product?

Examples of applications with built-in CC support:
http://creativecommons.org/technology/ccapps


Greets,
Wouter Vanden Hove
www.open-education.org




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


Re: [Zope-dev] _p_deactivate() and _v_ variables?

2003-10-09 Thread Florent Guillaume
> > I would argue that a better plan would be to only use _v_ vars for completely 
> > disposable data only. The application should expect that this values will be 
> > gone at any random time, not just at transaction boundaries.
> 
> I agree with this. How do we go about find code that uses the assumption that 
> _v_ stuff won't change unless it's at a transaction boundary?

Note that we had a problem related to this with a client recently: In
CMF, skin data is stored in portal._v_skindata, and is actually needed
for the whole request, but in some ZEO setting this go cleared by a
get_transaction().commit(1) which was unexpected and led to breakage
because in that batch treatment we used some skin methods too...

We ended up calling portal.setupCurrentSkin() after the commit() to
reset the skins.

FYI.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:[EMAIL PROTECTED]

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


Re: [Zope-dev] Initial ZODB permissions

2003-10-09 Thread Chris Withers
Andy McKay wrote:

Yeah, wrong but toothless. Feel free to fix on appropriate branches I 
guess :-)
Well yeah but Im betting its there for a reason, I just dont know what 
it is yet. Changing that is sure to break something...
Well, do it and I'm sur we'll soon find out :-)

Chris

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