Python Programming, news on the Voidspace Python Projects and all things techie.

SVN Repository (rest2web and pythonutils)

emoticon:baldguy The SVN Repository is now up to date (again).

This is for rest2web and pythonutils.

Because of my work situation (restricted internet), I am only able to update once a week (time permitting), so it has lagged behind recently.

The rest2web docs in SVN are in a state of disarray. This is because I am updating them. All will be well again soon. Smile

Whilst explaining to a friend how Firedrop2 could act as a front-end to rest2web, I realised how feasible this actually is. The main requirement would be a tree widget for the sidebar, that gives you access to all the source files in your site.

A nice GUI widget to create the restindex for each page would also be nice - and not very difficult. This would provide a nice graphical way of editing sites and creating new pages.

The first priority is to get contents pages auto-built. First things first...

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2006-01-05 12:27:28 | |

Categories: ,


Protected Page

emoticon:halt I've had a user ask about logintools. In order to make it simpler to understand I've created a simple application that protects some static HTML pages with a login.

Only users who are logged in can access the pages it hides.

logintools provides a complete user authentication, account administration, and user account management framework. Like I've said before, it does all this with literally two lines of code near the start of the script :

from logintools import login
action, userconfig = login(theform, userdir, action=formdict['page'])

Hopefully this little application will make it easier for folk to understand how to build CGI applications that use logintools.

Protected Page has three simple templates.

It stores a dictionary that maps pages (passed as the page value in the CGI get) to template paths :

# None is the default page
pages = {
        None: 'templates/default.html',
        'page1': 'templates/page1.html',
        'page2': 'templates/page2.html',
        }

To make it a bit more interesting, it fills a few values from the saved user configuration file into the template. So it's not entirely static.

It also provides links for users to logout, edit their account, and if they have admin rights it provides a link to the administrator features.

  • Download Protected Page (109k)

  • Online Example

    Example user: Username guest and password pass1.

    Example administrator: Username admin and password pass1.

    You can't edit the account details of the guest user. You'll have to create a new login if you want to play with that.

The zip contains logintools, templates and all the pythonutils modules - so it ought to run out of the box.

Protected Page itself is about 40 lines of code...

If you want to create a CGI application with user logins, this is the place to start. Razz

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2006-01-05 12:14:03 | |

Categories: , ,


Movable Python Pre-Release

emoticon:movpy Movable Python is done and documented - and most of the testing on Windows 98 is done. Razz

I just need to create the different distributions and get the shop setup.

Movable Python in Action

Several of the libraries I'd like to bundle with it (IPython, SPE) are about to release new versions. This means full release is about a week away.

If anyone wants a pre-release version then the cost is five pounds (sterling), and you can pay by paypal to fuzzyman@voidspace.org.uk. You get free upgrades for a year, but I'll start the year from the official release date. Smile

Note

Twenty percent of all sales go to support the development of SPE.

What is Movable Python ?

Movable Python is a distribution of Python (for Windows) that doesn't need to be installed. It easily fits onto a USB memory stick. Python on a stick. Smile

It is integrated with SPE, the Python IDE, to make Movable Python a portable Build, Test, and Run environment. It has a nice GUI to launch programs and control its behaviour.

Movable Python is useful in the following situations:

  • Machines where you can't install programs.
  • Where you need a portable 'Build, Test, and Run' Python environment.
  • Having several versions of Python on the same machine for forward/backward compatibility testing.
  • Easily deploying Python scripts without having to install Python.
  • Try before you buy - test Python without having to install it, including new versions .
  • 'Python Runtime Environment'. '.py' files can be associated with movpy.

Whats New ?

This is a major new release since the last one, and a lot has changed.

Completely new method for running files. This means you can launch multiple programs from the GUI.

Lots of new libraries and tools included. Virtually all the included tools have had version upgrades since the last release.

The GUI does a lot more :

  • Version number and Python version displayed on the GUI
  • You can pass arguments to your programs
  • It remembers the last directory you ran a program from
  • You choose if launched programs have a console box or not
  • You can configure the options programs are run with
  • You can edit the default options
  • Four configurable Quick Launch buttons
  • You can launch SPE from the GUI
  • You can launch the documentation (About)
  • You can launch an interpreter console
  • You can close the GUI without having to launch a program or go to the interpreter

The following (command line) options are new :

  • f - run script in it's directory
  • b - pause after running script
  • o - override default options
  • die - get rid of GUI after running
  • k - run with console from movpyw
  • koff - run without console from movpy

Complete documentation rewrite.

Docs are now built with rest2web.

movpyw.exe is now included in the Python 2.2 distribution.

Bug fixed where first command line argument to your program was always lost.

Bug fixed so that IPOFF actually works now.

Bug fixed so that -p in config.txt now works. Embarassed

Lots of other minor changes and improvements. Smile

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2006-01-04 09:17:49 | |

Categories: ,


Container Object Reference

emoticon:knot Whenever I implement a Python object that uses the mapping type or sequence type protocols, I always struggle to find the right documentation as to what methods I need to implement.

The necessary information is on three different pages of the Python documentation.

To make it a bit easier I've marked these three pages up using ReST, and put them on one page.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2006-01-03 14:44:49 | |

Categories: , ,


My Toolbox

emoticon:ir_scope Welcome to 2006. 2005 was an interesting year.

One interesting end-of-year piece of news is that Movable Python 1.0.0 is finished and documented. Once the shop is setup I'll do the whole release business.

Between code and documentation it's the equivalent of about 40 000 words [1], about an average sized novel. Hmmm... of course I'd rather have written a novel. Confused

Anyway, rather than do a round-up of the past year, I thought I'd see the New Year in with a round-up of the programming tools I use regularly.

So here's the list of tools I use in my coding and daily grind. It doesn't include the operating system (Windows on desktop, Linux on servers), or the language I use (Python).

  • SPE - The Python IDE.

    After a long search I have eventually settled on SPE. It has syntax highlighting, code completion and call tips and has recently added some very cool features - like real time error highlighting.

  • Ultraedit - For text editing.

    This is one of the few commercial tools I use. It's the nicest text editor I've ever used and includes the ability to jump backwards and forwards in your text, and a spell checker. It is also integrated with Tidy for (X)HTML validation.

  • Firedrop2 - The Python Blog Client.

    This is a nice blog tool that runs client side. This means you can maintain your blog offline and migrate your blog to a new server with the minimum of fuss. It has some useful plugins like an emailer and spell checker.

  • rest2web - The website builder.

    This tool automatically builds documentation and part of my website from ReST source documents. It allows me to easily change the template my site is based on, as well as automatically handling things like breadcrumbs.

  • Movable Python - The Portable Python Distribution

    On at least one of the machines I work on, I can't install program. Movable Python allows me to carry on using all my favourite Python tools.

  • DirWatcher - The offline directory sync tool.

    My home PC is offline. This tool allows me to sync directories by just transporting a single zip file backwards and forwards. Smile

  • Subversion - SVN the source code control system.

    This is the only source code control system I've used, and I'm very happy with it.

  • Tortoise SVN

    A windows client for SVN. This has great shell integration and makes using SVN trivially simple in most cases.

  • CGIHTTPServerWithSSI - A simple test web server.

    This is a very simple webserver based on the Python CGIHTTPServer. Because it's written in Python I can easily adapt it to meet my specific needs - for example it serves files from two directories. I keep edited files in a single directory for keeping track of changes, whilst the body of my site is kept in another folder.

  • WinMerge - An Open Source compare and diff tool.

    A very useful visual merge tool. This has saved my neck on at least a couple of occasions.

  • Firefox - The web browser.

    Of course. I still use IE for compatibility testing.

  • Thunderbird - The email client.

    It's a nice email client. Somehow Gmail manages to search much faster. I use gmail for archiving, for storing information so I can access it anywhere, and for better searching. I use Thunderbird as my main email client.

  • WinSCP

    A nice tool for transferring files across an SSH connection. Now that I use a proper server, it has basically replaced FTP for maintaining my website.

  • Putty - An SSH tool.

    The Windows SSH client.

  • IrfanView - An Image Viewer.

    A nice little tool for viewing images. It will also do basic transformations like resizing and rotating, which is about as sophisticated as I get with images.

  • VMWare - A virtual machine player.

    I use this for building Movable Python for python 2.3 & 2.2, and also for testing with Windows 98.

  • WordWeb - A simple dictionary tool.

    A little dictionary / thesaurus. Very useful when writing.

  • Word and Outlook.

    Sorry about this. Laughing Word is actually a very nice wordprocessor. I use outlook because it synchronizes the calender on my XDA (handheld computer). I mainly use outlook to backup the data from my PDA, I use the calender on that rather than on the desktop.

  • Winrar - Compression tool.

    Another commerical (shareware) program. This is still the best of the ones I've tried. It does almost everything I want, quickly and with a nice UI and good shell integration.

    I think the only compressed files I come across that it can't open are .Z ones. WinZip does open these, but doesn't have as nice a UI.

Other tools I use occasionally are Notepad (for simple text editing), Abbyy Finereader for OCR (noted because it maintains the document layout structure in the word documents it saves), Tweak XP for registry cleaning and Epson PhotoQuicker for printing images. Some of these came free from good old magazine cover disks.

I haven't included the tools I use on my PDA - which is a small set of tools, but less interesting to most people.

I'd like to maintain this list as it changes (or I remember things I left out), so I'll probably turn it into a brief article sometime. I really ought to explore Open Office. In it's latest incarnation it looks pretty good, but failed to open documents when I installed it recently. This is probably due to the quirks of my Windows install, which exhibits a few other obscure problems.

If you have tools that you use regularly, which aren't on this list, feel free to add them as comments.

[1]By sheer coincidence, 40 000 is about the number of times my projects were downloaded in 2005. Not bad for an amateur who's only been programming for two and a half years. Laughing

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2006-01-03 13:23:00 | |

Categories: , , ,


Hosted by Webfaction

Counter...