Hi Luke,
unfortunately I don’t have the time to look up the details right now,
but Kotti (https://github.com/Kotti/Kotti/) has been using Deform and
Filedepot for years. It has an additional layer (for historical reasons)
with its ``File`` resource type, so that may not translate 1:1 to your
use case, but you might find some information in its sources, especially
https://github.com/Kotti/Kotti/blob/master/kotti/resources.py#L721.
HTH,
Andreas
On 30 Sep 2020, at 13:37, Luke Tunmer wrote:
I'm struggling to get a form which uses a FileUploadWidget to
cooperate
with a model that uses filedepot's UploadedFileField as a column type.
It
works fine on Windows, but fails on a "posix" like platform - both
Linux
and Mac.
The problems seems to be that when I extract the "fp" entry from the
value
of my particular widget it seems to be a different thing between the
two
platforms. On Windows this is a tempfile._TemporaryWrapper, which
contains
a _io.BufferedRandom in it's 'file' attribute. On Posix the 'fp' entry
is
the io.BufferedRandom object directly.
Down in the guts of depot this object (called 'content') is then
expected
to have a 'filename' attribute, or failing that 'name' attribute. It
happens to have a 'name' attribute, but this is the integer value of
the
socket descriptor and not any file name. The code is expecting to have
a
str at this point, and so an exception is raised.
I'm sure that combining these two technologies is quite common, so I
must
be doing something wrong.
I have also had to patch another "impedance mismatch" between these
two
libraries - the FileData that is passed to the colandar.SchemaNode has
to
be overridden to fix the lack of 'uid' attribute in the data that is
being
serialized. Is there something I have to do in the deserialize method
as
well?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/85F70C79-E652-4E0C-8ACE-B72C83BF9617%40binary-punks.com.