I got back to it and figured this out today.  I worked off of the
moin2trac.py script.  Here is some sample code for future reference:

import os
from trac.attachment import Attachment
from trac.admin.console import TracAdmin

wikidir = r'C:\Path\To\My\TracProject'

admin = TracAdmin()
admin.env_set(wikidir)

filename = r'c:\Path\To\My\Images\2_0.jpg'

attachment = Attachment(admin.env_open(), 'wiki', 'tutorials/page1')

size = os.stat(filename)[6]
attfile = open(filename,'rb')

attachment.insert(os.path.basename(filename), attfile, size)

Cheers,
Joseph Armbruster
http://libjoe.blogspot.com/2009/05/trac-wiki-insert-images-programatically.html


On May 27, 4:14 pm, "[email protected]"
<[email protected]> wrote:
> Using Trac-0.11.4 is there a way to "add attachment" to a page using
> trac-admin?
>
> Thank You,
> Joseph Armbruster

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to