>> > def my_method(): >> > >> > # do something >> >> > # how do I get the name of this method >> > # which is my_method here? >> >> Why do you need this? There are ways but those >> are not really good for production code. >> > > I am going to use this in Django. I am trying to implement > a permission here, where in the database store the methods > that the user are allowed to execute. > > for example if the method is def create_event() : > the method will look for create_event in the database > to see if it allow to be execute.
james .... Perhaps a simple-minded hard-coded solution might work .... def permission_check( name ) : permission = DB.permission_check( name ) if not permission : print 'No Execute Permission for %s ' % name sys.exit( -1 ) def my_method() : permission_check( "my_method" ) .... -- Stanley C. Kitching Human Being Phoenix, Arizona ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- -- http://mail.python.org/mailman/listinfo/python-list