Ejemplo n.º 1
0
 def filter(self, trans, user, query, dbkey):
     """ Filter by dbkey through a raw SQL b/c metadata is a BLOB. """
     dbkey_user, dbkey = decode_dbkey(dbkey)
     dbkey = dbkey.replace("'", "\\'")
     return query.filter(
         or_("metadata like '%%\"dbkey\": [\"%s\"]%%'" % dbkey,
             "metadata like '%%\"dbkey\": \"%s\"%%'" % dbkey))
Ejemplo n.º 2
0
 def filter( self, trans, user, query, dbkey ):
     """ Filter by dbkey; datasets without a dbkey are returned as well. """
     # use raw SQL b/c metadata is a BLOB
     dbkey_user, dbkey = decode_dbkey( dbkey )
     dbkey = dbkey.replace("'", "\\'")
     return query.filter( or_( \
                             or_( "metadata like '%%\"dbkey\": [\"%s\"]%%'" % dbkey, "metadata like '%%\"dbkey\": \"%s\"%%'" % dbkey ), \
                             or_( "metadata like '%%\"dbkey\": [\"?\"]%%'", "metadata like '%%\"dbkey\": \"?\"%%'" ) \
                             )
                         )
Ejemplo n.º 3
0
 def filter( self, trans, user, query, dbkey ):
     """ Filter by dbkey. """
     # Use raw SQL b/c metadata is a BLOB.
     dbkey_user, dbkey = decode_dbkey( dbkey )
     dbkey = dbkey.replace("'", "\\'")
     return query.filter( or_( "metadata like '%%\"dbkey\": [\"%s\"]%%'" % dbkey, "metadata like '%%\"dbkey\": \"%s\"%%'" % dbkey ) )