Need to programmatically change image content
Hello, I need to programmatically replace the 'content' (e.g. the image file data, if I grok correctly) of an Image object with new data via file upload from web form. I imagine I could just delete the existing object and then add the new one... Is that the best/easiest way, or is there some slick way to replace the image file data for a given Image object? thanks, John S. __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
John Schinnerer wrote:
Is that the best/easiest way, or is there some slick way to replace the image file data for a given Image object?
Look at the source of the ZMI for the Image edit tab,. it'll show you what method to use ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
John Schinnerer wrote at 2004-3-26 16:12 -0800:
I need to programmatically replace the 'content' (e.g. the image file data, if I grok correctly) of an Image object with new data via file upload from web form.
Look at "manage_upload"... -- Dieter
Aloha, I have a web form - part of a python product that provides a client with some content management (e.g. content editing) on their site. Some of the fields are textarea, into which I need to populate the current contents of a lines property. Current code is for example: <textarea name="sponsors:lines" rows="6" cols="60"><span tal:repeat="line here/sponsors" tal:omit-tag=""><span tal:replace="line" /> </span></textarea> I have to have a newline after the tal:replace="line" tag or all the lines items run together on one line. This also adds a blank line after the last item in the field, which is saved when the form is next submitted...and so on, and on... Plus I have to have no newlines anywhere else or they each one inserts a blank line in the field, which is not the source formatting I'd prefer. How can I avoid these problems? Is there some clever TAL, or do I need to use python somehow? Any help appreciated, thanks, John S. _______________________________ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush
On 2 Sep 2004 at 2:40, John Schinnerer wrote:
Current code is for example:
<textarea name="sponsors:lines" rows="6" cols="60"><span tal:repeat="line here/sponsors" tal:omit-tag=""><span tal:replace="line" /> </span></textarea>
How about <textarea name="sponsor:lines" rows="6" cols="60" tal:content="python:'\n'.join(here.sponsors)"> </textarea> -- Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax http://www.wecanstopspam.org/ AOL-IM: BKClements
John Schinnerer wrote at 2004-9-2 02:40 -0700:
I have a web form - part of a python product that provides a client with some content management (e.g. content editing) on their site. Some of the fields are textarea, into which I need to populate the current contents of a lines property.
Current code is for example:
<textarea name="sponsors:lines" rows="6" cols="60"><span tal:repeat="line here/sponsors" tal:omit-tag=""><span tal:replace="line" /> </span></textarea>
The most natural way works: <textarea name="lines:lines"> <tal:span repeat="line here/lines" content="line"/> </textarea> -- Dieter
Aloha, --- Dieter Maurer <dieter@handshake.de> wrote:
The most natural way works:
<textarea name="lines:lines"> <tal:span repeat="line here/lines" content="line"/> </textarea>
Thanks, that does work, if I change it thusly: <textarea name="lines:lines"> <tal:span repeat="line here/lines" content="line"/></textarea> ...otherwise the newline before </textarea> ends up in the textarea as with my previous code. I thought I was finally getting somewhat familiar with TAL, but I have not seen this syntax:
<tal:span repeat="line here/lines" content="line"/>
I have only seen this sort of syntax: <span tal:repeat="line here/lines" /> and <span tal:repeat="line here/lines" content="line"/> does not work here... ...so your simple solution is not at all natural to me - can you please explain or tell me where there is an explanation of this differnt syntax? thanks, John S. __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
participants (4)
-
Brad Clements -
Chris Withers -
Dieter Maurer -
John Schinnerer