Global function in not accessible using Pylons + Python

I'm having trouble creating a global function accessible from within all classes. I receive an error from within that says:

NameError: global name 'connectCentral' is not defined

Here is my current code.

project/model/__ init

    """The application's model objects"""
    import sqlalchemy as sa
    from sqlalchemy import orm
    from sqlalchemy import engine_from_config

    from pylons import config
    import central

    #Establish an on-demand connection to the central database
    def connectCentral():
        engine = engine_from_config(config, 'sqlalchemy.central.')
        central.engine = engine


    import project.model

    class User(object):
        def emailExists(self):
                emails = central.Session.query(User).filter_by(
            if (emails > 0):
                return False
                return True

        except NameError:
            self.errors['email'] = 'E-Mail not set'
            return False

Am I missing an import? Is there a better way to do this?



You need to qualify the name with the module (or package) it's in, so:



Need Your Help

declaring a string in assembly

c assembly inline-assembly

I have this assembly code that computes some prime numbers:

Update file in Windows Azure CDN

cdn windows-azure-storage

I have blob storage and CDN endpoint, that store my static content.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.