Back to index

plone3  3.1.7
selectors.py
Go to the documentation of this file.
00001 # Copyright (c) 2006-2007
00002 # Authors: KSS Project Contributors (see docs/CREDITS.txt)
00003 #
00004 # This program is free software; you can redistribute it and/or modify
00005 # it under the terms of the GNU General Public License version 2 as published
00006 # by the Free Software Foundation.
00007 #
00008 # This program is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with this program; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00016 # 02111-1307, USA.
00017 
00018 CSS_SELECTOR = 'css'
00019 HTMLID_SELECTOR = 'htmlid' 
00020 PARENTNODE_SELECTOR = 'parentnode' 
00021 SAMENODE_SELECTOR = 'samenode' 
00022 
00023 class SelectorBase(object):
00024     
00025     def __init__(self, selector):
00026         self.value = selector
00027         
00028 class CssSelector(SelectorBase):
00029     type = CSS_SELECTOR
00030         
00031 class HtmlIdSelector(SelectorBase):
00032     type = HTMLID_SELECTOR
00033 
00034 class ParentNodeSelector(SelectorBase):
00035     type = PARENTNODE_SELECTOR
00036 
00037 class SameNodeSelector(SelectorBase):
00038     def __init__(self):
00039         super(SameNodeSelector, self).__init__('')
00040     type = SAMENODE_SELECTOR
00041 
00042 # A generic (pluggable) selector
00043 
00044 class Selector(SelectorBase):
00045 
00046     def __init__(self, type, selector):
00047         self.type = type
00048         SelectorBase.__init__(self, selector)