# HG changeset patch # User casties # Date 1366884476 -7200 # Node ID b8ced08ebea9f71117d34098fb59fa0b1c59f147 # Parent 01b5265264b67cb80b7176ac84a2f62fe600947d working on projects. diff -r 01b5265264b6 -r b8ced08ebea9 HashTree.py --- a/HashTree.py Wed Apr 24 20:48:45 2013 +0200 +++ b/HashTree.py Thu Apr 25 12:07:56 2013 +0200 @@ -31,7 +31,7 @@ def getSubtreeAsList(self): - """returns the subtree as list sorted by key (depth first)""" + """returns the subtree as flattened list sorted by key (depth first)""" if self.children is None: if self.value is None: return [] diff -r 01b5265264b6 -r b8ced08ebea9 MPIWGDepartment.py --- a/MPIWGDepartment.py Wed Apr 24 20:48:45 2013 +0200 +++ b/MPIWGDepartment.py Thu Apr 25 12:07:56 2013 +0200 @@ -156,7 +156,7 @@ onlyArchived = 2 : archived projects """ pf = self.en.getProjectFolder() - projects = pf.getProjectList(self.getProjectId(), active=onlyActive, archived=onlyArchived) + projects = pf.getProjectsAsList(self.getProjectId(), active=onlyActive, archived=onlyArchived) #logging.debug("getProjects projects=%s"%repr(projects)) if count > 0: return projects[:count] diff -r 01b5265264b6 -r b8ced08ebea9 MPIWGProjects.py --- a/MPIWGProjects.py Wed Apr 24 20:48:45 2013 +0200 +++ b/MPIWGProjects.py Thu Apr 25 12:07:56 2013 +0200 @@ -1777,17 +1777,10 @@ # cached HashTree with project hierarchy _v_projectTree = None - - def __init__(self, id, title=None): - self.id = id - if title is None: - self.title = id - else: - self.title = title - - - def getTree(self): - """returns the hierarchy tree (and caches it)""" + def getProjectTree(self): + """returns the project hierarchy tree (and caches it). + + returns HashTree instance.""" tree = self._v_projectTree if tree is None: tree = HashTree(keySeparator='.', keyFn=lambda x:getInt(x)) @@ -1795,13 +1788,13 @@ tree.add(p.getNumber(), p) self._v_projectTree = tree - #logging.debug("getTree: tree=%s"%(tree.root.getSubtreeAsText())) + #logging.debug("getProjectTree: tree=%s"%(tree.root.getSubtreeAsText())) return tree - def getProjectList(self, start, active=1, archived=1): - """returns list of projects, starting from start. + def getProjectsAsList(self, start, active=1, archived=1): + """returns flattened list of projects, starting from start. active = 0 : all projects active = 1 : active projects @@ -1810,14 +1803,14 @@ archived = 1 : current projects archived = 2 : archived projects """ - #logging.debug("getProjectList(start=%s,active=%s,archived=%s)"%(repr(start),active,archived)) - tree = self.getTree() + #logging.debug("getProjectsAsList(start=%s,active=%s,archived=%s)"%(repr(start),active,archived)) + tree = self.getProjectTree() node = tree.getNode(start) if node is None: return [] pl = node.getSubtreeAsList() - #logging.debug("getProjectList: node=(%s,%s) pl=%s"%(node.key,node.value,pl)) + #logging.debug("getProjectsAsList: node=(%s,%s) pl=%s"%(node.key,node.value,pl)) # return filtered list return [p for p in pl if (p.checkActive(active) and p.checkArchived(archived))] @@ -1836,7 +1829,7 @@ projects = [] # search project numbers res = self.executeZSQL("select * from projects_members where lower(member_key) = %s", [key.lower()]) - tree = self.getTree() + tree = self.getProjectTree() # find projects in tree for r in res: p = tree.get(r.project_number) diff -r 01b5265264b6 -r b8ced08ebea9 zpt/project/project_template.zpt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/project/project_template.zpt Thu Apr 25 12:07:56 2013 +0200 @@ -0,0 +1,234 @@ + + +
+ +
+ (
+
+ Other involved scholars: Scholars +
++ Cooperation Partners: Partners +
+ + +empty image+