customconfig.py Not Working!

71 views
Skip to first unread message

Vasily

unread,
Apr 30, 2009, 2:38:30 PM4/30/09
to mwlib
PDF output from the Collection extension is coming out in A4 format,
and I want to add a standard company footer to each page. We're
running MediaWiki 1.13.2, and Collection version 1.2. I created a
customconfig.py file as discussed in another thread here, and we
placed it at

/usr/local/lib/python2.6/site-packages/mwlib.rl-0.10.2-py2.6.egg/mwlib/
rl/

but it's not working - I'm still getting A4 page format, and no
footer. Any suggestions would be most welcome. Source for
customconfig.py follows:

------------------------- snip -----------------------

#! /usr/bin/env python
#! -*- coding:utf-8 -*-

######### PAGE CONFIGURATION

from reportlab.lib.units import cm, inch
new_size = (8.5*inch, 11*inch)

######### PAGE CONFIGURATION
pageMarginHor = 1 * inch
pageMarginVert= 1 * 1nch
pageWidth, pageHeight = new_size
printWidth = pageWidth - 2*pageMarginHor
printHeight = pageHeight - 2*pageMarginVert
pagefooter = '<img src="https://ourpathtothewiki/wiki/extensions/
newedgesmall.gif" width="75px height="20px" valign="bottom" /><br /
>PROPRIETARY AND CONFIDENTIAL<br />Not for Use or Disclosure Outside
of Company<br />(c) Company 2009, All Rights Reserved'

Volker Haas

unread,
May 4, 2009, 8:15:44 AM5/4/09
to mw...@googlegroups.com
Hi Vasily,

there seems to be a typo in your customconfig.py:

pageMarginVert= 1 * 1nch

1nch should be inch ;)

If that is fixed, I can generate a letter format PDF with a custom footer.

But this is not the reason for the problem. Your customconfig.py file is
not used. Make sure the file is placed somewhere where it can be found
by python. e.g. place it in your homedirectory and add your
homedirectory to the PYTHONPATH environment variable.

Hope this helps,

Volker

p.s. Take a look at section 6.3 of the reportlab manual for more info on
styling text reportlab text for your page footer. the manual is
available at http://www.reportlab.org/os_documentation.html
--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstraße 64
fax +49 6131 2116392 55118 mainz
volke...@brainbot.com http://www.brainbot.com/

Vasily

unread,
May 4, 2009, 8:37:55 AM5/4/09
to mwlib
Thanks, Volker; I'll read that manual section and try it out!

Vasily

Vasily

unread,
May 11, 2009, 3:11:02 PM5/11/09
to mwlib
We placed customconfig.py in the mwlib folder where the other Python
files reside - shouldn't it pick it up from there? If not, where do we
find the PYTHONPATH variable definition?

Vasily

On May 4, 7:15 am, Volker Haas <volker.h...@brainbot.com> wrote:

Vasily

unread,
May 13, 2009, 12:20:41 PM5/13/09
to mwlib
OK, no replies yet so let me try to clarify my question.

We've fixed the typo in customconfig.py, but it's still not working.
The symptom is: when we print to PDF, the rendering appears to start
up but it stays at 0%.

We're not sure what you're saying about PYTHONPATH: my colleague
placed customconfig.py in this folder:

/usr/local/lib/python2.6/site-packages/mwlib.rl-0.10.2-py2.6.egg/mwlib/
rl/

which is where the other Python stuff is, but that apparently isn't
correct. Is that where PYTHONPATH is pointing? Or do we need to place
the file somewhere else and point to it?

Vasily

Volker Haas

unread,
May 14, 2009, 5:53:18 AM5/14/09
to mw...@googlegroups.com
Hi Vasily

Vasily wrote:
> We've fixed the typo in customconfig.py, but it's still not working.
> The symptom is: when we print to PDF, the rendering appears to start
> up but it stays at 0%.
>

So there is no PDF generated at all? If that is the case, something else
is wrong. Check the log files and post them to the mailing list.

> We're not sure what you're saying about PYTHONPATH: my colleague
> placed customconfig.py in this folder:
>

You need to set an environment variable PYTHONPATH, on Unix/Linux
machines you typically set them in your .bashrc file. In your case the
PYTHONPATH needs to be set to the path where the customconfig.py file is
located - the most convenient should be your home directory.

Regards,
Volker

Vasily

unread,
May 18, 2009, 9:13:28 AM5/18/09
to mwlib
We've gotten the footer to work now - thanks for the tips, Volker!

However, I'd like to make the footer larger to fit multiple lines in
it ... are there Python variables to control the top and bottom
margins separately (say, pageMarginTop and pageMarginBot)? Is there a
complete set of page formatting variables out there for MWLib?

Vasily

Volker Haas

unread,
Jun 2, 2009, 10:09:30 AM6/2/09
to mw...@googlegroups.com
Hi Vasily,

I removed
* pageMarginHor
* pageMarginVert

and added

* page_margin_top
* page_margin_bottom
* page_margin_left
* page_margin_right

This should probably be what you want. Hope this helps.

Regards,
Volker
Reply all
Reply to author
Forward
Message has been deleted
0 new messages