Python WebFrameworks: How to move forward

 pycon, Python, TurboGears  Comments Off on Python WebFrameworks: How to move forward
Feb 242007
 

Of late there has been much to do about the crop of Python based web frameworks. Is one superior to another? Currently, I don’t believe so they all have strengths and weaknesses and I could make a good argument for most of them. However, in the midst of this current genesis there are some shining stars that I think are setting the way forward. These stars are not the frameworks themselves but components that are written to be framework agnostic. For example, Paste, WSGI, SQLAlchemy and ToscaWidgets. By supplying these fundamental and highly useful tools, they are empowering the current and future web frameworks.

I think that all of the frameworks should look for commonality that can be shared, that can be improved for the benefit of all. Even if you want to have a full single source stack as opposed to a best of breed stack plugin architectures should be the standard. So advancements can spread between the frameworks.

What about the frameworks? I believe that in the end their will be two major web frameworks, Django and TurboGears/Pylons. Twisted won’t go away and neither will Nevow but they won’t match the popularity of the two majors. However, I firmly believe that all of the frameworks will have similar traits and in time will tend to a center balance point using different toolkits as the “preferred”.

 Posted by at 10:32 am

Advanced TurboGears Part II

 pycon, Python, TurboGears  Comments Off on Advanced TurboGears Part II
Feb 222007
 

leader: Mark Ramm

ref: http://us.pycon.org/TX2007/TutorialsPM#PM2

AJAX ~ JSON
is the communication protocol between the client and server

  • @expose(allow_json=True) … JSONifies the return results(dictionary or string)

Widgets ~

  • Widget Browser
  • how widgets are written/disecting ala the AutoComplete widget
  • current form widgets vs. toscawidgets — when that time comes, it shouldn’t even cause a bump unless you are using nested forms, — that api will change (for the better)
  • setting form widgets to default values

Break

Hints:
In Controllers: Just inherit from controllers in your nested controllers, don’t use controllers.RootController everywhere otherwise you’ll end up with name space collisions and CP won’t behave as expected.

SQLAlchemy

  • ActiveMapper – SQLAlchemy splits the logical definition from the physical so you can map a logical def back to a backend(s) of your choice (like a legacy db) It implements the “data mapper” method, Domain objects/ mapping layer/ physical data. It has a session mapper that keeps a link between the logical and physical, keeps the identity mapped to the underlying db, plus it caches.
  • Hints:
    ActiveMapper is pretty much deprecated. Elixir is the upcoming replacement.

    Genshi

  • Change *.kid to *.html
  • Change template engine to Genshi @expose(‘mytemplate’) -> @expose(‘genshi:mytemplate’)
  • py:match tags
  • if you have python blocks — you’ll need to wait a couple weeks
  • you have to wrap your calls to widgets in a function call ET(widget) ET=elementTree you may receive ElementTree references in your output. You can display your widget like ${ET(table.display(data))}
  • change sitetemplates.kid -> sitetemplates.htm — more that just a name change
  • Why Genshi —

    1. Error Handling — kid explodes and gives the line # of the compiled kid template (.pyc) that blew, Genshi gives you the line, column in the original source code/template.
    2. Lets you use XML includes and do XML includes in “if” tags

    More SQLAlchemy
    http://www.sqlalchemy.org/docs/tutorial.myt

    More Genshi Mark will post the Ulitimate-Wiki code later today/night

    Authentication
    TurboGears includes the Identity module. It uses a simple db back end but that can be changed out to an LDAP if desired. There exists an SO provider and an SA provider. There is a page on the old trac, it might be in RoughDocs by now. There is an AD backend too. The LDAP and AD providers only do Authentication, Authorization is handled by the a db local to the app.

    Sites Using TurboGears
    Sessions
    There is a CherryPy (CP) session filter that you just turn on. In the .ini files — dev or app, etc
    3 backends: file, memory, postgresql
    In the future it will be the CP session Tool instead of Filter
    CherryPy.????? is a great place to put thread local stuff

    Performance and Filters: Cache Filters – is CP deprecating it? Will CP make it a Tool, or if it is more WSGI friendly, will it turn to beaker?

    mark.ramm@gmail.com

    MochiKit
    Is the most under appreciated js package. Mark prefers it to prototype.js. Bob Ippolito json — mochikit. Is tested on ie, ff and the mac browser — is tested hard. Javascript that Doesn’t make you want to shoot yourself in the head. It has a version of the script.acoul.us but uses mochikit instead of prototype. Bob is said to be a testing task master.

    hint:
    Don’t get caught in the DOM scripting cess pool. 2 secs to download and 20 secs to render. That is bad. DOM scripting is not evil but too much of it is.

    Mochikit and Animations and here

     Posted by at 4:59 pm

    workingenv: installing pylint

     pylint, Python, workingenv  Comments Off on workingenv: installing pylint
    Jan 052007
     

    installing pylint is a little more complicated then necessary because it doesn’t specify it’s requirements for easy_install and it also doesn’t list download locations for logilab-common and logilab-astng in it’s cheeshop record

    in your workingenv:
    easy_install pylint

    then switch to the tmp directory in your workingenv, and download the two packages you need:
    wget ftp://ftp.logilab.fr/pub/astng/logilab-astng-0.16.3.tar.gz
    wget ftp://ftp.logilab.fr/pub/common/logilab-common-0.21.1.tar.gz

    then unpack them and install them:
    tar -xzvf logilab-common-0.21.1.tar.gz
    cd logilab-common-0.21.1
    python setup.py install
    cd ..
    tar -xzvf logilab-astng-0.16.3.tar.gz
    cd logilab-astng-0.16.3
    python setup.py install

    now test pylint by calling it from the command line. If all is well you should get no error messages/warnings and the standard help output.

     Posted by at 11:42 pm
    Jan 052007
     

    I tried setting up a workingenv for playing with SQLAlchemy today but I ran into a number of problems. First, since I had installed pysqlite2 via Synaptix, easy_install was not finding the package. So I had to uninstall the pysqlite2 that I had installed with Synaptix and then install with easy_setup.

    However, there is a bug for pysqlite on cheeseshop and no download is listed. So after inquiring on the TG mailing list, I tried:
    easy_install -f http://initd.org/pub/software/pysqlite/releases/2.3/2.3.2/ pysqlite

    but that failed because it couldn’t find the sqlite headers.
    In file included from src/module.c:24:
    src/connection.h:33:21: error: sqlite3.h: No such file or directory
    ...
    error: Setup script exited with error: command 'gcc' failed with exit status 1

    So I installed the libsqlite3-dev package via Synaptix — and finally all was right with the world.

    I couldn’t get pysqlite to install fully into the workingenv, so I had to install it on the base system and then when I issued the
    easy_install -f http://initd.org/pub/software/pysqlite/releases/2.3/2.3.2/ pysqlite
    in the workingenv a proper entry was made pointing back to the package in site-packages
    Adding pysqlite 2.3.2 to easy-install.pth file
    Using /usr/lib/python2.4/site-packages/pysqlite-2.3.2-py2.4-linux-i686.egg

     Posted by at 9:48 pm

    How can Microsoft make my life better?

     Business, Great Plains, Microsoft  Comments Off on How can Microsoft make my life better?
    May 182006
     

    Today, in Scoble’s post, “Missed big HR meeting“, he closes with “Now, let’s get back to work figuring out how to make our customers lives better.”

    Well here is some advice for Bob and the gang over at Microsoft from a customer, “Fix what you got before you go trying to make a silk purse out of a sow’s ear.” and “Eat your own dog food.” There has been one constant theme out of Microsoft Business Solutions since they purchased Great Plains. And that is, “Make everything look like Outlook, don’t worry about broken or half implemented features.”

    Here is a hard example. Notes for customers, products, sales orders, you name it, are stored in a single table as a 32K text chunk. There is no revisioning of the notes and if one user accidentally deletes a note by clicking on the wrong poorly named action button the note is gone. Poof it never existed. This has to be one of the most rinky dink set ups I’ve ever seen. Apparently this feature was implemented by a high school intern and since no one in Microsoft Business solutions uses the notes — it’s never been fixed. This architecture bug is so bad and can be so costly, I’ve had to write a specialized “diff” utility to track and keep a revision history for notes. Nothing like blowing a 10K deal because some fscked up and missed an important note that had been inadvertently deleted.

    This is just one of many architectural blunders that MS never seems to get around to correcting — I guess if you make it look pretty enough people won’t care that their headed twoards the poor house.

    Come on folks, this is an accounting application. An ACCOUNTING APPLICATION not an image editor or a roll-up cube. Boring and reliable is what brings the boat back to port. Fix the issues, then worry about making it look like something it isn’t. I can’t believe that sysadmins at MS don’t lie in wait for these geniuses to go strolling down a dark hall alone.

     Posted by at 10:05 pm

    FreeBSD more Popular than Linux

     FreeBSD, Google  Comments Off on FreeBSD more Popular than Linux
    May 132006
     

    Google has recently released Google Trends. Google Trends compares different search terms’ usage over time. After reading a post on MDLog about Linux distribution trends I became curious about FreeBSD’s numbers in such a comparison.

    So I marched over to distrowatch.com and checked out their Top 10 Linux distributions. They are: Ubuntu, Mandriva, SUSE, Fedora, Debian, Knoppix, Mepis, Gentoo, Slackware, Xandros — in that order.

    Google Trends shows that FreeBSD is more popular than: Mandriva, Knoppix, Mepis, Slackware and Xandros. While FreeBSD is enjoying good mind share with respect to Linux, it is also behind Ubuntu, SUSE, Fedora, Debian and Gentoo in the same comparison. So really this article should be entitled, “FreeBSD more Popular than Some Popular Linux Distributions.”

    With FreeBSD’s new focus on the desktop, I believe that the mind share for FreeBSD will be going up once again.

    If you haven’t tried FreeBSD lately you are doing yourself a disservice. There are many things to like about FreeBSD.

     Posted by at 8:16 am

    Microsoft to “Standardize” file formats…

     Business, Microsoft, Web 2.0  Comments Off on Microsoft to “Standardize” file formats…
    Nov 212005
     

    Microsoft, today, announced that there were going to “standardize” their Office 12 XML file formats. Looks like someone from Microsoft read my article on ODF. But there is an awful lot of word parsing coming out in these announcements. To wit, the use of the phrases, “standardize” and “openess.” Either they are playing word games to trick the public or the managment at Microsoft. If Microsoft was truly serious they would approach OASIS and participate in the ODF work going on there.

    Another problem is their use of Ecma International as their “standards” partner. Need I remind you of the Ecma Script/ javascript dichotomy? This is something for you to decide, but I would point to their list of standards as a place to start. Anything there ring a bell with developers or doesn’t it seem more of a “safe harbor” for corporate interests.

    Here is some more “marketing speak” from Scoble interview with Jean Paoli:

    “we are offering the Office XML file format technology behind billions of documents to customers and the industry as an international standard.”

    Well, to my knowledge, it is highly questionable that a non-shipping product and a non-shipping format can behind billions of documents.

    Now I know that the smart people at Microsoft are probably going nuts trying to convince upper management to give up making buggy whips — but that isn’t going to happen until Ballmer is gone. Ballmer is still a firm believer of grabbing a company’s corporate jewels (Data) and wrapping it up in a Microsoft format. Steve needs to learn that it is “our” ball and not his. We’d love for Microsoft to keep playing but throwing these tantrums and then trying to talk around it is making companies more than a little….impatient with Microsoft.

    So in short, until Microsoft starts participating in Open Document Format and OASIS — I wouldn’t read anything into this more than trying to FUD Open Document. After all, when was the last time anyone read a book on Ecma Script?

     Posted by at 7:18 pm

    More machines than people on the Internet, Duh!

     Business, Web 2.0  Comments Off on More machines than people on the Internet, Duh!
    Nov 202005
     

    Some rocket scientist, Nick Farrell, over at The Inquirer makes the seeming apocalyptic statement that, “More machines than people on the Internet.” Oh my, when did that happen? What this genius fails to recognize is that there has always been more computers than people on the Internet.

    Let’s review the simplest case, a single person surfing a web site. For that person to access the Internet they must be on some device that has a processor or “computer” and that device connects to the web server, another computer. So completely disregarding routers and switches that person is already outnumbered 2 to 1. In fact, in the simplest view the number of computers will always be n+1 where n is the number of people “on” the Internet.

    Spooky, huh? Actually it is worse. Mr. Farrell is reporting on the UN’s telecommunications agency prediction. What is spooky is that the UN think’s it can govern the Internet. They don’t even understand it — Now that is spooky.

     Posted by at 5:11 pm

    on Open Source Patch Management

     Business, FreeBSD  Comments Off on on Open Source Patch Management
    Nov 172005
     

    Today, Dana Blankenhorn on ZD.net opines about the need for open source patch management. More specifically he talks about notifications of vulnerabilities. Well the best kept secrets in open source, the BSDs handle this just fine in my opinion.

    Being a FreeBSD user, I have to say that portaudit and the FreeBSD Security Advisories are a very good existing answer. I stay in the know and the gap between release and me knowing is as small a delta as I want. It is completely up to me. The other BSDs have similar mechanisms.

    The best thing about the FreeBSD Advisories is that they tell you, as soon as they know, the unvarnished truth.

     Posted by at 10:06 pm

    What fat clients can learn from the Web

     Business, Great Plains, Web 2.0  Comments Off on What fat clients can learn from the Web
    Oct 212005
     

    One of the beautiful things about the web is that you can share discoveries with others by merely sending a link to a friend or co-worker. Find a cool new shoe or a laptop and want their input on the item? You just click on “send link” in your browser, or cut and paste the link in an email message and off it goes. They click it and voila! there it is. The item of your attention and the thing you want to talk about. No muss, no fuss. The other person gets instant context when they click on that link. No big explanations are necessary. They can respond with their ideas and links to some other possibilites. The gift of sharing your contextual vision with another by only clicking.

    Now say you are in your accouting application and you have a problem or need a resolution from a co-worker or superior. What do you end up doing? You end up emailing them account numbers and dates and telling them what view you are looking at so that they can look at it too and give you the feedback/information you need. Starting to see the lesson? Why aren’t fat client developers taking a clue and incorporating one of the most powerful features of the Internet in to out bread and butter fat clients? Why can’t I send a “link” from the view I’m looking at in my accounting application to a co-worker or superior. Think of the time savings. Got a question on a receivings, send a link and the respondent gets instant context.

    And finally, a word to the Web 2.0 developers: The lesson is for you too. Don’t give up the ability to link to an item in your sweet new AJAX weblication otherwise you end up costing more than I think we should pay.

     Posted by at 10:00 am
    Oct 202005
     

    Every once in a while you come across a good Idea. Tonight, I just read one. David Berlind, on ZD.net posits the idea of Open Document Format (ODF) could be a transport mechanism for moving content between different wikis.

    Could ODF be the Net’s new, frictionless document DNA? by ZDNet‘s David Berlind — There’s no reason, for example, that, regardless of what proprietary markup languages the different wiki solution providers use to put a pretty face on Web authoring, that they cannot natively store those documents in the XML-based ODF. […]

    Now this is the type of idea that I believe will happen more frequently once ODF picks up steam. It is the open format of HTML that gave rise to most of what we have on the Internet today. Everyone competes to make it better and more compelling. With closed formats, ala Word, there is not the same kind of pressure to advance the format and when it does change we are at the mercy of one company to give us solutions for migration. With an open format, market pressures and new ideas will create a dynamic system that gives users the benefits.

    The only reason to keep a document format closed is to keep your customers locked-in. There is absolutely no advantage to users from using a closed document format. This will force the market giant, Microsoft, to once again compete solely on the merit of its product and not rely on lock-in and the advantages that they get from being the only one to fully support the document format. Remember how much better Word became when it was competing with WordPerfect? The features implemented really had the user in mind. However, once they crushed the competition the goal of new features was not to improve the users productivity, it was to use those new features to reinforce the tie-in/lock-in with other upstream Microsoft products.

    There are benefits for Microsoft as well. Because of a standardized format, their upstream products could work with different word processors and different platforms. This, in my opinion, is the direction that Microsoft needs to move to stay relevant for the next 20 years. There are smart people at Microsoft and they do have some very good tools, however those people are often hamstrung from having goals that are in direct opposition to Microsoft’s current philosophy of product tie-ins. Now is the time for Microsoft to use its brains and not its market muscle. It will stop the hemorahging of talent and bring you real customer loyalty in the long run.

     Posted by at 11:23 pm

    GMail: Shared Folders

     Google  Comments Off on GMail: Shared Folders
    Oct 152005
     

    Gmail is a great mail interface. I prefer it in many ways to even outlook. There are basically two deficiencies it suffers from currently. One big and complex the other is low hanging fruit that Google should pick today, Shared Folders. I should be able to share a virtual folder with another Gmail user. I would only need to know their gmail username to set it up.

    There’s the fruit G-Buddy, now go pick it and let the users go wild.

    The other need is a calendaring 2.0 app that is open enough that I can write sync utilities for my phone/palm/pda/etc. Now that is one big honk’in project. I’m confident that some very bright minds are working on it as I type — but we want sharing there too. Also, I assume that they’ll be using vcal and the rest of the standards.

     Posted by at 4:00 pm

    Critical Windows patch may wreak PC havoc

     Business, Microsoft  Comments Off on Critical Windows patch may wreak PC havoc
    Oct 152005
     

    A story on news.com speaks to the problems that Microsoft continues to have in regards to regression testing on their patches. After the “no patches” last month, to the 9 this month, (what a joke, 9? Did you look at the number of updates downloaded by WSUS? Also, they never talk about the number of “updates” to existing patches, which in my mind are new patches that need to be counted too.)

    Microsoft, where do you want to get wormed today? Ok, so you patch so you don’t get wormed but then you can’t access your computer — so in fact you still get stung. Either by malware from a malicious individual or malware from a corporation. Thanks for the gumball, Microsoft.

     Posted by at 2:00 pm

    A note on Microsoft Great Plains “notes”

     Business, Great Plains  Comments Off on A note on Microsoft Great Plains “notes”
    Oct 152005
     

    Great Plains’ note taking system is an annoyance at best. While they’ve expanded it so that you can attach notes to just about everything (customers, invoices, vendors, items, etc) each note is stored as a 32K text entry — If you are at the limit, you’ve got to delete something else to add more. If someone inadvertently wipes out a note, it’s gone. In fact this problem is so bad I’ve had to write a note archiving and diff tool so that I can recover “lost” notes.

    Microsoft needs to fix this archaic note taking system. What should be done is that each new entry in the note should be stored as an individual entry, along with the date/time that note was entered and who entered the note. When notes are displayed, it should show them in reverse chronological order (newest on top) with the date/time and note text. There should be security for editing and deletion of notes. Adding notes should be available to anyone with permissions to view the data. The entry should also show if the entry had been edited, when and by who.

     Posted by at 12:00 pm
    Oct 152005
     

    Microsoft continually updates things by changing the interface or adding new, mostly working, functionality but hardly ever by fixing the brokenness of existing functionality. They might enhance functions but they seldom fix the primary brokenness. I grow weary of Microsoft’s continual upgrades that are suppose to make their software better — unfortunately they only have their shareholders in mind and not their customers. Each features links you more tightly and in proprietary ways with other Microsoft products. They should at least improve basic functionality of existing features and expand the interoperability with other products, both Microsoft and non-Microsoft.

    This is the same lesson that IBM had to learn in the 90’s — Their proprietary, non-interoperable tendencies led to a sound thrashing by the market. I keep wondering why the market has allowed Microsoft to continue this bad behavior. Yes, the market has allowed this to happen. So everytime you decline to investigate non-Microsoft products out of hand, you are contributing to the problem.

    Now it is important to not dismiss Microsoft products out of hand too. Doing so is just bad business sense. But it is time that the market stop following the Jones’ and do their own homework when it comes to software acquisition. You need to evaluate not only features(+), security(+) and vendor strength(+) but vendor lock-in(-). Vendor lock-in exposes you to increased future prices. The longer you allow yourself to be ensnared the higher the cost of escape. Not allowing for vendor lock-in in your analysis is actually exposing your company to increasing risk.

    Microsoft needs to be forced to compete via the strength of their product and their ability to free businesses to use them in new and unexpected ways and not by using a death embrace of intra-product lock-in. Every time Microsoft uses a closed, proprietary file format or communication protocol they are displaying their “not getting it.” When Microsoft starts publishing formats and protocols, allowing them to be used freely and openly, then that is when Microsoft will start to “get it.” When Microsoft starts adopting open specifications with out attempting to subvert them (think OASIS) then they will have “gotten it.”

     Posted by at 9:56 am