# HG changeset patch # User Goffi # Date 1339173285 -7200 # Node ID aaf5e34ff765fba3dde6a3fa487f2db84fd2a64c # Parent 50f6ee966da8d34c44b268eff32016689aae5d9e fixed getItems when there are not authorized_groups + fixed default value for StoreItem diff -r 50f6ee966da8 -r aaf5e34ff765 sat_pubsub/pgsql_storage.py --- a/sat_pubsub/pgsql_storage.py Sun Jun 03 15:57:28 2012 +0200 +++ b/sat_pubsub/pgsql_storage.py Fri Jun 08 18:34:45 2012 +0200 @@ -68,9 +68,9 @@ NS_ITEM_CONFIG = "http://jabber.org/protocol/pubsub#item-config" OPT_ACCESS_MODEL = 'pubsub#access_model' OPT_ROSTER_GROUPS_ALLOWED = 'pubsub#roster_groups_allowed' -VAL_DEFAULT = 'default' VAL_OPEN = 'open' VAL_ROSTER = 'roster' +VAL_DEFAULT = VAL_OPEN class Storage: @@ -608,11 +608,13 @@ INNER JOIN items USING (node_id) LEFT JOIN item_groups_authorized USING (item_id) WHERE node=%s AND - (items.access_model='open' or - (items.access_model='roster' and groupname in (%s)) - ) + (items.access_model='open' """ + + ("or (items.access_model='roster' and groupname in %s)" if authorized_groups else '') + + """) ORDER BY date DESC"""] - args = [self.nodeIdentifier, authorized_groups] + args = [self.nodeIdentifier] + if authorized_groups: + args.append(authorized_groups) if maxItems: query.append("LIMIT %s")