stargeek
PHP news website logo.
home    PHP scripts    articles    seo tools    links    search    contact    shop    realtors


Pydoc









Similar Items

Pydoc

Grok Headline matches for Pydoc

Running Pydoc under mod_python


Running Pydoc under mod_python 10/07/2004 04:11 PM

I've written about pydoc before. In my opinion it's one of Python's best kept secrets: a way of instantly browsing the properties, methods and documentation strings of any module available to the Python environment. It can even run a local HTTP server to allow for easy browsing of available documentation.

That's all well and good for code running on your local machine, but most developers won't want to run a Pydoc server on a remote machine. We ran in to this problem recently at work; we wanted to run Pydoc on our development server but didn't want it exposed to the world at large.

Initially we considered running the regular Pydoc server locally on some random port, blocking that port to external IPs with a firewall rule and then using Apache's mod_proxy to open it up to outside access in a controlled manner. The downside with this is that we would have to run a special process and a firewall rule just to enable a relatively minor function. Instead, I spent some time working through the pydoc.py source code and came up with a mod_python wrapper for the HTML documentation part of the module.

modpydoc.py

(Aside: Safari will try to render the above as HTML, even though the Content-Type header says text/plain. This is because Safari is brain-dead - it inherited this particular grotesqueness from Internet Explorer. I still use it though.)

Since we were already running mod_python on our development server, adding this extra module required no extra server configuration or additional server processes. It also allowed us to tie authentication for the resulting Pydoc instance to our existing authentication database, using mod_auth_pgsql.

For the inquisitive, here's a rough approximation of the relevant parts of our httpd.conf file for that server:


LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_pgsql_module modules/mod_auth_pgsql.so
LoadModule python_module modules/mod_python.so

RedirectMatch permanent /pydoc$ /pydoc/

<Location "/pydoc/">
    SetHandler python-program
    PythonHandler utils.modpydoc
    PythonPath "sys.path+['/path/to/our/codebase/']"
    AuthName "Code Browser"
    AuthType basic
    Auth_PG_database ourdb
    Auth_PG_user dbuser
    Auth_PG_pwd_table users
    Auth_PG_uid_field username
    Auth_PG_pwd_field password_md5
    Auth_PG_pwd_whereclause " AND can_browse_code = 't' "
    Auth_PG_hash_type MD5
    require valid-user
</Location>

Grok Description matches for Pydoc
GrokA matches for Pydoc

Perl/DBI developer on Linux/Postgres


Perl/DBI developer on Linux/Postgres 03/30/2005 05:57 PM
NTA-Monitor - United Kingdom, Kent, Rochester (2005-03-30)

perl-tutorial-DE_2.01


perl-tutorial-DE_2.01 04/06/2005 03:37 PM

Perl tutorial/article writers.


Perl tutorial/article writers. 09/11/2004 09:18 AM
Alex - Serbia & Montenegro, Serbia, Belgrade (2004-09-11)

WebGUI / Postgres HOWTO


WebGUI / Postgres HOWTO 12/16/2002 10:11 AM
Submission by Fred Maco PostgreSQL Not everybody is a MySQL fan. I myself prefer Postgres. Luckily, the folks over at Plain Black have made it easy to run my favorite CMS on my favorite database. Here's how:

Compiere on Postgres/MySQL


Compiere on Postgres/MySQL 11/03/2003 08:52 AM

CodeMeX postgres-mySQL PHP Portal


CodeMeX postgres-mySQL PHP Portal 12/13/2003 10:33 AM
Estado del proyecto.

New packs could 'help criminals'


New packs could 'help criminals' 07/04/2004 08:09 PM
New proposals for the home buying and selling process could benefit criminals, warns the Law Society.

'Help catch my mother's killer'


'Help catch my mother's killer' 05/21/2004 08:22 AM
The daughter of an elderly woman murdered in Stirling appeals for help to catch her killer.

iPods to 'help US students study'


iPods to 'help US students study' 07/21/2004 07:34 AM
Over 1,500 new students at an American university are being kitted out with iPods to help them learn.

McConnell's 'help others' message


McConnell's 'help others' message 12/30/2004 04:25 AM
First Minister Jack McConnell believes Scotland has a duty to help other countries hit by disasters.

'Help! I married a Net porn star'


'Help! I married a Net porn star' 02/13/2004 01:28 PM
Man encounters wife on amateur smut site

'Help find our father's killer'


'Help find our father's killer' 03/29/2005 11:18 AM
A family appeals for people to come forward after a man is found with fatal injuries behind a pub in Cumbernauld.

Kerry to American Voters: 'Help Is on
the Way' (Reuters)


Kerry to American Voters: 'Help Is on
the Way' (Reuters)
07/30/2004 10:15 AM
Reuters - Eight hours after his coronation at the Democratic convention, U.S. presidential candidate John Kerry hit the campaign trail on Friday on a cross-country road trip through battleground states to tell voters "help is on the way."

HTML Tip: Spaces Around HREF Tags


HTML Tip: Spaces Around HREF Tags 11/30/2002 12:30 AM
Net Mechanic Nov 29 2002 11:13PM ET

Today I am a href="http://www.koshernosh.com/yiddish.
htm">badhkin


Today I am a href="http://www.koshernosh.com/yiddish.
htm">badhkin
02/16/2004 10:35 AM
From eagle-eyed Mike O'Dell comes this image, which he says is "pretty hard to explain." No argument here....

<a
href="http://www.kk.org/recomendo/archiv
es/000053.php">50 centuries of
history


<a
href="http://www.kk.org/recomendo/archiv
es/000053.php">50 centuries of
history
10/30/2003 08:17 PM
<a href="http://www.kk.org/recomendo/archives/000053.php">50 centuries of history mapped out.</a>...

<a
href="http://www.bogieland.com/nl/index.
htm">Peter Bogaards starts an


<a
href="http://www.bogieland.com/nl/index.
htm">Peter Bogaards starts an
10/30/2003 08:17 PM
<a href="http://www.bogieland.com/nl/index.htm">Peter Bogaards starts an IA company in Holland</a>....

Scott Mcloud has <a
href="http://www.scottmccloud.com/comics
/trn/intro.html">a


Scott Mcloud has <a
href="http://www.scottmccloud.com/comics
/trn/intro.html">a
10/30/2003 08:17 PM
Scott Mcloud has <a href="http://www.scottmccloud.com/comics/trn/intro.html">a new online comic</a> featuring micropayments (it's .25c)....

<a
href="http://www.kk.org/helpwanted/archi
ves/000040.php#comments">Kevin Kelly
-- Help


<a
href="http://www.kk.org/helpwanted/archi
ves/000040.php#comments">Kevin Kelly
-- Help
10/30/2003 08:17 PM
<a href="http://www.kk.org/helpwanted/archives/000040.php#comments">Ke vin Kelly -- Help Wanted</a>: who rejects technology?...

<a
href="http://scriptingnews.userland.com/
2003/06/29#When:6:21:27AM">Dave
Winer</a>: "I make


<a
href="http://scriptingnews.userland.com/
2003/06/29#When:6:21:27AM">Dave
Winer</a>: "I make
10/30/2003 08:17 PM
<a href="http://scriptingnews.userland.com/2003/06/29#When:6:21:27AM"> Dave Winer</a>: "I make shitty software and I write shitty specs, but for all that shittyness, they're amazingly popular and somewhat useful."...

<a
href="http://www.lisjobs.com/newsletter/
archives/text/jul03.txt">Paths to
Librarianship</a>


<a
href="http://www.lisjobs.com/newsletter/
archives/text/jul03.txt">Paths to
Librarianship</a>
10/30/2003 08:17 PM
<a href="http://www.lisjobs.com/newsletter/archives/text/jul03.txt">Pa ths to Librarianship</a>...

Fighting comment spam, linking without
google juice and other reasons to use
the new href attribute


Fighting comment spam, linking without
google juice and other reasons to use
the new href attribute
02/01/2005 08:40 PM
Fighting blog spam, allowing linking to people you don't like without giving them Googlejuice. The new link attribute has many applications. Most like it, but some think its a bad idea.

<a
href="http://www.benhammersley.com/dparc
hives/004201.html">Ben Hammersley's
Dangerous Precedent:


<a
href="http://www.benhammersley.com/dparc
hives/004201.html">Ben Hammersley's
Dangerous Precedent:
10/30/2003 08:17 PM
<a href="http://www.benhammersley.com/dparchives/004201.html">Ben Hammersley's Dangerous Precedent: Echo...echo...alright enough already</a>: "given a complete Echo spec, the launch of a new product could gut a lesser rival's customer base in a matter of hours."...

Vulns: Microsoft Internet Explorer HREF
Save As Denial of Service Vulnerability


Vulns: Microsoft Internet Explorer HREF
Save As Denial of Service Vulnerability
06/19/2004 01:39 PM
SecurityFocus Jun 19 2004 5:12PM GMT

href="http://www.sfgate.com/cgi-bin/arti
cle.cgi?file=/chronicle/archive/2003/11/
23/MNGG53925E1.DTL">FBI Scrutinizing
Anti-War Protestors


href="http://www.sfgate.com/cgi-bin/arti
cle.cgi?file=/chronicle/archive/2003/11/
23/MNGG53925E1.DTL">FBI Scrutinizing
Anti-War Protestors
11/25/2003 10:32 PM
Hello! That's me, the 107,356th person back, just to the left of that nice old man in the green baseball cap. Helloooo!...

Perl Developer! - Market Leader! -
Perl,MySQL,Apache


Perl Developer! - Market Leader! -
Perl,MySQL,Apache
02/01/2005 09:51 PM
Alan Morris Recruitment - United Kingdom, London (2005-02-01)

");document.write(tite);document.write("


");document.write(tite);document.write(" 05/01/2004 10:43 PM
Run for the Roses at Churchill Downs .. Kentucky Derby is this Saturday

kentuckyderby.com/2004
track this site | 4 links


Meta-reflective Postmodern recreation of
href="http://www.artchive.com/meninas.ht
m">Las Meninas, this time titled
"Four Fools with Three Cameras"


Meta-reflective Postmodern recreation of
href="http://www.artchive.com/meninas.ht
m">Las Meninas
, this time titled
"Four Fools with Three Cameras" 03/14/2005 05:40 PM
Ethan has posted about 15 seconds of an odd moment at Martin Varsavsky's party. Of Ethan, Joi, and Dan G, I seem to be the only one with the good sense to be holding a glass of wine instead of a camera....

<a
href="http://my-expressions.com/about.sh
tml">Expressions - a visual


<a
href="http://my-expressions.com/about.sh
tml">Expressions - a visual
10/30/2003 08:17 PM
<a href="http://my-expressions.com/about.shtml">Expressions - a visual blogging system</a>: "Expressions is a hosted visual blogging system that makes it easy for anyone to create and maintain their very own photo or visual blog." Cool....

CSS Tutorial


CSS Tutorial 07/21/2004 07:50 AM

Selectutorial: CSS selectors: Here's a fantastic CSS tutorial which includes a 22-step guide to go from this to this through nothing but CSS. They're even nice enough to show you the BrowserCam results. Very well done.

Click here to comment on this entry


Pydoc

The following phrases have been identified by the grok system as matching this entry: "xml to postgres" perl @moz-document tutorial

















Also check out:


Grok

Ipod Porn on the
Rise

Brief Abstract of
Wikipedia's
Mesothelioma Cancer
page

Get first aid
instructions in your
cell phone

IE is crap
JSPWiki gains
podcasting support

Quicksilver
Abusing the command
line

Conferences with
Macs

It's only going to
get worse

Omit needless words,
codified

1GB of webmail from
Google

Thanks a bundle, HP
Microsoft "get"
blogging

Personalisation?
We've already got it

What is Google?
Glastonbury screw-up
Missed opportunity
Giant Easter Egg
minority extremists
Retro or Classic?
Do you know Jack?
New Zealand critic
blasts LOTR

If you close your
eyes, it's delicious

pnac vulcan;s empire
iraq factions

Frantisek Staud
pete the porno
puppet

GBV! GBV! GBV!
and here I thought
languagehat had
coined the term

Y3K
All that was left
was a bunch of
broken eggs and furr
from a really large
rabbit

Check out my
cool..uh..tattoo
thingy..

STEADY THIS
(explosion

Gay man marries in
Seattle

Sky Ear
2004 Holy Log Pole
Festival

A few of her
favorite things...

Only in America!
Only on
Pay-per-View!

Ding!
Arresting
Egg them on
newsfilter!!! ; >
Done Deals
The Blood of Heroes
Black Ships and
Samurai

Does this tutu make
me look fat?

Jeff Skilling
Contractors in Iraq
repel
insurgents’
attacks, calling for
help but not
receiving military
aid

The Cult of Mac Blog
Account of Broad
Shiite Revolt
Contradicts White
House Stand

yukihime.com
Stoplight to punish
suburban speeders /
Pleasanton finds a
way to slow
impatient drivers

IKEA | home |
workplace furniture
& accessories |
computer solutions |
JERKER computer
table

Boing Boing: Food
Porn -- Burger King
Subservient Chicken

The O'Franken Factor
all the things you
can get it to do

what is grok?