Attachment 'pcon-pmsg_tmpl.py'

Download

   1 #coding=utf-8
   2 from Template import T
   3 
   4 main=T("""# -*- coding: utf-8 -*-
   5 # °æÈ¨ 2004 ×ÄľÄñ»ù½ð»á
   6 # ±£ÁôÒ»ÇÐȨÀû¡£
   7 # 
   8 # ÖØÐ·ַ¢»òÕßʹÓÃÔ´´úÂë¸ñʽºÍ¶þ½øÖƸñʽ£¬ÎÞÂÛÊÇ·ñÐ޸쬱ØÐëÔÚ·ûºÏ
   9 # ÒÔÏÂÐí¿ÉÌõ¼þµÄÇé¿öϽøÐУº
  10 # 1. ÖØÐ·ַ¢µÄÔ´´úÂë±ØÐë±£ÁôÉÏÊö°æÈ¨ÐÅÏ¢¡¢±¾Ðí¿ÉÌõ¼þÁбíÒÔ¼°ÏÂÁÐ
  11 #    ·ñÈÏÉùÃ÷¡£
  12 # 2. ÖØÐ·ַ¢µÄ¶þ½øÖƸñʽ³ÌÐò±ØÐëÔٴβúÉúÉÏÊö°æÈ¨ÐÅÏ¢£¬±¾Ðí¿ÉÌõ¼þÁÐ
  13 #    ±íÒÔ¼°ÔÚ±¾·Ö·¢ÖеÄÎĵµ»òÕ߯äËû²ÄÁÏÖÐÌṩµÄ·ñÈÏÉùÃ÷¡£
  14 #
  15 # ±¾Èí¼þÊÇÓÉ×÷ÕߺͲÎÓëÕß¡°ÕÕ´Ë¡±Ìṩ£¬²¢ÇÒÈκÎÏÔʽ»òÒþʽµÄ±£Ö¤£¬Ö»
  16 # °üº¬ÔÚÄÚµ«²»±»ÆäÏÞÖÆ£¬·ñÈÏÈκÎÉÌÒµÐÔºÍÌØÊâÄ¿µÄÊÊÇÐÐÔµÄÒþʽµ£±£
  17 # ֮ЧÁ¦¡£±¾Èí¼þµÄ×÷Õß»ò²ÎÓëÕß²»¶ÔÓÉÓÚ±¾Èí¼þÔì³ÉµÄÈκÎÖ±½ÓµØ¡¢
  18 # ¼ä½ÓµØ¡¢Á¬´øµØ¡¢ÌØÊâµØ¡¢³Í½äÐԵأ¬»òÕßÓɴ˶ø²úÉúµØË𺦣¨»¹°üÀ¨
  19 # ÒÔϵIJ»±»ÆäÏÞÖÆµÄÄÚÈÝÔÚÄÚ£ºÌæ´úÆ·»ò·þÎñµØÈ¡µÃ£»Ê¹Óùý³Ì¡¢Êý¾Ý¡¢
  20 # »òÓɴ˲úÉúµÄÊÕÒæÖ®Ëðʧ£»»òÉÌÒµÐÐΪµÄÖжϣ©·¢ÉúÔÚ¼´Ê¹±»¸æÖª¿ÉÄÜ
  21 # ³öÏÖÉÏÊöË𺦺ó£¬ÈÔÉè·¨°ÚÍÑʹÓñ¾Èí¼þµÄ¹ý³ÌÖУ¬ÎÞÂÛÆäÆðÒòºÍÈκÎ
  22 # ÔðÈεØÍƲ⣬ÆäÊÇ·ñÊôÓÚºÏͬ·¶³ë¡¢ÏÞ¶¨µÄÒåÎñ¡¢»òÕßÃñÊÂÇÖȨÐÐΪ
  23 #£¨°üÀ¨Êèºö¼°ÆäËû£©¶¼·ñÈÏÆäÔðÈΡ£
  24 # 
  25 # 
  26 #
  27 # Copyright (c) 2004 The Woodpecker Foundation
  28 # All rights reserved.
  29 #
  30 # Redistribution and use in source and binary forms, with or without
  31 # modification, are permitted provided that the following conditions
  32 # are met:
  33 # 1. Redistributions of source code must retain the above copyright
  34 #    notice, this list of conditions and the following disclaimer.
  35 # 2. Redistributions in binary form must reproduce the above copyright
  36 #    notice, this list of conditions and the following disclaimer in the
  37 #    documentation and/or other materials provided with the distribution.
  38 #
  39 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  40 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  41 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  42 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  43 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  44 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  45 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  46 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  47 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  48 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  49 # SUCH DAMAGE.
  50 #
  51 # $Header: /woodpecker/otter/ottertools/OtterBaseTemplet/lib/messages/pcon-pmsg.py,v 1.5 2004/08/19 07:45:28 zhaoxin Exp $
  52 
  53 \"\"\"¶þ½øÖÆÁ÷³¤Á¬½ÓͨѶЭÒé´¦Àí
  54 
  55 @author: Otter ToolKit
  56 
  57 @see: ¶þ½øÖÆÁ÷ͨѶ³¤Á¬½Ó¹æ·¶
  58 \"\"\"
  59 from ###Lprotoname###.message import ###MsgBase###
  60 import struct
  61 
  62 class ###Uprotoname###PMessage(###MsgBase###.ByteMessage):
  63     \"\"\"¶þ½øÖÆÁ÷Á¬½ÓÏûÏ¢»ùÀà\"\"\"
  64     def __init__(self):
  65         # ÏûϢͷ
  66         self.head = ###MsgBase###.ByteMessageHead(self)
  67         # ÏûÏ¢Ìå
  68         self.body = ###MsgBase###.ByteMessageBody(self)
  69         # ÏûÏ¢¹¤¾ß
  70         self.msgutilcls = ###Uprotoname###PMessageUtil
  71         # ЭÒéÃû³Æ
  72         self.protocolname = '###Lprotoname###p'
  73         # µ±Ç°µÄÏûÏ¢Ãû³Æ
  74         self.msgname = ''
  75 
  76 ###Commands###
  77 
  78 class ###Uprotoname###PMessageUtil(###MsgBase###.ByteMessageUtil):
  79     \"\"\"¶þ½øÖƳ¤Á¬½ÓÏûÏ¢´¦Àí¹¤¾ßÀà\"\"\"
  80     def __init__(self):
  81         pass
  82 
  83 # ÏûÏ¢¶¨Òå
  84 ###Uprotoname###PMessageUtil.commandinfo = {
  85 ###Commandsinfo###
  86     }
  87 
  88 # ͨ¹ýÃû³Æ²é³öÏûÏ¢IDµÄ½á¹¹¶¨Òå
  89 ###Uprotoname###PMessageUtil.nametoid = {}
  90 for k in ###Uprotoname###PMessageUtil.commandinfo.keys():
  91     ###Uprotoname###PMessageUtil.nametoid[###Uprotoname###PMessageUtil.commandinfo[k]] = k
  92 
  93 """)
  94 
  95 Commands = T("""    def pack_###Lprotoname###p_###commandname###(self, fields):
  96 ###packcontent###
  97 
  98     def unpack_###Lprotoname###p_###commandname###(self, fields):
  99 ###unpackcontent###
 100 
 101 """)
 102 
 103 Lprotoname = T("###lpname###")
 104 Uprotoname = T("###upname###")
 105 packcontent = T('')
 106 unpackcontent = T('')
 107 Commandsinfo=T("    ###flag### : '###name###',\n")

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-05-11 08:52:16, 30.3 KB) [[attachment:otter.gif]]
  • [get | view] (2021-05-11 08:52:16, 3.9 KB) [[attachment:pcon-pmsg_tmpl.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.