Skip to content
Browse files

- Media folder not installed with site-packages template, created on …

…the fly as needed later
  • Loading branch information...
1 parent df0beda commit 8f242f9e216ab36c4ad097b4c8a6e3b17a06fac0 @lannybroo lannybroo committed Jan 26, 2010
Showing with 6 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +0 −1 MANIFEST.in
  3. +5 −2 docx.py
  4. +0 −1 setup.py
  5. BIN template/word/media/image1.png
View
1 .gitignore
@@ -2,3 +2,4 @@
*.pyc
*.docx
build
+template/word/media
View
1 MANIFEST.in
@@ -2,5 +2,4 @@ include template/*
include template/_rels/*
include template/docProps/*
include template/word/*
-include template/word/media/*
include template/word/theme/*
View
7 docx.py
@@ -236,9 +236,12 @@ def picture(relationshiplist,picname,picdescription,pixelwidth=None,pixelheight=
and an updated relationshiplist'''
# http://openxmldeveloper.org/articles/462.aspx
- '''Create an image. Size may be specified, otherwise it will based on the pixel size of image. Return a paragraph containing the picture'''
+ '''Create an image. Size may be specified, otherwise it will based on the pixel size of image. Return a paragraph containing the picture'''
# Copy the file into the media dir
- shutil.copyfile(picname, join(template_dir,'word','media',picname))
+ media_dir = join(template_dir,'word','media')
+ if not os.path.isdir(media_dir):
+ os.mkdir(media_dir)
+ shutil.copyfile(picname, join(media_dir,picname))
# Check if the user has specified a size
if not pixelwidth or not pixelheight:
View
1 setup.py
@@ -20,7 +20,6 @@
('docx-template/_rels', glob('template/_rels/.*')),
('docx-template/docProps', glob('template/docProps/*.*')),
('docx-template/word', glob('template/word/*.xml')),
- ('docx-template/word/media', glob('template/word/media/*.*')),
('docx-template/word/theme', glob('template/word/theme/*.*')),
],
)
View
BIN template/word/media/image1.png
Deleted file not rendered

0 comments on commit 8f242f9

Please sign in to comment.
Something went wrong with that request. Please try again.