Thanks, Andreas, for the pointer to kotti. I tried to use the
FileUploadTempStore implementation that kotti uses with the deform upload
widget instead of the standard from one from
pyramid_deform.SessionFileUploadTempStore, hoping that it's __getitem__ and
__setitem__ were going to change how this works. Sadly it didn't - the
problem seems to be closer to the depot side of things rather than the
deform.

Has someone got an example of a working combo of these two libraries? I can
add more detail about the form schema that I used to connect this all up.
As I said, it works on Windows, but fails on Posix platforms, so I can't be
too wrong.

Thanks again,
Luke


On Wed, 30 Sep 2020 at 14:10, Andreas Kaiser <[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/pylons-discuss/85F70C79-E652-4E0C-8ACE-B72C83BF9617%40binary-punks.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAPBagu8rFaS5HbeDcZ_ews%3DoC%2Bv9xAWdOBtZj0wabXdDHhpU%2BA%40mail.gmail.com.

Reply via email to