facet.py revision 2639
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
# basic facet support
import fnmatch
import re
import types
# store information on facets; subclass dict
# and maintain ordered list of keys sorted
# by length.
# subclass __getitem_ so that queries w/
# actual facets find match
for i in init:
s = "<"
s += ">"
return s
raise KeyError, 'key must start with "facet".'
raise ValueError, "value must be boolean"
"""implement facet lookup algorithm here"""
# Note that _allow_facet bypasses __getitem__ for performance
# reasons; if __getitem__ changes, _allow_facet in _varcet.c
# must also be updated.
raise KeyError, "key must start w/ facet."
return True # be inclusive
# allow_action is provided as a native function (see end of class
# declaration).
"default" not in kwargs)
try:
except ValueError:
raise
if args:
return popped
for k, v in d.iteritems():
self[k] = v
yield k, self[k]