Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1427 (closed defect: invalid)

Opened 12 years ago

Last modified 11 years ago

FileField evaluates to the actual file content and thus breaks output

Reported by: wmark Owned by: anonymous
Priority: normal Milestone: 1.5
Component: TG Widgets Version: 1.0.2
Severity: normal Keywords:
Cc:

Description

Given that you added a FileField to a WidgetsList you will be able to upload files (such as images).

But, if you use that WidgetsList in a form to display current data and if that FileField is linked with a existing model's attribute...

what currently is

... the value of that attribute is displayed. If it is an image being stored in database, this will rise an exception and thus break output. (ValueError with KID as of malformed output)

expected

... the form should contain something like "a file exists" or any other indicator that there is something (or not/None) - but not the content itself!

Change History

comment:1 Changed 12 years ago by Chris Arndt

  • Milestone changed from 1.0.3 to 1.0.4

Batch promoting 1.0.3 tickets to Milestone 1.0.4

comment:2 Changed 12 years ago by Chris Arndt

Can you please provide some code that exhibits the problem?

comment:3 Changed 12 years ago by wmark

Trivial:

class ContactFields(WidgetsList):
    title   = TextField(label=_("title"))
    fname   = TextField(label=_("first name"))
    lname   = TextField(label=_("last name"))
    photo   = FileField(label=_("photo"))

contact_form = TableForm(
    fields=ContactFields(),
    submit_text=_("save")
)

Methods are similar to those described in the TG book, chapter 4. Thus, the data is displayed by the form, too. (New, edit/save)

comment:4 Changed 12 years ago by Chris Arndt

The widget code alone is not enough to see what your trying to do. Please post relevant controller and template code. Use a  pastebin service and post the URL here.

comment:5 Changed 11 years ago by faide

  • Milestone changed from 1.0.4 to 1.1

comment:6 Changed 11 years ago by Chris Arndt

  • Status changed from new to closed
  • Resolution set to invalid

This ticket has not received feedback for over a year and there is not enough information to reproduce the problem. Closing this ticket as invalid. If you can provide more information, feel free to re-open ticket.

Note: See TracTickets for help on using tickets.