appy.gen: bugfix while using Zope behind Apache and using the VHM; Ref.view macro is not called via Ajax anymore for single-valued Refs (when displaying lists containing single-valued Ref fields, it produces too many ajax requests, leading to ConflictErrors in the ZODB).

This commit is contained in:
Gaetan Delannay 2012-03-27 15:49:41 +02:00
parent 5928996730
commit 40e8a5f258
5 changed files with 63 additions and 30 deletions

View file

@ -302,15 +302,15 @@ class BaseMixin:
'''Reindexes this object the catalog. If names of indexes are specified
in p_indexes, recataloging is limited to those indexes. If p_unindex
is True, instead of cataloguing the object, it uncatalogs it.'''
url = self.absolute_url_path()
path = '/'.join(self.getPhysicalPath())
catalog = self.getPhysicalRoot().catalog
if unindex:
catalog.uncatalog_object(url)
catalog.uncatalog_object(path)
else:
if indexes:
catalog.catalog_object(self, url, idxs=indexes)
catalog.catalog_object(self, path, idxs=indexes)
else:
catalog.catalog_object(self, url)
catalog.catalog_object(self, path)
def say(self, msg, type='info'):
'''Prints a p_msg in the user interface. p_logLevel may be "info",
@ -533,6 +533,11 @@ class BaseMixin:
if not refs: raise IndexError()
return refs.index(obj.UID())
def mayAddReference(self, name, folder):
'''May the user add references via Ref field named p_name in
p_folder?'''
return self.getAppyType(name).mayAdd(self, folder)
def isDebug(self):
'''Are we in debug mode ?'''
for arg in sys.argv: