File: testfile.pyg

package info (click to toggle)
pygopherd 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,928 kB
  • sloc: python: 6,534; makefile: 40; sh: 28
file content (20 lines) | stat: -rwxr-xr-x 496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from pygopherd.handlers.pyg import PYGBase
from pygopherd.gopherentry import GopherEntry


class PYGMain(PYGBase):
    def canhandlerequest(self):
        return True

    def isdir(self):
        return False

    def getentry(self):
        entry = GopherEntry(self.selector, self.config)
        entry.type = "0"
        entry.mimetype = "text/plain"
        entry.name = "My custom .pyg handler!"
        return entry

    def write(self, wfile):
        wfile.write("hello world!".encode())