splee.blog :: IT

IT

Sanctuary

I’ve just found Sanctuary, “The First Broadcast Caliber (sic) Online Sci-Fi Series” and it looks like it could be a decent little series, especially considering some of the names involved. Amanda Tapping of Stargate fame not only stars in Sanctuary but is also Executive Producer, and there are a few members of the Stargate: Atlantis team in the cast too.

After watching the trailer and some of the fairly poor quality free version of the first ‘webisode’ I decided that I should just buy the upcoming episodes - at just over £1.80 per episode (£1.60 if you buy the four episode bundle) I figured I’ve spent more money on worse products in my time.

Although the first episode seemed a little ‘bitty’ and could have probably done with some better editing I’m definitely going to be watching the next few episodes to see how it pans out. I’m not going to drop any spoilers but there are some quite tasty hooks in between the character introductions that will make you curious for more.

General
IT

Comments Off

Permalink

YouTube and Python

According to Guido Van Rossum, YouTube is written almost entirely in Python.

IT
News
Web Dev

Comments (1)

Permalink

Web2.0

Web Two Point Ohhhh

My thoughts exactly.

Comedy
IT
Web Dev

Comments Off

Permalink

SimpleBlog - Part 2

In our last adventure we created the skeleton of a simple blogging application using SQLAlchemy as the ORM. In part 2 we are going to look at using Foreign Keys and create a method of allowing comments.

If you need the simpleblog files from the end of Part 1 they can be found here.

Continue Reading »

IT
SimpleBlog
TurboGears

Comments (9)

Permalink

SimpleBlog - Part 1

I’ve noticed a lot of people asking questions about SQLAlchemy in the #turbogears channel on Freenode and the TurboGears mailing list, and there aren’t that many step-by-step tutorials in using TG and SA so I decided to write one.

The tutorial will be published in two sections; Part 1 will cover the basics and part 2 will extend part 1 to cover a few of the trickier aspects of creating a project with SA.

Continue Reading »

IT
SimpleBlog
TurboGears

Comments (19)

Permalink

Disabling users instead of deleting.

I came across a use case where I needed to disable users without actually deleting them so a user could continue to be associated with their data and reinstated at a later date.

At first I thought that I’d need to roll my own Identity Provider but I came up with a method that is slightly easier to implement.

I added a BoolCol to the auto-generated TurboGears User Class:

Class User(SQLObject):
    ...
    disabled = BoolCol(default=False)
    ...

I then changed the classmethod that SOProvider uses to get the user from the database to raise an SQLObjectNotFound when a user’s “deleted” flag is set to True.

@classmethod
def by_user_name(self, text):
    try:
        u = self.by_email_address(text)
    except SQLObjectNotFound:
        raise
    if u.disabled:
        raise SQLObjectNotFound
    else:
        return u

Note that this classmethod has also been modified to return users by email address.

This way user can effectively be disabled as they can no longer log in successfully. It’s cheating outrageously because raising an SQLObjectNotFound exception is clearly lying to the SOProvider, but it works effectively.

IT
TurboGears

Comments (4)

Permalink