annotate MPIWGProjects_removed.py @ 52:1ed79b33200c

more work on projects and cleanup.
author casties
date Tue, 30 Apr 2013 16:00:56 +0200
parents e30a4bd074db
children dc41deabc8f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
1 #
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
2 # removed methods
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
3 #
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
4 class MPIWGProjects_notused:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
5
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
6 def decode(self, str):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
7 """return unicode object"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
8 return unicodify(str)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
9
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
10 def isCheckField(self, fieldname):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
11 """return chechfield"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
12 return (fieldname in checkFields)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
13
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
14 def sortedByPlace(self, metatype):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
15 """find metatype and sort by place"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
16 def sort(x, y):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
17 return cmp(getattr(x[1], 'place', 0), getattr(y[1], 'place', 0))
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
18
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
19 logging.debug("MPIWGProjects begin: sorted by place: " + metatype)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
20 founds = self.ZopeFind(self, obj_metatypes=[metatype]);
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
21
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
22 founds.sort(sort)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
23 logging.debug("MPIWGProjects end: sorted by place: " + metatype)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
24 return founds
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
25
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
26
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
27 def harvest_page(self, context=None, mode="normal"):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
28 """seite fuer harvesting fuer die Projektsuche"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
29
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
30 if not context:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
31 context = self
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
32
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
33 if self.isActiveProject() and self.isCurrentVersion():
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
34 templates = self.en.getHarvestCache()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
35
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
36 ext = getattr(self, "harvest_main", None)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
37 if ext:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
38 rendered = getattr(self, ext.getId())()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
39 templates[self.absolute_url()] = rendered
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
40 transaction.commit()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
41 return rendered
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
42
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
43
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
44 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'harvest_main')).__of__(context)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
45
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
46 rendered = pt()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
47 templates[self.absolute_url()] = rendered
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
48 transaction.commit()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
49 return rendered
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
50
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
51
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
52
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
53 def index_html_old(self, request=True, context=None):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
54 """show homepage"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
55
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
56 bound_names = {}
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
57
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
58 if not context:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
59 context = self
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
60 if request:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
61 if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected', None) == None:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
62 self.REQUEST.SESSION['MPI_redirected'] = 1
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
63 self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date']) + "?date=" + self.REQUEST['date'])
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
64 else:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
65 self.REQUEST.SESSION['MPI_redirected'] = None
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
66
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
67 # ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"])
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
68
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
69
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
70 request2 = getattr(self, 'REQUEST', None)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
71
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
72 if request2 is not None:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
73 response = request2.response
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
74 if not response.headers.has_key('content-type'):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
75 response.setHeader('content-type', 'text/html')
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
76
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
77 security = getSecurityManager()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
78 bound_names['user'] = security.getUser()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
79
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
80 # Retrieve the value from the cache.
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
81 keyset = None
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
82 if self.ZCacheable_isCachingEnabled():
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
83
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
84 # Prepare a cache key.
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
85 keyset = {'here': self, 'params':request2['QUERY_STRING']}
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
86
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
87 result = self.ZCacheable_get(keywords=keyset)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
88
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
89 if result is not None:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
90 # Got a cached value.
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
91 return result
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
92
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
93 pt = getTemplate(self, "project_main")
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
94 # Execute the template in a new security context.
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
95 security.addContext(self)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
96
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
97 try:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
98 # logging.debug("index_html pt=%s"%repr(pt))
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
99 result = pt.pt_render(extra_context=bound_names)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
100 # logging.debug("index_html result=%s"%repr(result))
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
101 if keyset is not None:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
102 # Store the result in the cache.
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
103 self.ZCacheable_set(result, keywords=keyset)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
104
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
105 return result
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
106 finally:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
107 security.removeContext(self)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
108
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
109
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
110
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
111 def index_html_old2(self, request=True, context=None):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
112 """show homepage"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
113 if not context:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
114 context = self
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
115 if request:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
116 if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected', None) == None:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
117 self.REQUEST.SESSION['MPI_redirected'] = 1
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
118 self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date']) + "?date=" + self.REQUEST['date'])
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
119 else:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
120 self.REQUEST.SESSION['MPI_redirected'] = None
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
121
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
122 # ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"])
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
123
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
124 ext = getattr(self, "project_main", None)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
125 if ext:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
126 return getattr(self, ext.getId())()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
127
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
128 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'project_main')).__of__(context)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
129
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
130 return pt()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
131
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
132
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
133 def no_project(self):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
134 """warnung: project noch nicht existent"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
135 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'no_project')).__of__(self)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
136 return pt()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
137
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
138
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
139 def showImagesOfPage(self, imageUrl=None):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
140 """show Images of project"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
141 self.getContent('WEB_project_description', filter='yes') # get the content and store image infos into session
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
142 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'projectImageView.zpt')).__of__(self)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
143 return pt()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
144
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
145
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
146 def show_html(self):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
147 """simple index"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
148 # return "HI"
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
149 pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'MPIWGProject_index.zpt')).__of__(self)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
150 return pt()
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
151
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
152 def getLabel_old(self):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
153 """returns label (or title) of this project"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
154 l = self.getContent('xdata_07')
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
155 if l:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
156 return l
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
157 l = self.getContent('WEB_title')
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
158 if l:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
159 return l
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
160 return self.title
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
161
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
162 def getPersonKeyList(self):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
163 """gibt die key Liste der beteiligten Personen zurueck (utf8 codiert)"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
164 # logging.error("getPersonKeyList:%s"%getattr(self,'responsibleScientistsList',[]))
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
165 try:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
166 return [utf8ify(x[1]) for x in getattr(self, 'responsibleScientistsList', [])]
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
167 except:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
168 return[]
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
169
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
170
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
171 def myCapitalize(self, txt):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
172 """kapitalisiere auch Namen mit -"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
173 splitted = [x.capitalize() for x in txt.split("-")]
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
174 return "-".join(splitted)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
175
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
176 def getNamesOrdered(self, list):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
177 """Sortiert die Liste nach der Reihenfolge in xdata_01"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
178
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
179 nameList = self.getContent('xdata_01')
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
180 if nameList.find(";") > -1: # rate Trenner ist ;
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
181 names = nameList.split(";")
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
182 else:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
183 names = nameList.split(",")
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
184
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
185 self._v_names = []
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
186 for name in names:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
187 self._v_names.append(name.rstrip().lstrip())
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
188
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
189
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
190 def sort(x, y):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
191 try:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
192 return cmp(self._v_names.index(x[0]), self._v_names.index(y[0]))
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
193 except:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
194 return 0
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
195
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
196 list.sort(sort)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
197
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
198 return list
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
199
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
200 def getWebProject_description(self):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
201 """get description"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
202 debug = self.REQUEST.cookies.get("MP_debug_code", None)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
203
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
204 if debug and debug == "western":
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
205 return """
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
206 <html>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
207 <head>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
208 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
209 </head>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
210 <body>%s</body>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
211 </html>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
212 """ % self.WEB_project_description[0]
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
213
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
214 return """
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
215 <html>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
216 <head>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
217 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
218 </head>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
219 <body>%s</body>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
220 </html>
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
221 """ % self.getContent('WEB_project_description')
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
222
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
223
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
224
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
225 def isChecked(self, wert, list):
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
226 """check if wert is in ; seperated list"""
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
227
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
228 # felder sind manchmnal als liste mit einem element definiert
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
229 if type(list) is StringType or UnicodeType:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
230 splitted = list.split(";")
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
231 else:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
232 splitted = list[0].split(";")
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
233
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
234 splitted = [y.rstrip().lstrip() for y in splitted]
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
235
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
236 for x in splitted:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
237 x = re.sub(r"[^A-z ]", "", x)
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
238 if (not x == u'') and x in wert:
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
239 return 1
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
240 return 0
e30a4bd074db more cleaning up projects.
casties
parents:
diff changeset
241
52
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
242
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
243 def getRootProject(self):
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
244 """returns the root (=top level) project of the current project"""
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
245 ct = self.getContexts(parents=self.getContent('xdata_05'))
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
246 if len(ct) > 0:
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
247 return ct[-1][0]
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
248 else:
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
249 return self
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
250
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
251
1ed79b33200c more work on projects and cleanup.
casties
parents: 50
diff changeset
252