Re: REST-API: "content" Properties
Ralf Schlatterbeck <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Mar 22, 2019 at 02:06:30PM +0100, Ralf Schlatterbeck wrote: > On Thu, Mar 21, 2019 at 11:50:41AM +0100, Ralf Schlatterbeck wrote: > > Currently the "content" property of messages and files is displayed just > > as any other normal property. Especially in the case of file > > attachments, the content can be huge, making the resulting json huge in > > turn. What do you think about replacing the content property with a link > > to the actual content (the normal download link of a file or message) > > and only adding it with a @verbose option? > > I've now changed this: > I've added a @verbose parameter which controls (among others) how the > content property is displayed. With @verbose < 2 the content is > displayed as a dictionary containing a link to the download of the file > or message. With @verbose >= 2 the old behavior, displaying the content > property as a possibly very large json string is chosen. And changed it again to only display the content with @verbose >= 3 Note that display of binary file attachments will probably never work with @verbose=3, at least I'm getting an Unicode error when trying to display a PDF file: UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c in position 72: invalid start byte This is with python2. I honestly don't know what would happen if we attach the file as a byte string in python3, if the json serializer can handle this. Ralf -- Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16 Open Source Consulting www: http://www.runtux.com Reichergasse 131, A-3411 Weidling email: [email protected]