Can you please do me a favor.
I have implemented a web server using web.py
and want to configure some features at runtime.

like enable or disable logs. For this I took class variables (eg. logEnable
= True)
POST and GET functions do not let me to change value at runtime.

*Here goes the code:*

import multiprocessing
import web, sys, time

class configuration:
    log_enable = 'True'
    logFileName = "Log_3333.log"
    port = '3333'

class Handler(multiprocessing.Process):
    c = configuration()

    def run(self):
          urls = (
          #'/','Handler',
          '/idle','Handler',
          '/grant','Handler'
          )
          app = web.application(urls, globals())
          sys.argv.append(self.c.port)
          app.run()

    def GET(self):
      return "GET"

    def POST(self):
      f = open(configuration.logFileName, 'a')
      f.write(web.data())
      f.close()
      print"log_enable",web.config
      return "POST"

if __name__ == '__main__':
        q = Handler()
        q.start()
    print "log enable"
    time.sleep(10)
    print "log disable"
    q.c.log_enable = False
    time.sleep(10)
    q.terminate()
        #p.join()


Regards,
babbu

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to