[dev] Ansel Gallery IDs vs. Names

Michael Rubinsky mrubinsk at horde.org
Wed Feb 20 15:49:55 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben Klang wrote:
| Hi All,
|
| While updating my Ansel install I found that some functionality in
| the API I had been relying on has disappeared.  Since I'm not quite
| sure how to repair it, I am posting here.
|
| In the old version of ansel/lib/api.php (prior to CVS HEAD version
| 1.63) the createGallery() method accepted a gallery_id parameter.
| While certainly this is most commonly autogenerated, in my case I
| have an application that expects to be able to set the gallery ID
| programmatically.  From reading the code as it exists today, this is
| not possible.  The gallery ID is now forced to be a random string.

Actually, that's not true.  The gallery_id is the key into the
ansel_galleries table, and is thus an integer...and the reason it is not
possible to set the gallery_id.

|
| The second problem is that the previous galleryExists() method
| expected a gallery name as the parameter to search. This one was
| probably partially my fault: a confusion between gallery ID and
| gallery name.  Regardless the API documentation in lib/api.php talks
| about the argument to galleryExists() expecting a gallery name, while
| the underlying method expects a gallery ID.  Since gallery IDs are
| now random, the galleryExists() method has been rendered pretty
| useless to me.  While it is possible to look up an ID via the
| Gallery's name (internally within Ansel; not through the API), this
| is not nearly as reliable of a mechanism as the gallery name can change.

The gallery 'name' as was previously used, was the datatree name for the
gallery.  Since Ansel is trying to move away from using the datatree, it
was refactored so that only gallery ids are presented to any client code
~ (actually, *any* code other than code within the Ansel_Gallery class).
~ Basically, Ansel_Gallery (for, now, at least) holds a reference to it's
Ansel_Gallery_Share object that it uses internally.

| So I'm stuck.  I think it's clear that the galleryExists() API
| documentation needs to be amended to reference the gallery ID instead
| of a name.  But does it cause any problems to restore the old API
| functionality of allowing the gallery ID to be specified via the API
| rather than forcing a random ID?  Why was this option removed?

Unfortunately, that's not possible since the gallery id is the key for
the gallery in the gallery table.

Maybe if you outline your specific needs/use case we can work to get the
~ functionality you need into the current api structure...


- --

Thanks,
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org

"Time just hates me. That's why it made me an adult." - Josh Joplin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHvEwjTW0K6bINYV4RAjKTAKDlpVMrnGgPfZNeorLgfnCShwMfHQCfU9PH
yKHG0j6tuVRYn2qaPKZDQqM=
=+Orc
-----END PGP SIGNATURE-----


More information about the dev mailing list