Example #1
0
class Site:
    def __init__(self, sourceRoot):
        self.menu = None
        sourceRoot = os.path.normpath(sourceRoot)
        sourceRoot = os.path.abspath(sourceRoot)
        self.sourceRoot = sourceRoot
        self.root = WebModule(self, "index", None)

    def init(self):
        self.menu = MenuItem(None, self.root)
        self.root.init()

    def addToSitemap(self, mod, menuText):
        menu = mod.menuItem
        #menu = self.menu.findItemFor(mod)
        if menu is None:
            menu = MenuItem(self.root, mod)
            #assert menu is not None, mod.getLocalPath()

        if menuText is None:
            for child in mod.getChildren():
                menu.addItem(child, 0)
            return

        for line in menuText.splitlines():
            level = 0
            while line[level].isspace():
                level += 1
            nodeName = line[level:].strip()
            try:
                node = getattr(mod, nodeName)
            except AttributeError, e:
                #raise
                node = OopsPage(mod, nodeName)
            #item = MenuItem(node,level)
            menu.addItem(node, level)
Example #2
0
class Site:
	def __init__(self,sourceRoot):
		self.menu = None
		sourceRoot = os.path.normpath(sourceRoot)
		sourceRoot = os.path.abspath(sourceRoot)
		self.sourceRoot = sourceRoot
		self.root = WebModule(self,"index",None)

	def init(self):
		self.menu = MenuItem(None,self.root)
		self.root.init()
	
	def addToSitemap(self,mod,menuText):
		menu = mod.menuItem
		#menu = self.menu.findItemFor(mod)
		if menu is None:
			menu = MenuItem(self.root,mod)
			#assert menu is not None, mod.getLocalPath()
			
		if menuText is None:
			for child in mod.getChildren():
				menu.addItem(child,0)
			return
		
		for line in menuText.splitlines():
			level = 0
			while line[level].isspace():
				level += 1
			nodeName = line[level:].strip()
			try:
				node = getattr(mod,nodeName)
			except AttributeError,e:
				#raise 
				node = OopsPage(mod,nodeName)
			#item = MenuItem(node,level)
			menu.addItem(node,level)
Example #3
0
 def __init__(self, sourceRoot):
     self.menu = None
     sourceRoot = os.path.normpath(sourceRoot)
     sourceRoot = os.path.abspath(sourceRoot)
     self.sourceRoot = sourceRoot
     self.root = WebModule(self, "index", None)
Example #4
0
	def __init__(self,sourceRoot):
		self.menu = None
		sourceRoot = os.path.normpath(sourceRoot)
		sourceRoot = os.path.abspath(sourceRoot)
		self.sourceRoot = sourceRoot
		self.root = WebModule(self,"index",None)