[Zope] How do You guys manage integrity in Zope
   
    Oliver Bleutgen
     
    Oliver Bleutgen <myzope@gmx.net>
       
    Mon, 2 Apr 2001 12:22:01 +0200
    
    
  
> i have made a few sites in Zope by now, and I often have problems with
> integrity in the database.
> Ie. with a structure like this:
>     users
>         user1
>         user2
>         user3
>         ...
>     articles
>         article1
>         article2
>         article3
> If I have an author field in "article1" that is the id of "author2" and I
> then delete "author2" I get an error when trying to get the authors
> properties like e-mail, name etc.
> Off course I can test to see if the author exists before trying to pull
> out
> the data, but this seems like a messy way to do it.
> How do the rest of you guys solve this problem? Is zPatterns nessecary?
What do you want to achieve?
- The equivalent of foreign keys in relational Databases,
  for instance the automatic deletion of article1 if article1.author2 == 'user1'
  when you delete user1?
  Then I would use a completely different structure than the one above,
  perhaps a zclass which is instanciated for every  author and can contain articles.
- Or do you just want zope not to throw an exeption if ._[author2] doesnt exist?
  Then it should be possible to write a small method which emulates 
  <dtml-var my_variable missing> for variables which contain the id of an object.
  (The functional analogon to the not working <dtml-var "_[my_variable]" missing>).
  So you can do <dtml-var "test_and_return_email(author=author_1)">
cheers,
oliver