예제 #1
0
def main():
   port = 55146
   host = "localhost"
   xs = x88.tcpconnect(host,port)
   xs.quit()
   print "Content-type: text/html"
   print
   print "<TITLE> udanax shutdown!</TITLE>"
   print "this should have shutdown  the backend!"
예제 #2
0
def main():
   port = 55146
   host = "localhost"
   xs = x88.tcpconnect(host,port)
#   xs.quit()

   docid = "1.0.1.0.1" 
# def opendoc(self, docid, editable=0):
   #     """Open a document, optionally for editing."""
   mode = editable and x88.READ_WRITE or x88.READ_ONLY # zzz this is wrong
   docid = self.xs.open_document(docid, mode, x88.CONFLICT_COPY)

   self.textvspan = self.linkvspan = None
   for vspan in self.xs.retrieve_vspanset(docid):
            span = vspan.span
            if vspan.span.start[0] == 1:
                # This will break if the back-end returns more than one span.
                self.textvspan = vspan.span
            elif vspan.span.start[0] == 2:
                self.linkvspan = vspan.span
            else:
                warn("ignoring vspan %s" % vspan)

   if self.textvspan is not None:
            textvspec = x88.VSpec(docid, [self.textvspan])
            self.textspec = x88.SpecSet(textvspec)
   else:
            warn("document contains no data")

#        self.updatefwdback()
 #       self.send("opendoc")
 

#def showdoc(self):
   #     """Display the contents of a document in the text area."""
   if self.textvspan is not None:
      text = self.xs.retrieve_contents(self.textspec)[0]

   print "Content-type: text/html"
   print
   print "<TITLE> udanax doc!</TITLE>"
   print "this should be a udanax doc!"
   print text
예제 #3
0
def main(argv):
    opts, args = getopt.getopt(argv[1:], "dt:a:")

    # defaults opt values
    tcp_addr = ()
    debug = 0
    doc_addr = "1.1.0.1.0.1"

    for opt in opts:
        if opt[0] == '-d':
            debug = True
        elif opt[0] == '-t':
            host, port = opt[1].split(':')
            tcp_addr = host, int(port)
        elif opt[0] == '-h':
            # todo: usage
            pass
        elif opt[0] == '-a':
            doc_addr = opt[1]

    os.chdir('bin/be')

    # get Xu session
    if debug and tcp_addr:
        ps = x88.DebugWrapper(x88.TcpStream(*tcp_addr), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)

    elif debug:
        ps = x88.DebugWrapper(x88.PipeStream("./backend"), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)

    elif tcp_addr:
        xs = x88.tcpconnect(*tcp_addr)

    else:
        xs = x88.pipeconnect("./backend")

    #addr = testcreatelink(xs)
    #tryout(xs, doc_addr)
    test2(xs, doc_addr)