github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

husio / tutorials

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 0
  • Source
  • Commits
  • Network (0)
  • Downloads (2)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (2)
    • django_blog_with_ajax
    • django_blog_no_ajax
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Source code for tutorials. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

doklikałem GtkCellRenderer 
Piotr Husiatyński (author)
Tue Dec 15 11:35:31 -0800 2009
commit  bc8b6fd3c2b45e5724e9e5c2ddd29080752cfcd4
tree    c41a62f1eaa11946ee442881901a15edda8483e4
parent  e4d384447ec30d5af713cb0efb6dd750e7728a4d
tutorials / twisted_2 / simple_server.tac twisted_2/simple_server.tac
100644 40 lines (26 sloc) 1.017 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
from twisted.internet import protocol
from twisted.application import internet, service
from twisted.web.client import getPage
from twisted.protocols.basic import LineReceiver
from twisted.python import log
 
 
 
class WebGetProtocol(LineReceiver):
 
    def connectionMade(self):
        log.msg('new connection')
 
    def connectionLost(self, reason=None):
        log.msg('connection lost: %s', reason)
 
    def lineReceived(self, line):
        deferr = getPage(line)
        deferr.addCallback(self.send_success).addErrback(self.send_errback)
 
    def send_success(self, data):
        data = data.replace('\r\n', '')
        self.sendLine(data)
 
    def send_errback(self, err):
        self.sendLine('Server error')
        self.transport.loseConnection()
 
 
class WebGetFactory(protocol.ServerFactory):
    protocol = WebGetProtocol
 
 
application = service.Application("webget")
webget = internet.TCPServer(9000, WebGetFactory())
webget.setServiceParent(application)
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server