mς )αΈEc@s‰dZdklZdklZlZlZlZlZdk l Z eefZ dfd„ƒYZ d„Z e djo e ƒndS( s5$Id: util.py 40218 2005-11-18 14:39:19Z andreasjung $(swarn(s StringTypesListTypes TupleTypesDictTypes InstanceType(sDateTimetparseIndexRequestcBs,tZdZdZgd„Zed„ZRS(s£ This class provides functionality to hide the internals of a request send from the Catalog/ZCatalog to an index._apply_index() method. The class understands the following type of parameters: - old-style parameters where the query for an index as value inside the request directory where the index name is the name of the key. Additional parameters for an index could be passed as index+"_usage" ... - dictionary-style parameters specify a query for an index as an entry in the request dictionary where the key corresponds to the name of the index and the key is a dictionary with the parameters passed to the index. Allowed keys of the parameter dictionary: 'query' - contains the query (either string, list or tuple) (required) other parameters depend on the the index - record-style parameters specify a query for an index as instance of the Record class. This happens usually when parameters from a web form use the "record" type e.g. . All restrictions of the dictionary-style parameters apply to the record-style parameters tIndexRequestParseErrorc Cs\||_|i|ƒpd|_dSn|d}|i|ƒo"|||_t d|t ƒn||}d}t |ƒ} | tjoΓt|tƒ o²|} t| dƒp|id|i‚n| i}t |ƒtjo|iƒg}nxP|D]G} | djoqnt| | ƒot|| t| | ƒƒqqWnώ| tjo‰|idfƒ}t |ƒtjo |}n |g}x΅|D]B} | djoqžn|i| ƒot|| || ƒqžqžWnh| tjo |}n |g}xD|D]<} |d| }|i|ƒot|| ||ƒqqW||_dS(s1 parse a request from the ZPublisher and return a uniform datastructure back to the _apply_index() method of the index request -- the request dictionary send from the ZPublisher iid -- Id of index options -- a list of options the index is interested in Nt_usagesΝ ZCatalog query using '%s' detected. Using query parameters ending with '_usage' is deprecated. Consider using record-style parameters instead (see lib/python/Products/PluginIndexes/README.txt for details)tquerys2record for '%s' *must* contain a 'query' attributet_(tiidtselftidtrequestthas_keytNonetkeyst usage_paramtusagetwarntDeprecationWarningtparamttypettt InstanceTypet isinstancetDateTimetrecordthasattrtParserExceptionRt StringTypetstriptoptionstoptsetattrtgetattrtDictTypetgett SequenceTypestfield( RRRRR RRR"R RRR((tA/data/zmath/zope/lib/python/Products/PluginIndexes/common/util.pyt__init__:s`        %        cCs>t||ƒo&t||ƒ}|o|Sq:|Sn|SdS(N(RRtkRtvt default_v(RR%R'R&((R#R …s (t__name__t __module__t__doc__RR$R R (((R#Rs  KcCslthdhdd<dd<dd<