[gen] Replaced database fields tool.resultColumnsFor[class] by static attributes class.listColumns. [gen] Bugfixes and removed unused code.
This commit is contained in:
parent
204d7644b2
commit
809a553cf4
14 changed files with 397 additions and 392 deletions
|
@ -203,15 +203,6 @@ class ToolMixin(BaseMixin):
|
|||
cfg = self.getProductConfig()
|
||||
return [self.getAppyClass(k) for k in cfg.rootClasses]
|
||||
|
||||
def _appy_getAllFields(self, className):
|
||||
'''Returns the (translated) names of fields of p_className.'''
|
||||
res = []
|
||||
for field in self.getAllAppyTypes(className=className):
|
||||
res.append((className.name, self.translate(className.labelId)))
|
||||
# Add object state
|
||||
res.append(('state', self.translate('workflow_state')))
|
||||
return res
|
||||
|
||||
def _appy_getSearchableFields(self, className):
|
||||
'''Returns the (translated) names of fields that may be searched on
|
||||
objects of type p_className (=indexed fields).'''
|
||||
|
@ -438,8 +429,8 @@ class ToolMixin(BaseMixin):
|
|||
if refInfo[0]:
|
||||
return refInfo[0].getAppyType(refInfo[1]).shownInfo
|
||||
else:
|
||||
toolFieldName = 'resultColumnsFor%s' % className
|
||||
return getattr(self.appy(), toolFieldName)
|
||||
k = self.getAppyClass(className)
|
||||
return hasattr(k, 'listColumns') and k.listColumns or ('title',)
|
||||
|
||||
def truncateValue(self, value, width=15):
|
||||
'''Truncates the p_value according to p_width.'''
|
||||
|
@ -469,7 +460,7 @@ class ToolMixin(BaseMixin):
|
|||
def quote(self, s):
|
||||
'''Returns the quoted version of p_s.'''
|
||||
if not isinstance(s, basestring): s = str(s)
|
||||
if "'" in s: return '"%s"' % s
|
||||
s = s.replace('\r\n', '').replace('\n', '').replace("'", "\\'")
|
||||
return "'%s'" % s
|
||||
|
||||
def getLayoutType(self):
|
||||
|
|
|
@ -786,7 +786,7 @@ class BaseMixin:
|
|||
return klass.styles[elem]
|
||||
return elem
|
||||
|
||||
def getAppyTransitions(self, includeFake=True, includeNotShowable=False):
|
||||
def getTransitions(self, includeFake=True, includeNotShowable=False):
|
||||
'''This method returns info about transitions that one can trigger from
|
||||
the user interface.
|
||||
* if p_includeFake is True, it retrieves transitions that the user
|
||||
|
@ -824,7 +824,7 @@ class BaseMixin:
|
|||
'confirm': '', 'may_trigger': True}
|
||||
if transition.confirm:
|
||||
cLabel = '%s_confirm' % label
|
||||
tInfo['confirm'] = self.translate(cLabel, format='js')
|
||||
tInfo['confirm'] = self.translate(cLabel)
|
||||
if not mayTrigger:
|
||||
tInfo['may_trigger'] = False
|
||||
tInfo['reason'] = mayTrigger.msg
|
||||
|
@ -1167,7 +1167,9 @@ class BaseMixin:
|
|||
'''Gets, according to the workflow, the roles that are currently granted
|
||||
p_permission on this object.'''
|
||||
state = self.State(name=False)
|
||||
return [role.name for role in state.permissions[permission]]
|
||||
roles = state.permissions[permission]
|
||||
if roles: return [role.name for role in roles]
|
||||
return ()
|
||||
|
||||
def appy(self):
|
||||
'''Returns a wrapper object allowing to manipulate p_self the Appy
|
||||
|
@ -1290,15 +1292,6 @@ class BaseMixin:
|
|||
if isinstance(showValue, basestring): return layoutType == showValue
|
||||
return layoutType in showValue
|
||||
|
||||
def _appy_listStates(self):
|
||||
'''Lists the possible states for this object.'''
|
||||
res = []
|
||||
workflow = self.getWorkflow()
|
||||
for elem in dir(workflow):
|
||||
if getattr(workflow, elem).__class__.__name__ != 'State': continue
|
||||
res.append((elem, self.translate(self.getWorkflowLabel(elem))))
|
||||
return res
|
||||
|
||||
getUrlDefaults = {'page':True, 'nav':True}
|
||||
def getUrl(self, base=None, mode='view', **kwargs):
|
||||
'''Returns an URL for this object.
|
||||
|
@ -1423,9 +1416,6 @@ class BaseMixin:
|
|||
if 'html' in format:
|
||||
if format == 'html_from_text': text = cgi.escape(text)
|
||||
res = text.replace('\r\n', '<br/>').replace('\n', '<br/>')
|
||||
elif format == 'js':
|
||||
res = text.replace('\r\n', '').replace('\n', '')
|
||||
res = res.replace("'", "\\'")
|
||||
elif format == 'text':
|
||||
res = text.replace('<br/>', '\n')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue