Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamView is broken #75

Closed
1letter opened this issue Oct 19, 2020 · 6 comments · Fixed by #78
Closed

StreamView is broken #75

1letter opened this issue Oct 19, 2020 · 6 comments · Fixed by #78

Comments

@1letter
Copy link
Contributor

1letter commented Oct 19, 2020

I get a traceback if the Video Source should be played.

Traceback (most recent call last):
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/channel.py", line 350, in service
    task.service()
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/task.py", line 171, in service
    self.execute()
  File "/Development/Plone/SOSNET/eggs/waitress-1.4.4-py3.8.egg/waitress/task.py", line 441, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "/Development/Plone/SOSNET/eggs/Paste-3.4.1-py3.8.egg/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/httpexceptions.py", line 30, in __call__
    return self.application(environ, start_response)
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/WSGIPublisher.py", line 377, in publish_module
    status, headers = response.finalize()
  File "/Development/Plone/SOSNET/eggs/Zope-4.5-py3.8.egg/ZPublisher/HTTPResponse.py", line 1056, in finalize
    self.setHeader('content-length', len(self.body))
TypeError: object of type 'filestream_range_iterator' has no len()
  • The View /test1/@@view/++widget++form.widgets.IVideo.video_file/@@stream is the MediaStream class in widget.py .
  • It use a helper methdod of plone.namedfile.utils .
  • The filestream_range_iterator implements IStreamIterator from ZPublisher.Iterators

But the interface IStreamIterator required a method __ len __() per definition. It's not implemented in the filestream_range_iterator.

Versions:
plone.namedfile 5.4.0
wildcard.media 2.1.0
Plone 5.2.2 py3

@ale-rt
Copy link
Member

ale-rt commented Oct 19, 2020

I recently added this plone/plone.dexterity#139 to plone.dexterity.
What happens if you pin plone.dexterity 2.10.0?

@1letter
Copy link
Contributor Author

1letter commented Oct 19, 2020

That doesn't help. I pinned the version to 2.10.0 and run the buildout. But the error don't go away.

@ale-rt
Copy link
Member

ale-rt commented Oct 19, 2020

You are right, I did not notice it was another adapter:
https://github.com/plone/plone.namedfile/blob/14c1a3539cee99c3983adeb28eca5117272b7591/plone/namedfile/utils/__init__.py#L74-L75
Anyway the fix should be similar to plone/plone.dexterity#139

@1letter
Copy link
Contributor Author

1letter commented Oct 19, 2020

i will check it. thanks for hint

@1letter
Copy link
Contributor Author

1letter commented Oct 19, 2020

i think it's a incorrect interface @ale-rt , see here my comment

mamico added a commit that referenced this issue Jun 14, 2022
@mamico
Copy link
Contributor

mamico commented Jun 14, 2022

filestream_range_iterator is a pseudo stream implementation, you need to have all the file available, but you can expose parts of them using HTTP Range headers. I was wondering why a similar issue was not reported in plone.namedilfe, so I double-checked and found differences between here and plone.namedfile. @1letter please check if #78 solves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants