Entries Tagged 'All & nothing' ↓

Basic Authentication in Pylons

I had to create basic authentication in my project(based on Pylons), and this is simple solution to do it.

First, you have to open your config/middleware.py. It’s necessary to import AuthBasicHandler: from paste.auth.basic import AuthBasicHandler.

Next step is find ‘app = PylonsApp()‘. Change this line to: ap = PylonsApp() and add after: app = AuthBasicHandler(ap, “My realm”, authfunc). Of course you need to create auth function, for example:

def authfunc(environ, username, password):
    if username == 'myusername' and password == 'mypassword':
        return True
    else:
        return False

Restart your application environment.

That’s it :)

How to add logo to Lightbox v2.0

Several days ago I have found a commision about adding logo to Lightbox v2.0. I am not a CSS and JS/DOM specialist, but solution, which I will introduce is really simple to implement. I omit the process of installation Lightbox, because everybody can find this information on internet. Now it’s time to install our logo in Ligtbox application.