facet.py revision 2608
#
# 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
# 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"""
raise KeyError, "key must start w/ facet."
return True # be inclusive
"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]
""" determine if facets permit this action; if any facets allow
it, return True; also return True if no facets are present"""
if f[:6] != "facet.":
continue
if self[f]:
return True
else:
return ret