Note that there are some explanatory texts on larger screens.

plurals
  1. POQuerying portal_catalog using typed uuids instead of string uuids
    primarykey
    data
    text
    <p>I'm writing a Plone calendar module for reserving different resources. This module features a calendar whose events are stored in Postgresql. Each calendar is a Dexterity object stored in the ZODB.</p> <p>To make a link between Plone and Postgresql I naturally turned to the uuid property of the Plone objects. So each uuid in Plone serves as a foreign key in Postgresql, which supports uuid natively.</p> <p>This worked well for me in the past 6 months until I started using Plone 4.1.4. With it, plone.uuid 1.0.2 was introduced which changes the string representation of uuids from uuids <em>with</em> to uuids <em>without</em> dashes.</p> <p>The problem with this change is that I can no longer be certain which representation is going to be used on any given object. Objects created before Plone 4.1.4 contain a differently formatted uuid-string than objects created after.</p> <p>Long story short, to ensure that my code works with any uuid representation I would love to be able to search by using Python's uuid type.</p> <p><strong>So instead of this:</strong></p> <pre><code>catalog.searchResults(UID='325dc47e-08f9-4fa1-bc18-3944a725adb4') </code></pre> <p>Which returns <em>different</em> results than this:</p> <pre><code>catalog.searchResults(UID='325dc47e08f94fa1bc183944a725adb4') </code></pre> <p><strong>I would love to do this:</strong></p> <pre><code>from uuid import UUID catalog.searchResults(UID=UUID('325dc47e-08f9-4fa1-bc18-3944a725adb4')) </code></pre> <p>Which would be <em>equivalent</em> to this:</p> <pre><code>catalog.searchResults(UID=UUID('325dc47e08f94fa1bc183944a725adb4')) </code></pre> <p>Does anyone know how I can achieve that kind of independency from the uuid's representation in Plone?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload