[gen] Added px.override allowing to modify PX code; bugfixes; added migration code for converting File instances to FileInfo instances.
This commit is contained in:
parent
be145be254
commit
c002b5cb59
8 changed files with 71 additions and 21 deletions
|
@ -181,7 +181,7 @@ class File(Field):
|
|||
|
||||
pxView = pxCell = Px('''
|
||||
<x var="downloadUrl='%s/download?name=%s' % (zobj.absolute_url(), name);
|
||||
shownSize=value.getShownSize()">
|
||||
shownSize=value and value.getShownSize() or 0">
|
||||
<x if="value and not field.isImage">
|
||||
<a href=":downloadUrl">:value.uploadName</a> -
|
||||
<i class="discreet">:shownSize</i>
|
||||
|
@ -319,7 +319,11 @@ class File(Field):
|
|||
dbFolder, folder = zobj.getFsFolder(create=True)
|
||||
# Remove the previous file if it existed.
|
||||
info = getattr(obj.aq_base, self.name, None)
|
||||
if info: info.removeFile(dbFolder)
|
||||
if info:
|
||||
# The previous file can be a legacy File object in an old
|
||||
# database we are migrating.
|
||||
if isinstance(info, FileInfo): info.removeFile(dbFolder)
|
||||
else: delattr(obj, self.name)
|
||||
# Store the new file. As a preamble, create a FileInfo instance.
|
||||
info = FileInfo(folder)
|
||||
cfg = zobj.getProductConfig()
|
||||
|
|
|
@ -306,7 +306,7 @@ class UiGroup:
|
|||
<!-- Group content -->
|
||||
<div var="display=expanded and 'display:block' or 'display:none'"
|
||||
id=":field.labelId" style=":'padding-left: 10px; %s' % display">
|
||||
<x for="searches in field.widgets">
|
||||
<x for="searches in field.elements">
|
||||
<x for="elem in searches">
|
||||
<!-- An inner group within this group -->
|
||||
<x if="elem.type == 'group'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue