From: Mitra <mi...@mi...> - 2003-01-13 13:47:04
|
Hi There is a lot of code, and a lot of mistakes, that happen around the different representations for item ids. We have at least four that I know of: Short id: Sequence of Item in database, used in shorter urls especially in views Packed id: 128 bit packed, stored in database Unpacked id: 32 character, used in urls Tagged ids: For example where an x is on the front of a packed id to indicate bidirectional. An example of a Sysadmin mistake was where recently I used related items window and stored the string, which then broke something using it as a related items link. I had to switch to store item ids. The reason this came up for me, is that I need a way to add a meaning to related item links, which is hard with since a multi-value field (like a related item) can only contain one piece of data. I was thinking of extending the related item window to allow me to redefine the buttons. What I'm thinking is to add a "class itemid" which would refer to an item. This could be initialised with either shortid, packed, unpacked or tagged, and then could - via methods - return any of the alternatives e.g. foo = new itemid(123) #new itemid(1234567890abcdef1234567890abcdef) and then foo->packed; I would use lazy evaluation to do the conversion, i.e. only generating the flavors needed. What do you think? If we like the idea, I would see it programmed in gradually, i.e. I define the class, and its methods and then it can be integrated only when we are working on some part of the code. - Mitra P.S. I'd still like a hint on how to create a new "item" refering to an item id, this would be very useful for use of the site module, but I can't figure out if this is possible. -- Mitra Technology Consulting - www.mitra.biz - mi...@mi... 02-6684-8096 or 0414-648-0722 Life is a Mystery to be Lived, not a Problem to be Solved |