import korg_web # # Views... # class login( korg_web.base_Page ): __IS__WEB_STARTPAGE__=1 def work_on_enter(s): s.create_global('username') s.create_local('password') def work_process(s): login,username,passwd=s['login','username','password'] s.DEBUG('login [%s][%s]',username,passwd) if login and username=='admin' and passwd=='foo': s.goto('index') if s['quick:korg']: s.DEBUG('quick login') s['username']='korg' s['password']='korg' s.goto('index') if s['nuke']: s.nuke() class ten( korg_web.base_Page ): def work_on_enter(s): t=[] for i in range(3): t.append( i ) s.create_global('ten_list',t) def work_on_exit(s): s.flush_global('ten_list',t) def work_process(s): if s['logout'] or s['nuke']: s.goto('login') if s['goto_obj_a']: s.goto('obj_a/index') def KWcmd_clear(s,l,o,*a): s['ten_list'][ a[-1] ]=a[1] def KWcmd_inc(s,l,o,a): s['ten_list'][ a ] += 1 def KWcmd_dec(s,l,o,a): s['ten_list'][ a ] -= 1 def KWcmd_add(s,l,o,ind,val): s['ten_list'][ ind ] += val def KWcmd(s,l,o,*a): if o=='random': s['ten_list'][ a[-1] ]=666 if o=='setzero': s['ten_list'][ a[-1] ]=0 if o is None and a: if a[0]=='add': s['ten_list'][a[1]] += a[2] class index( korg_web.base_Page ): def work_process(s): username,passwd=s['username','password'] s.DEBUG('Game page u[%s] p[%s] logout[%s]',username,passwd,s['logout']) if s['logout'] or s['nuke']: s.goto('login') if s['goto_obj_a']: s.goto('obj_a/index') if s['ten']: s.goto('ten') class special(index): pass