Comments (6)
I could solve the problem by downgrading Products.Archetypes to 1.8.3. Plone 4.2.2 installed Archetypes 1.8.4 by default. Not sure if this pinning has other side effects, at least my form runs fine again.
from products.ploneformgen.
Products.Archetypes.Field.FileField._make_file blindly passes the PFGFileField into constructor.
This is kinda interesting in that.. Why cant you get to the data of the PFGFile easily? It seems you
need to know the name of the field id to access the value..
Patching _make_file with the below works.. This is certainly a problem with AT I think
def _pfg_make_file(self, id, title='', file='', instance=None):
"""File content factory. Awful practice passing in a builtin, file in signature"""
if getattr(file, 'seek', None) is None:
logger.info("%s does not have seek method using empty string as value" % file)
file = ''
return self.content_class(id, title, file)
from products.ploneformgen.
This part has never changed before. What has changed in 1.8.4 was that a mimetype icon gets added. This triggers the make file code which wasnt triggered before.
It seems wrong to me that Archetypes gets a Products.PloneFormGen.content.fields.FGFileField object which is a schema but nothing file like.
I opted to add these methods to FGFileField:
def seek(self, offset, whence=None):
return
def read(self, size=None):
return ''
def tell(self):
return 0
Since the FGFileField is not in risk being used as a file for an uploaded file, I believe this to be pretty safe.
from products.ploneformgen.
I can confirm that the patch provided by runyaga works. I rebuild my testinstance with Archetypes 1.8.4 to reproduce the error. When I applied the patch to /buildout-cache/eggs/Products.Archetypes-1.8.4-py2.7.egg/Products/Archetypes/Field.py the error was gone.
Applying the other patch from do3cc solves the problem as well. I am not sure if custom validators on file fields might be affected if they make use of the methods involved. Is the assumption "Since the FGFileField is not in risk being used as a file..." correct?
from products.ploneformgen.
I can't really tell. In only feel pretty confident that my patch would not worse the situation. A PGFileField never behaved like a File like object, so if anybody expected that would have failed before the change too.
Because I can't really tell I am not going to try to fix it myself.
from products.ploneformgen.
I've done a quick test, and the validation still works fine with do3cc's patch (thanks!)
Since I needed this for a project, I've forked the repo and will do a pull request
https://github.com/huubbouma/Products.PloneFormGen
from products.ploneformgen.
Related Issues (20)
- UnicodeDecodeError with umlauts or euro sign in 1.7.20: 'ascii' codec can't decode... HOT 1
- verification failed message is incorrect HOT 2
- PFG 1.7.x not compatible with jQuery 1.9+ HOT 2
- Issue in htmlValue of FGLinesField
- Remove collective.cover adapter HOT 2
- Fix tests with Plone 5.0.7 HOT 1
- Unauthorized exceptions due to creation of demo content without a security context
- Select field without default value -> last item selected HOT 1
- Some strings ('No input') in code are not internationalized (Validators too) HOT 1
- Why do I need to reinstall Products.PloneFormGen if I add a captcha later on? HOT 4
- Anon can see mailer info
- Option to use field titles in save adapter instead of names
- Improve error message when collective.recaptcha is not (yet) configured
- Travis doesn't check PRs? HOT 3
- toolbox does not display property in Chrom
- Rich Label field body disappears on edit
- Adding a text field via Quickedit leads to unicodedecode error
- Forms and Site Setup Configuration broken under Plone 5.2.0 HOT 1
- 5.2.0 cannot enable it HOT 5
- Need to have unique id for fields in fieldsets HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from products.ploneformgen.