[Plone-IT] folder_contents, alcuni dubbi

Vito Falco vitofalco a gmail.com
Mar 21 Ott 2008 10:34:17 UTC


argh :-/
Provo un senso di frustazione...
Il tuo suggerimento non restituisce errori ma non fa quello che voglio, e
non riesco a capire come passargli bene sti parametri al catalog!

Vito

2008/10/21 Yuri <yurj a alfa.it>

> Vito Falco ha scritto:
>
>> Grazie ma...
>> sto costruendo solo una vista che deve "imitare" quello che vedono gli
>> anonimi quindi non è la strada giusta quella di modificare i permessi del
>> ruolo poichè avrebbe una ripercussione più ampia.
>> Necessito giusto che questa vista elenchi gli elementi presenti nella
>> cartella in stato non scaduti.
>>
>
> {'query': {'effective': <data di oggi>}, 'range': 'min:max'}
>
> questo dovrebbe essere il tuo content filter.
>
> forse funziona senza range, solo interrogando effective.
>
>
>> Vito
>>
>> 2008/10/21 Yuri <yurj a alfa.it <mailto:yurj a alfa.it>>
>>
>>
>>    Vito Falco ha scritto:
>>
>>        Hola,
>>
>>        ho individuato la porzione di CatalogTool che dovrebbe
>>        illuminarmi sulal questione ma ... non è così, non riesco a
>>        capire come passargli i dati per ottenre solo gli oggetti non
>>        scaduti.
>>
>>     if not _checkPermission( AccessInactivePortalContent, self ):
>>
>>    prova a togliere a quell'utente questo permesso, anche se penso
>>    dipenda dal ruolo owner.
>>
>>    Cmq, basta che imposti il filtro come fanno qui sotto.
>>
>>
>>           def searchResults(self, REQUEST=None, **kw):
>>                   """
>>                       Calls ZCatalog.searchResults with extra
>>        arguments that
>>                       limit the results to what the user is allowed
>>        to see.
>>                   """
>>                   user = _getAuthenticatedUser(self)
>>                   kw[ 'allowedRolesAndUsers' ] =
>>           self._listAllowedRolesAndUsers( user )
>>
>>                   if not _checkPermission(
>>        AccessInactivePortalContent, self ):
>>                       now = DateTime()
>>
>>                       self._convertQuery(kw)
>>
>>                       # Intersect query restrictions with those
>>        implicit to
>>           the tool
>>                       for k in 'effective', 'expires':
>>                           if kw.has_key(k):
>>                               range = kw[k]['range'] or ''
>>                               query = kw[k]['query']
>>                               if not isinstance(query, (tuple, list)):
>>                                   query = (query,)
>>                           else:
>>                               range = ''
>>                               query = None
>>                           if range.find('min') > -1:
>>                               lo = min(query)
>>                           else:
>>                               lo = None
>>                           if range.find('max') > -1:
>>                               hi = max(query)
>>                           else:
>>                               hi = None
>>                           if k == 'effective':
>>                               if hi is None or hi > now:
>>                                   hi = now
>>                               if lo is not None and hi < lo:
>>                                   return ()
>>                           else: # 'expires':
>>                               if lo is None or lo < now:
>>                                   lo = now
>>                               if hi is not None and hi < lo:
>>                                   return ()
>>                           # Rebuild a query
>>                           if lo is None:
>>                               query = hi
>>                               range = 'max'
>>                           elif hi is None:
>>                               query = lo
>>                               range = 'min'
>>                           else:
>>                               query = (lo, hi)
>>                               range = 'min:max'
>>                           kw[k] = {'query': query, 'range': range}
>>
>>                   return ZCatalog.searchResults(self, REQUEST, **kw)
>>
>>               __call__ = searchResults
>>
>>
>>        Come fare?
>>
>>        Vito
>>
>>        2008/10/20 Yuri <yurj a alfa.it <mailto:yurj a alfa.it>
>>        <mailto:yurj a alfa.it <mailto:yurj a alfa.it>>>
>>
>>
>>
>>           Vito Falco ha scritto:
>>
>>               Hola,
>>               ho creato una nuova view per un mio oggetto di tipo
>>        cartella.
>>               Questa view è quasi una copia del folder_contents.
>>
>>               Non riesco a capire come NON far vedere i contenuti
>>        "scaduti"
>>               anche all'amministratore/proprietario di tale cartella.
>>
>>               Ho cercato in lungo e in largo ma non riesco a venirne
>>        fuori
>>               perchè vorrei usare questa chiamata presente nel folder
>>        contents:
>>
>>                  folderContents python:here.portal_type=='Topic' and
>>                  here.queryCatalog(contentFilter, batch=True) or
>>                  here.getFolderContents(contentFilter, batch=True,
>>                  b_size=limit_display or 100);
>>
>>
>>           credo sia l'indice effectiveRange del catalogo. Il suo
>>        utilizzo lo
>>           trovi in searchResults in CMFPlone.
>>
>>             def searchResults(self, REQUEST=None, **kw):
>>                 """Calls ZCatalog.searchResults with extra arguments that
>>                 limit the results to what the user is allowed to see.
>>
>>                 This version uses the 'effectiveRange' DateRangeIndex.
>>
>>                 It also accepts a keyword argument show_inactive to
>>        disable
>>                 effectiveRange checking entirely even for those
>>        without portal
>>                 wide AccessInactivePortalContent permission.
>>
>>           ===
>>
>>
>>
>>               in contentFilter potrei passargli qualcosa tipo:
>>
>>                  contentFilter = {'Type': 'oggettomio',
>>        'review_state' : '
>>               published'}
>>
>>
>>               ma il "problema" è che quando un oggetto è "scaduto" non
>>               cambia lo stato di tale oggetto
>>
>>
>>
>>
>>           _______________________________________________
>>           Plone-IT mailing list
>>           Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>>        <mailto:Plone-IT a lists.plone.org
>>        <mailto:Plone-IT a lists.plone.org>>
>>
>>           http://lists.plone.org/mailman/listinfo/plone-it
>>           http://www.nabble.com/Plone---Italy-f21728.html
>>
>>
>>
>>
>>        --        "Design is the method of putting form and content
>> together.
>>        Design, just as art, has multiple definitions; there is no
>>        single definition. Design can be art. Design can be
>>        aesthetics. Design is so simple, that's why it is so
>>        complicated." by Paul Rand
>>
>>  ------------------------------------------------------------------------
>>
>>
>>
>>        _______________________________________________
>>        Plone-IT mailing list
>>        Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>>        http://lists.plone.org/mailman/listinfo/plone-it
>>        http://www.nabble.com/Plone---Italy-f21728.html
>>
>>
>>
>>    _______________________________________________
>>    Plone-IT mailing list
>>    Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>>    http://lists.plone.org/mailman/listinfo/plone-it
>>    http://www.nabble.com/Plone---Italy-f21728.html
>>
>>
>>
>>
>> --
>> "Design is the method of putting form and content together. Design, just
>> as art, has multiple definitions; there is no single definition. Design can
>> be art. Design can be aesthetics. Design is so simple, that's why it is so
>> complicated." by Paul Rand
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Plone-IT mailing list
>> Plone-IT a lists.plone.org
>> http://lists.plone.org/mailman/listinfo/plone-it
>> http://www.nabble.com/Plone---Italy-f21728.html
>>
>
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> http://lists.plone.org/mailman/listinfo/plone-it
> http://www.nabble.com/Plone---Italy-f21728.html
>



-- 
"Design is the method of putting form and content together. Design, just as
art, has multiple definitions; there is no single definition. Design can be
art. Design can be aesthetics. Design is so simple, that's why it is so
complicated." by Paul Rand
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20081021/2f5c639b/attachment.html>


Maggiori informazioni sulla lista Plone-IT