locawapp-001.zip

2005-12-10 Thread LocaWapp
LocaWapp: localhost web applications V.0.0.1 (2005 Dec 10)

Copyright (C) 2005 RDJ
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.

http://LocaWapp.blogspot.com



- Run with:

python run.py

- or:

python run.py 8081

- and browse with:

http://localhost:8080/locawapp/main.py

- or:

http://localhost:8081/locawapp/main.py

- If this is good for you, then you can help me developing with:

HTML + CSS + JS + PYTHON = LocaWapp
---


- Put your application in root:

[your_application]
[locawapp]
__init__.py
common.py
main.py
[static]
logo.gif
main.css
main.js
README.TXT
run.py

- Your application must to have "init" and "main" (for convention):

[your_application]
__init__.py
main.py

- main.py is a web application, then it has "locawapp_main" function:

def locawapp_main(request):
[...]
return [string]

- See locawapp.main.py and locawapp.common.py

- Send me your comment, thanks :-)
- Bye

http://LocaWapp.blogspot.com



class Server:
def __init__(self,port):
self.resp = None
self.session = {'_stopServer':False}

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('127.0.0.1',port))
s.listen(5)
while 1:
self.resp = ''
conn,addr = s.accept()
data = ''
while 1:
tmp = conn.recv(BUFFER)
if tmp == '':
break
data += tmp
end = data.find('\r\n\r\n')
if end != -1:
data2 =
data[:end].split('\r\n')
method = data2[0].split(' ')
method[1] =
urllib.unquote(method[1])
header = {}
for r in data2[1:]:
rr = r.split(': ')
header[rr[0]] = rr[1]
if method[0] == 'GET':

self.getResp(method,header,None)
elif method[0] == 'POST':
cnt_len =
int(header['Content-Length'])
content = data[end+4:]
while len(content) <
cnt_len:
tmp =
conn.recv(BUFFER)
if tmp == '':
break
content += tmp
content =
content[:cnt_len] # for MSIE 5.5 that append \r\n
content =
urllib.unquote(content)

self.getResp(method,header,content)
break
conn.send(self.resp)
conn.close()
if self.session['_stopServer']:
break
s.close()

def getResp(self,method,header,content):
url = method[1].split('?')
path = url[0][1:]
ext = os.path.splitext(path)
try:
if ext[1] == '.py':
get = {}
if len(url) == 2:
get = self.getParams(url[1])
post = {}
if content != None:
post = self.getParams(content)
request = {
'header':header,
'get':get,
'post':post,
'session':self.session
}
exec 'import ' +
ext[0].replace('/','.') + ' as app'
response = app.locawapp_main(request)
self.resp =
self.makeResp(200,'text/html',response['content'])
else:
try:
   

Re: double underscore attributes?

2005-12-10 Thread LocaWapp
Hi Bob,
see this my example:

>>> class A:
... def __add__(a,b):
... print a,b
...
>>> a = A()
>>> b = A()
>>> a + b
<__main__.A instance at 0x80c5a74> <__main__.A instance at 0x80c6234>
>>>

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


Re: locawapp-001.zip

2005-12-17 Thread LocaWapp
"class Server" has a big error: what is?

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


"class Server" has a big error: what is?

2005-12-17 Thread LocaWapp
"class Server" has a big error: what is?

http://groups.google.it/group/comp.lang.python/browse_thread/thread/de458cb7675ff4b6/f333453b0dc1aab6?q=locawapp&rnum=1#f333453b0dc1aab6

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


Re: "class Server" has a big error: what is?

2005-12-20 Thread LocaWapp

Steven D'Aprano ha scritto:

> On Sat, 17 Dec 2005 12:38:00 -0800, LocaWapp wrote:
>
> > "class Server" has a big error: what is?
> >
> > http://groups.google.it/group/comp.lang.python/browse_thread/thread/de458cb7675ff4b6/f333453b0dc1aab6?q=locawapp&rnum=1#f333453b0dc1aab6
>
>
> Is this a game of Twenty Questions? We guess what the error is, and you
> tell us if we are getting colder or hotter?
>
> You might find a little bit more interest in helping you if you post the
> traceback and the relevant bits of code.
>
>
> --
> Steven.

Hi Steven.
The big error (big for me) is inside the HTTP protocol (see the version
001 or follow the link on top, but you don't see the version 002
because it is fixed).

LocaWapp

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


I am seeing your project "HTMLTemplate"

2005-12-24 Thread LocaWapp
Hi Hamish Sanderson.
I am seeing your project "HTMLTemplate". I like it.
You see my project:

LocaWapp: localhost web applications V.0.0.2 (2005 Dec 20)

http://LocaWapp.blogspot.com



- Run with:

python run.py

- and browse with:

http://localhost:8080/locawapp/main.py

- You can change the port with:

python run.py 8081

- If this is good for you, then you can help me developing with:

HTML + CSS + JS + PYTHON = LocaWapp
---


- Put your application in root:

[your_application]
[locawapp]
__init__.py
common.py
main.py
[static]
logo.gif
main.css
main.js
README.TXT
run.py

- Your application must to have "init" and "main" (for convention):

[your_application]
__init__.py
main.py
others web applications (ex. main2.py)
your files or folders (ex. your [static])

- main.py is a web application, then it has "locawapp_main" function:

def locawapp_main(request):
[...]
html = [...String...]
return lwa.makeResponse(html)

- See locawapp.main.py and locawapp.common.py

- Send me your comment, thanks :-)
- Bye

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


LocaWapp: localhost web applications (v.03 - 2005 Dec 31)

2006-01-01 Thread LocaWapp
http://cheeseshop.python.org/packages/source/L/LocaWapp/locawapp-03.tar.gz


LocaWapp: localhost web applications (v.03 - 2005 Dec 31)

Copyright (c) 2005 RDJ
This code is distributed for your utility but WITHOUT ANY WARRANTY.

http://LocaWapp.blogspot.com



- Run:

python run.py

- and browse:

http://localhost:8080/locawapp/main.py

- You can change the port:

python run.py 8081

- You can develope with this framework:

HTML(CSS,JS) + Python = LocaWapp



- Put your application folder in root directory:

[your_application]
[locawapp]
__init__.py
common.py
main.py
[static]
logo.gif
main.css
main.js
README.txt
run.py

- Your application must have "init" and "main" files (for convention):

[your_application]
__init__.py
main.py
other web applications (ex. main2.py)
your files or folders (ex. your [static])

- main.py is a web application, then it has "locawapp_main" function:

def locawapp_main(request):
[...]
html = [...String...]
return lwa.makeResponse(html)

- See locawapp.main.py and locawapp.common.py

- You can find me in "comp.lang.python" newsgroup
-


- New applications:

lwaUtils - LocaWapp Utilities
lwaUtils.files.py - files manager (under costruction)
lwaUtils.editor.py - source editor (under costruction)

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