Hello Again.

I hope, I don't bug too much.

First of all. I want to Thank to everyone who respond my messages. 

I was able to do some of my needs and stuck some others. 

So ? I need help again.

And here my progress..

Following was my globalized registry solution

# -*- coding: utf-8 -*-

class Registry:

        data = {}

        def __init__(self,environ):
                self.data['env'] = environ
                self.data['init'] = 'hede'

        def set_entry(self,key,data):
                self.data[key] = data

        def get_entry(self,key):
                return self.data[key]

        def debug(self):

                r = '<pre>'
                r += repr(self.data)
                r += '</pre>'

                return r

I have some questions about this code.

First of all. when execute debug function. It wont work in every request.

# -*- coding: utf-8 -*-

import os, sys, cgi, pprint
import cgitb
cgitb.enable()


def application(environ, start_response):
        sys.path.append(environ['DOCUMENT_ROOT']+"core")
        import registry, k5
        # new registry

        r = registry.Registry(environ)
        r.set_entry('hede','hodo')

        #response_headers = [('Content-type',k5.headers['content-type']+'; 
charset='+k5.headers['charset'])]
        #start_response(kk5.headers['status'], response_headers)

        response_body = 'The request method was %s' % environ['REQUEST_METHOD']
        response_body += '<br/>'
        response_body += r.debug()


        status = '200 OK'

        response_headers = [('Content-Type', 'text/plain'),
                        ('Content-Length', str(len(response_body)))]

        start_response(status, response_headers)


        return [response_body]

In first request I can see elements of my registry and second request it was 
shows noting. Then 3rd request I can see my registry elements again. next 
request was empty too. And it was go like that. I don't understand why ?

Second problem is. Formatting.

I need to see my dictionary elements like this.

   [k5req] => Array
        (
            [raw] => heede
            [post] => Array
                (
                )

            [proto] => http://
            [base_url] => http://k5.int/?
            [bend_url] => http://k5.int/?backend/
            [ajax_url] => http://k5.int/?ajax/
            [domain] => k5.int
            [path] => Array
                (
                    [0] => heede
                )

            [location] => frontend
            [page] => heede
            [dom_stat] => 1
        )

Is there any available solution (like php's print_r) or have I write to my own 
?

And

If I understood correctly PSP template execution in mod_wsgi is impossible. So 
I have to look something like cheetah or similar marker based template 
systems.

And

If I understood correctly I have to import every module in sub imported 
module. 

And I want to make sure to my 5 different base module was available every other 
sub imported module. 

Is there any way to this from do and forget from start ?

Regards.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to