Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
110161bc
Commit
110161bc
authored
May 23, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update webpy.py example to work with latest web.py
also use <html> to render it properly in browsers
parent
07d5ae72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
examples/webpy.py
examples/webpy.py
+3
-3
No files found.
examples/webpy.py
View file @
110161bc
...
...
@@ -12,16 +12,16 @@ urls = ("/", "index",
class
index
:
def
GET
(
self
):
return
'
Hello, world!<br><a href="/long">/long</a
>'
return
'
<html>Hello, world!<br><a href="/long">/long</a></html
>'
class
long_polling
:
# Since gevent
.wsgi
executes each incoming connection in a separate greenlet
# Since gevent
's WSGIServer
executes each incoming connection in a separate greenlet
# long running requests such as this one don't block one another;
# and thanks to "monkey.patch_all()" statement at the top, thread-local storage used by web.ctx
# becomes greenlet-local storage thus making requests isolated as they should be.
def
GET
(
self
):
print
'
handling GET context id = %s'
%
(
id
(
web
.
ctx
.
_getd
()),
)
print
'
GET /long'
gevent
.
sleep
(
10
)
# possible to block the request indefinitely, without harming others
return
'Hello, 10 seconds later'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment