appy.gen: generalized use of appy.Object; existence of a field value (that triggers search for a default value) is now based on Type.isEmptyValue, and not '==None'; bugfix with default values for List fields; prevent search icon to be shown for a Ref when there is no linked object; appy.pod: added class appy.pod.parts.OdtTable that allows to create a complex (ie, with a dynamic number of columns) table programmatically (to be imported with a statement 'do ... from'); appy.shared.diff: improvements in the multiple XHTML diff; appy.shared.xml_parser.XmlMarshaller: support for default namespaces and 'any' tags.
This commit is contained in:
parent
1ebcbb7b34
commit
3ab6cec7d6
9 changed files with 147 additions and 68 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
# ------------------------------------------------------------------------------
|
||||
import os, os.path, sys, types, mimetypes, urllib, cgi
|
||||
from appy import Object
|
||||
import appy.gen
|
||||
from appy.gen import Type, String, Selection, Role, No, WorkflowAnonymous, \
|
||||
Transition, Permission
|
||||
|
@ -206,9 +207,9 @@ class BaseMixin:
|
|||
return self.goto(urlBack)
|
||||
|
||||
# Object for storing validation errors
|
||||
errors = AppyObject()
|
||||
errors = Object()
|
||||
# Object for storing the (converted) values from the request
|
||||
values = AppyObject()
|
||||
values = Object()
|
||||
|
||||
# Trigger field-specific validation
|
||||
self.intraFieldValidation(errors, values)
|
||||
|
@ -435,7 +436,8 @@ class BaseMixin:
|
|||
# broken on returned object.
|
||||
return getattr(self, methodName, None)
|
||||
|
||||
def getFieldValue(self, name, onlyIfSync=False, layoutType=None):
|
||||
def getFieldValue(self, name, onlyIfSync=False, layoutType=None,
|
||||
outerValue=None):
|
||||
'''Returns the database value of field named p_name for p_self.
|
||||
If p_onlyIfSync is True, it returns the value only if appyType can be
|
||||
retrieved in synchronous mode.'''
|
||||
|
@ -445,7 +447,8 @@ class BaseMixin:
|
|||
if '*' not in name: return appyType.getValue(self)
|
||||
# The field is an inner field from a List.
|
||||
listName, name, i = name.split('*')
|
||||
return self.getAppyType(listName).getInnerValue(self, name, int(i))
|
||||
listType = self.getAppyType(listName)
|
||||
return listType.getInnerValue(outerValue, name, int(i))
|
||||
|
||||
def getFormattedFieldValue(self, name, value):
|
||||
'''Gets a nice, string representation of p_value which is a value from
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
</tal:noObject>
|
||||
|
||||
<tal:comment replace="nothing">If there is an object...</tal:comment>
|
||||
<tal:objectIsPresent condition="objs">
|
||||
<tal:objectIsPresent condition="python: objs">
|
||||
<tal:obj repeat="obj objs">
|
||||
<td tal:define="includeShownInfo python:True"><metal:showObjectTitle use-macro="app/skyn/widgets/ref/macros/objectTitle" /></td>
|
||||
</tal:obj>
|
||||
|
@ -161,7 +161,7 @@
|
|||
(<span tal:replace="totalNumber"/>)
|
||||
<metal:plusIcon use-macro="app/skyn/widgets/ref/macros/plusIcon"/>
|
||||
<tal:comment replace="nothing">The search icon if field is queryable</tal:comment>
|
||||
<a tal:condition="appyType/queryable"
|
||||
<a tal:condition="python: objs and appyType['queryable']"
|
||||
tal:attributes="href python: '%s/skyn/search?type_name=%s&ref=%s:%s' % (tool.absolute_url(), linkedPortalType, contextObj.UID(), appyType['name'])">
|
||||
<img src="search.gif" tal:attributes="title python: _('search_objects')"/></a>
|
||||
</legend>
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
layout python: widget['layouts'][layoutType];
|
||||
name widgetName| widget/name;
|
||||
sync python: widget['sync'][layoutType];
|
||||
rawValue python: contextObj.getFieldValue(name, onlyIfSync=True, layoutType=layoutType);
|
||||
outerValue value|nothing;
|
||||
rawValue python: contextObj.getFieldValue(name,onlyIfSync=True,layoutType=layoutType,outerValue=outerValue);
|
||||
value python: contextObj.getFormattedFieldValue(name, rawValue);
|
||||
requestValue python: contextObj.getRequestFieldValue(name);
|
||||
inRequest python: request.has_key(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue