comparison MoinMoin/themes/__init__.py @ 2253:46b74c363c6f

UI for indicating multiple names and switching namespaces.
author Ashutosh Singla <ashu1461@gmail.com>
date Mon, 02 Sep 2013 17:41:54 +0530
parents ecd43cdbb9b6
children 6dd5af01d54d
comparison
equal deleted inserted replaced
2252:ecd43cdbb9b6 2253:46b74c363c6f
296 url = url_for('frontend.login', login=1) 296 url = url_for('frontend.login', login=1)
297 if self.cfg.auth_have_login: 297 if self.cfg.auth_have_login:
298 url = url or url_for('frontend.login') 298 url = url or url_for('frontend.login')
299 return url 299 return url
300 300
301 def get_fqnames(self, fqname):
302 """
303 Return the list of other fqnames associated with the item.
304 """
305 if fqname.field != NAME_EXACT:
306 return []
307 item = self.storage.get_item(**fqname.query)
308 fqnames = item.fqnames
309 fqnames.remove(fqname)
310 return fqnames or []
311
312 def get_namespaces(self, ns):
313 """
314 Return the list of tuples (composite name, namespace) referring to namespaces other
315 than the current namespace.
316 """
317 ns = u'' if ns.value == '~' else ns.value
318 namespace_root_mapping = []
319 for namespace, _ in app.cfg.namespace_mapping:
320 namespace = namespace.rstrip('/')
321 if namespace != ns:
322 fq_namespace = CompositeName(namespace, NAME_EXACT, u'')
323 namespace_root_mapping.append((namespace or '~', fq_namespace.get_root_fqname()))
324 return namespace_root_mapping
325
301 326
302 def get_editor_info(meta, external=False): 327 def get_editor_info(meta, external=False):
303 addr = meta.get(ADDRESS) 328 addr = meta.get(ADDRESS)
304 hostname = meta.get(HOSTNAME) 329 hostname = meta.get(HOSTNAME)
305 text = _('anonymous') # link text 330 text = _('anonymous') # link text