Advice on a One-to-Many relationship for Zope Object
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees. If anyone can point me on how to achieve this, I'll be most greatfull Cheers Norm zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz/********/z/****\zzz|****\*\zz|*******|z z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz zz/******/zz\******/zz|*|zzzzzzz|*|*****|z z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz -----BEGIN PGP SIGNATURE----- Version: PGP 7.0.4 iQA/AwUBPxYvY3GyKIoODyswEQJrfgCfZuUGEoUbk8jRaNP5WOIgH+oEXYoAnAr/ YtjjTqZNoU3R8Mt6nehF6NS/ =H7mL -----END PGP SIGNATURE-----
Using a RDBMS`? -aj --On Donnerstag, 17. Juli 2003 6:08 Uhr +0100 Norman Khine <khine@o-a-l.net> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
Cheers
Norm
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz/********/z/****\zzz|****\*\zz|*******|z z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz zz/******/zz\******/zz|*|zzzzzzz|*|*****|z z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
-----BEGIN PGP SIGNATURE----- Version: PGP 7.0.4
iQA/AwUBPxYvY3GyKIoODyswEQJrfgCfZuUGEoUbk8jRaNP5WOIgH+oEXYoAnAr/ YtjjTqZNoU3R8Mt6nehF6NS/ =H7mL -----END PGP SIGNATURE-----
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yes, I know that I am already using Postgre, but I want to learn how it can be done in the OO database. Cheers - -----Original Message----- From: Andreas Jung [mailto:andreas@andreas-jung.com] Sent: 17 July 2003 06:20 To: Norman Khine; Zope Subject: Re: [Zope] Advice on a One-to-Many relationship for Zope Object Using a RDBMS`? - -aj - --On Donnerstag, 17. Juli 2003 6:08 Uhr +0100 Norman Khine <khine@o-a-l.net> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
Cheers
Norm
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz/********/z/****\zzz|****\*\zz|*******|z z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz zz/******/zz\******/zz|*|zzzzzzz|*|*****|z z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
-----BEGIN PGP SIGNATURE----- Version: PGP 7.0.4
iQA/AwUBPxYvY3GyKIoODyswEQJrfgCfZuUGEoUbk8jRaNP5WOIgH+oEXYoAnAr/ YtjjTqZNoU3R8Mt6nehF6NS/ =H7mL -----END PGP SIGNATURE-----
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-----BEGIN PGP SIGNATURE----- Version: PGP 7.0.4 iQA/AwUBPxZTY3GyKIoODyswEQJ3sgCgxyonrG9WFVIFB5BlMd70q3oih4AAoIWL Snw46twFfsQZrjO6moZzOYCw =TFIw -----END PGP SIGNATURE-----
Norman Khine wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
Here's my 25 cents: Can't you just use a list in the "one" object with referense by object paths to the "many" objects. You might also need an API that can fetch the related object, add and remove related objects and a mechanism that updates the object paths if the objects are moved. If you don't want to use object paths you need to create a unique id generator that gives all object a unique id. (Some thing like this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/163604) Or you might want to use intergers, which would be exective if you ever want to use join and unions etc. from IIBTree. I you don't use paths you need a ZCatalog (or similar central registry) to map UID to location. The many list can also be indexed by the ZCatalog as a keyword index, which lets you query for things like all object refering to object B. Many-to-many relations could be implented in the same way, with on list at each side, but a link would only be valid if both sides have the link so you need an API that enforces that requirement. -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
On Wednesday 16 July 2003 11:38 pm, Johan Carlsson wrote:
Norman Khine wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
Here's my 25 cents:
Can't you just use a list in the "one" object with referense by object paths to the "many" objects.
You might also need an API that can fetch the related object, add and remove related objects and a mechanism that updates the object paths if the objects are moved.
If you are working at the python product level you can also store a direct reference to the other object so long as it is a persistent object. That works very well also but for safety I also have mine store information necessary to get that link back if it gets data back that it does not expect. It works very well in my experience so far and has allowed me to cut db size a lot since you can use it to implement shared objects. This method is nice in that it works transparently for people used to python since you just access the object normally. If you have an error condition you then handle that.
kosh wrote:
If you are working at the python product level you can also store a direct reference to the other object so long as it is a persistent object. That works very well also but for safety I also have mine store information necessary to get that link back if it gets data back that it does not expect. It works very well in my experience so far and has allowed me to cut db size a lot since you can use it to implement shared objects.
This method is nice in that it works transparently for people used to python since you just access the object normally. If you have an error condition you then handle that.
I suppose you store the object as attributes? or do you store it as a list/tuple? What happens with acquisision and acquision related stuff like permissions? -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM
I'm having trouble understanding how Zope accepts, processes and transfers character data - or more precisely what the character-set rules and pitfalls are in a workflow in which . writers work in Word (or something) . copy is pasted or typed into a Zope form field via a rich-text browser widget . the field is filtered (to remove Word-HTML junk markup and characters we know might blow up MySQL) via a Python external method . into (non-UTF) MySQL . and back into a zope variable and redisplayed. Presumably character-set use/'tolerance' is relevant in WP application Browser Rich-text widget Python Zope MySQL ...and their interactions? Has anyone any experience or know of any information sources which might help me understand/control this workflow so that users have some chance of seeing what they thought they input? Thanks -- Mark Barratt Text Matters phone +44 (0)118 986 8313 fax +44 (0)118 931 3743 email markb@textmatters.com web http://www.textmatters.com
Mark Barratt wrote:
Has anyone any experience or know of any information sources which might help me understand/control this workflow so that users have some chance of seeing what they thought they input?
I'd have a search through the list archives for "character encoding". That said, if you have specific exception types, values and tracebacks, the list may be able to help... cheers, Chris
Chris Withers wrote:
Mark Barratt wrote:
Has anyone any experience or know of any information sources which might help me understand/control this workflow so that users have some chance of seeing what they thought they input?
I'd have a search through the list archives for "character encoding".
That said, if you have specific exception types, values and tracebacks, the list may be able to help...
Thanks, Chris Pragmatic solution: define the character-set as iso-8859-1 in the page containing the form which in turn contains the rich-text-editing widget, and in pages which display the results. Windows clients ensure that what goes into the entry field conforms to that character-set, whether it's typed or added by a paste operation from, say, Word. Zope and MySQL seem to pass through the results cleanly. Not yet tested on Mac clients. Remaining issues: UTF-8-encoded Unicode breaks big-time. I know this is an issue for MySQL, and it seems to be an issue for Zope also. -- Mark Barratt Text Matters phone +44 (0)118 986 8313 fax +44 (0)118 931 3743 email markb@textmatters.com web http://www.textmatters.com
Mark Barratt wrote:
Pragmatic solution: define the character-set as iso-8859-1 in the page containing the form which in turn contains the rich-text-editing widget,
Well, every HTML page should specify the character set it's encoded with or it's not valid HTML <0.5 wink>
Windows clients ensure that what goes into the entry field conforms to that character-set, whether it's typed or added by a paste operation from, say, Word.
That seems like it should always happen. What happens on non-windows clients?
Remaining issues: UTF-8-encoded Unicode breaks big-time. I know this is an issue for MySQL, and it seems to be an issue for Zope also.
What are the MySQL issues? What appear to be the Zope issues? cheers, Chris
Chris Withers wrote:
Pragmatic solution: define the character-set as iso-8859-1 in the page containing the form which in turn contains the rich-text-editing widget,
Well, every HTML page should specify the character set it's encoded with or it's not valid HTML <0.5 wink>
Instead of UTF-8 definition, rather than instead of nothing.
Windows clients ensure that what goes into the entry field conforms to that character-set, whether it's typed or added by a paste operation from, say, Word.
That seems like it should always happen. What happens on non-windows clients?
Currently, I don't care so haven't tested - user group is closed and all use some variety of Windows/Word. Will get round to testing from Mac clients one day and will report back.
Remaining issues: UTF-8-encoded Unicode breaks big-time. I know this is an issue for MySQL, and it seems to be an issue for Zope also.
What are the MySQL issues? What appear to be the Zope issues?
Hard to disentangle. MySQL explicitly doesn't support any encoding of Unicode except in latest (4.1?) versions - and then you need to define tables as UTF-8 at creation. 4.1 is not stable. In older versions the theory is that you can define fields as BLOBs but haven't tried that. In text fields only standard entity references work, (though they shouldn't). best Mark Barratt
Mark Barratt wrote:
Chris Withers wrote:
Pragmatic solution: define the character-set as iso-8859-1 in the page containing the form which in turn contains the rich-text-editing widget,
Well, every HTML page should specify the character set it's encoded with or it's not valid HTML <0.5 wink>
Instead of UTF-8 definition, rather than instead of nothing.
Ah, well, is the stuff you're chucking out UTF-8 or iso-8859-1? what do you want to be chucking out? ;-)
That seems like it should always happen. What happens on non-windows clients?
Currently, I don't care so haven't tested - user group is closed and all use some variety of Windows/Word. Will get round to testing from Mac clients one day and will report back.
:-)
What are the MySQL issues? What appear to be the Zope issues?
Hard to disentangle. MySQL explicitly doesn't support any encoding of Unicode except in latest (4.1?) versions - and then you need to define tables as UTF-8 at creation. 4.1 is not stable.
:-(
In older versions the theory is that you can define fields as BLOBs but haven't tried that. In text fields only standard entity references work, (though they shouldn't).
Best not to rely on that then... What would you like to have happen in what you're doing? cheers, Chris
Chris Withers wrote:
Ah, well, is the stuff you're chucking out UTF-8 or iso-8859-1? what do you want to be chucking out? ;-)
I have a working system which appears to accept and preserve ISO 8859-1 all the way through from rich-text input through storage in the database and output through Zope. But I want Unicode all the way through everything because it's the Right Thing To Do, because I'm a typographer and care about characters, because one of my Zope sites has lots of users/contributors for whom ISO 8859-1 is not native, because I want to output PDF via XSL:FO from Zope-processed XML, and because my next project has to be able to be replicated in N languages. UTF-8 encoding because it seems widely supported in browsers and other apps. -- Mark Barratt Text Matters phone +44 (0)118 986 8313 fax +44 (0)118 931 3743 email markb@textmatters.com web http://www.textmatters.com
Mark Barratt wrote:
But I want Unicode all the way through everything because it's the Right Thing To Do,
Hmm, I'm not sure that'll be possible before Zope 3. Toby Dickenson would be the man to ask, IIRC :-) cheers, Chris
Mark Barratt wrote at 2003-7-17 18:07 +0100:
I'm having trouble understanding how Zope accepts, processes and transfers character data - or more precisely what the character-set rules and pitfalls are in a workflow in which
I think Zope does nothing with character sets. It just treats them as binary strings. An exception are Unicode properties. I do not know the details. But you should find a Unicode proposal on "zope.org" (probably "dev.zope.org", probably by Toby Dickenson). Dieter
Norman Khine wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I am trying to get my head arround on how to build a registration form, that has a one-to-many relationship. Basically, what I am trying to do is to have two "tables" one listing business_addresses and on the other "table" to list all emplolyees for that business, thus creating a one-to-many relation between the business_address object and the employees.
If anyone can point me on how to achieve this, I'll be most greatfull
http://www.zope.org/Members/maxm/productList/mxmRelations regards Max M
participants (8)
-
Andreas Jung -
Chris Withers -
Dieter Maurer -
Johan Carlsson -
kosh -
Mark Barratt -
Max M -
Norman Khine