Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

oop - Missing methods in Python class inheritance? -


i not experienced class inheritance. please me , have @ code below:

class handle(stafhandle):      def __init__(self, handlename):         handle = stafhandle.__init__(self, handlename)         self.initlogger(handle)      def initlogger(self, handle):         self.logger = logging(handle, 'test')  handle = handle('test') handle.logger.info('test') 

it says submit method not defined:

result = handle.submit(system, service, logrequest)  attributeerror: 'nonetype' object has no attribute 'submit' 

but if change to:

class handle(stafhandle):     def __init__(self, handlename):         handle = stafhandle.__init__(self, handlename)      def initlogger(self, handle):         self.logger = logging(handle, 'test')  handle = handle('test') handle.initlogger(handle) handle.logger.info('test') 

it works. why there difference? lot!!

cheers, zhe

stafhandle.__init__ returns none. want:

class handle(stafhandle):     def __init__(self, handle_name):         super(handle, self).__init__(handle_name)         self.initlogger()      def initlogger(self):         self.logger = logging(self, 'test')  handle = handle('test') 

remember __init__ methods take first argument object, , modify object. when call super(handle, self).__init__(handlename) changing properties of self instead of returning new object. difference between 2 examples variable handle in 2 calls initlogger refers different things.

notice have replaced explicit stafhandle.__init__ call super proxy; equivalent in case allows more flexibility, since can change inheritance of class without breaking __init__.

i've changed handlename handle_name conform python conventions (camelcase refers classes).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -