Wednesday, August 27, 2008

Thoughts on Python interfaces

Python does not have interfaces. Yet people have implemented interfaces in Python via some really innovative code (PEAK and Zope 3 comes to mind, but Trac also has them). Those people have great arguments for interfaces, claiming documentation and enhancement of system structure. From what I gather the theory is that if you use interfaces its easy to create truly componentized architectures because you know what to expect from a component.

Now that said, I find it really amusing how often interfaces end up being just so much boilerplate. By this, I mean an empty, (or marker), interface. We are given to understand that one can do so much more, but sometimes a framework demands an interface in a particular place, and often that interface is just plain empty.

I've never played with PEAK elements beyond easy_install. I've toyed with the innards of Trac and been shocked by what makes up the core of that so important software tool. Zope 3 is weel organized and I've done some shockingly fun stuff there after I got over the Zope 3 ZCML hump. And in all of that, I barely saw the need for interfaces. So often I wonder if interfaces are needed.

Well, upon reflection for those systems interfaces work surprising well. The underlying code for Trac might be questionable but anyone can make a plugin by following rules obviously managed by the interface system. Zope 3 is really nice once you get past the curve because you can make components and tie them easily in knots with ZCML (or with python in the case of Grok).

The point of these thoughts? Nothing really. I can live with or without interfaces, and use them in the frameworks that need them.

Friday, August 15, 2008

Pluggable Authentication System for Plone

It took me a little to get started, because the paster template for Plone 3 Pluggable Authentication System (PAS) products doesn't work for me. Not sure why, so I submitted a ticket.

Anyway, once I figured out that it was the template, and not me, things went very fast. PAS is rather straightforward when you get the hang of it. The quick summary of how to do a PAS plugin as how I've done it:
  • Grab the gmail auth plugin and use that as your base.
  • In your 'content type', import and register the appropriate method and in the content type's class, create the appropriate method.
  • Follow the PAS documentation on Plone.org for different actions you might need to do.
Yeah, very basic. I also figured out how to detail properties that can be set via the ZMI. Easy, but the documentation is not as easy to find as it should be.

I might document things in more depth since in some ways this took much longer than it should have considering the simplicity of the end code. I'm sure the Plone folks would love a detailed set of PAS examples to reinforce the current documentation, and I seem to enjoy doing that quite a bit.

Heh, while I'm at it, maybe I should finish my KSS documentation that I left hanging since the Naples Plone Conference in 2007?

Anyway, my quick review of PAS is that its really powerful. That each element (Authentication, Authorization, Challenges, etc) is seperated into its own plugin/module means that you can switch out components without jeopordizing the security and role system that might already exist. So, for example, if you want to use LDAP for authentication and SQL for authorization and a Smart Card to handle security challenges, you can do that without having do rewrite the core Plone engine. Another big bonus is that to do the actual replacement of individual plugin/modules is really easy once you figure out how. And that is pretty damned hot.

Saturday, August 9, 2008

I missed a class taught by Lennert Regebro?

http://regebro.wordpress.com/2008/01/20/what-is-wrong-with-the-course/

It was way back in January. I never heard of it! Did they not advertise?

I doubt I would have gone because at 1500 GBP (about $2900) plus travel expenses (about another $1000) for three days it was way too much to either pay myself or get NASA to fund. Especially since the Plone boot camp is $500 for five days and was held locally.

Still, if I had known, I would have contacted him and begged for a more affordable class held in the Washington, DC area. I bet I could convince ZPUG-DC to host him and Jorgen, I'm sure of it. It would be worth it because Lennert is a really great guy and maybe if I had hung out with him more at Pycon I would be a better plonista today.

Later today if I get a chance I will email him and see what can be done.

Wednesday, August 6, 2008

Trials and Tribulations of avoiding vi

So I'm stuck working today with a Solaris box. That means no Emacs. Heck, that means even no nano! Instead all I have is vi. Oh no!

Sure, some of you think vi is great. More power to you. Its just not something I like to touch, even if I grant automatic respect to anyone who uses it well. Just like watching any competant craftsman doing their daily tasks, watching a good vi master is pretty fun.

I've been spoiled by Redhat, Ubuntu, and Mac OS X. They come with Emacs installed, and if you have a few rights, you can add in new text editors. On Mac OS X I'll use Textmates, but otherwise I'll make do with Emacs or even Nano if I must.

If I could have argued successfully for more rights on the Solaris box, and had the rights to download software, I would have gotten Emacs working on that machine. Alas, the chance of that happening is around the same amount as a presidential political candidate not selling out his morals and ethics. Which means it ain't happening.

So, my work around?

I had access to the python shell. I wrote the file in there and saved it to a text file. Annoying at times, but less painful for me than trying yet again to figure out vi. I got my stuff done pretty quick and went on to other things.

Wednesday, July 30, 2008

Funkload to be revisited!

Benoit Delbosc (I assume its him because the Blogger sign was 'Ben') last week responded to these two posts I made in February:
Benoit is the author of Funkload, a promising python based functional and web load tester I explored earlier in the year. Its biggest shortcoming was the problem with getting graphical charting to work because the graphing library it was using was impossible (for me) to find. Sure, numbers are important, but a picture says a thousand words.

Especially to managers.

Well, Benoit told me that the latest Funkload calls for python-gdchart2, for which linux packages (at least Debian and Ubuntu) can be had. So installation across the many machines I touch will be trivial. I don't always use linux, but now I'll make sure to use it when I need Funkload to do what I need. It might also work with Mac OS X, something I plan to investigate tomorrow.

This makes me very happy. I really enjoyed playing with Funkload, and plan to do more of it in the near future.

And, just to make Benoit happy, even though it wasn't official, for the past 6 months or so I've used it in many unofficial load/functional tests for http://nasascience.nasa.gov as well as other internal efforts. :)

Thursday, July 17, 2008

wxPython is fun!

I needed to generate lots of lipsum recently. I could use elephantangelchild's greaterLipsum but I like fancy GUIs. So I branched greaterLipsum and wrapped it inside a little wxPython app. Pretty easy to do and it works great. You can svn the results at the desktopGreaterLipsum branch.

I plan to add in new features like being able to choose the text source, making binaries for different operating systems, and other fun things.

In the meantime, it made me remember just how much fun wxPython is in general. I need to find excuses to work with it more.

Friday, July 11, 2008

Ready for boot camp!

Next week I'll be in Plone 3.x Boot Camp at American University. I've worked with Plone 3.x for months, but haven't had time to get really spot on with its features. So I'm looking towards this second experience with Joel Burton with a lot of excitement.

Anyway, after spending some time with elephantangelchild's laptop yesterday getting Python 2.4.4 installed, then PIL, then Plone 3.1.3, then taking it back down to 3.1.2, then installing in the boot camp modules, I decided to do the same for myself last night.

I decided to take a shortcut. I modified the buildout.cfg so from the start it did everything in one go, installing Plone 3.1.2 and the boot camp modules. That way I could just do one build and be happy.

Alas, buildout wouldn't work. I had to do my buildout for Plone 3.1.2 and then run it again with the boot camp modules. How silly is that? Oh well, its done and with ArgoUML I'm ready to go!