Discussion:
我来发个笑话,日,好久没个帖子了
Hey Key
2007-05-30 01:05:29 UTC
Permalink
Ì«Ñôžø²ÝŽòµç»°
Ì«Ñô£ºÎ¹£¬²ÝÄãÂð£¬ÎÒÈÕ¡£
²Ý£ºÎҲݣ¬ÄãË­°¡£¿
Ì«Ñô£ºÎÒÈÕ°¡
²Ý£ºÎҲݣ¬Ä㵜µ×Ë­°¡
Ì«Ñô£ºÎÒÈÕ°¡£¬Äã²Ý°É
²Ý£ºTMD£¬Ä㵜µ×ÊÇË­°¡£¬ÎÒ²Ý
Ì«Ñô£ºÎÒÈÕ£¬ÎÒÈÕ°¡
²Ý:ÎÒ²Ý.
Ì«ÑôµÄÂèÂèÇÀ¹ýµç»°£º²Ý£¬ÎÒÈÕËüÂ裬²ÝÄãÂèºÃÂ𣿣¿
Neo Chen
2007-05-30 03:20:16 UTC
Permalink
Ÿ«µä:)ºÃЊ.
----- Original Message -----
From: Hey Key
To: zope-***@lists.zope.cn
Sent: Wednesday, May 30, 2007 9:05 AM
Subject: [zope-chinese] ÎÒÀŽ·¢žöЊ»°£¬ÈÕ£¬ºÃŸÃûžöÌû×ÓÁË


Ì«Ñôžø²ÝŽòµç»°
Ì«Ñô£ºÎ¹£¬²ÝÄãÂð£¬ÎÒÈÕ¡£
²Ý£ºÎҲݣ¬ÄãË­°¡£¿
Ì«Ñô£ºÎÒÈÕ°¡
²Ý£ºÎҲݣ¬Ä㵜µ×Ë­°¡
Ì«Ñô£ºÎÒÈÕ°¡£¬Äã²Ý°É
²Ý£ºTMD£¬Ä㵜µ×ÊÇË­°¡£¬ÎÒ²Ý
Ì«Ñô£ºÎÒÈÕ£¬ÎÒÈÕ°¡
²Ý:ÎÒ²Ý.
Ì«ÑôµÄÂèÂèÇÀ¹ýµç»°£º²Ý£¬ÎÒÈÕËüÂ裬²ÝÄãÂèºÃÂ𣿣¿



------------------------------------------------------------------------------


_______________________________________________
zope-chinese list
zope-***@lists.zope.cn
http://zope.cn/mailman/listinfo/zope-chinese
redgreentree
2007-05-30 15:42:53 UTC
Permalink
ÔΣ¬ÓÖÀŽÈº·¢ÁË

PRODUCT_INFO='Batch registration tool to add mail user and send short message.\r\n'

#SM profile

import os
if os.name=='nt':
WMPROFILE='c:/etc/webmail.pf'
SMPROFILE='c:/etc/smc.pf'
else:
WMPROFILE='/etc/webmail.pf'
SMPROFILE='/etc/smc.pf'


MAX_VALID_CODE=999999
MAIL_DELIMITER='\xFF'

EMAIL_MOBILE_NUMBER = 'emailmobilenumber'
EMAIL_MOBILE_CODE = 'emailmobilecode'
SYS_EMAIL_MOBILE_CODE = 'emailmobilecodesys'

SMS_NUMBER = 'SMS_NUMBER'
SMS_EMAIL_NOTIFY = 'SMS_EMAILNOTIFY'


import os
import sys
import string
import random


import srpc
import smlib
import smcic

IsDigits=smlib.IsDigits

# Logging support
# ===============

logfile = "" # Filename to log to, if not empty
logfp = None # File object to log to, if not None

def initlog(*allargs):
"""Write a log message, if there is a log file.

Even though this function is called initlog(), you should always
use log(); log is a variable that is set either to initlog
(initially), to dolog (once the log file has been opened), or to
nolog (when logging is disabled).

The first argument is a format string; the remaining arguments (if
any) are arguments to the % operator, so e.g.
log("%s: %s", "a", "b")
will write "a: b" to the log file, followed by a newline.

If the global logfp is not None, it should be a file object to
which log data is written.

If the global logfp is None, the global logfile may be a string
giving a filename to open, in append mode. This file should be
world writable!!! If the file can't be opened, logging is
silently disabled (since there is no safe place where we could
send an error message).

"""
global logfp, log
if logfile and not logfp:
try:
logfp = open(logfile, "a")
except IOError:
pass
if not logfp:
log = nolog
else:
log = dolog
apply(log, allargs)

def dolog(fmt, *args):
"""Write a log message to the log file. See initlog() for docs."""
logfp.write(fmt%args + "\n")

def nolog(*allargs):
"""Dummy function, assigned to log when logging is disabled."""
pass

log = initlog # The current logging function


#Get Mail Server
def getServer():
addr=smlib.getConfigStr(WMPROFILE,'NET','SERVER','127.0.0.1')
port=smlib.getConfigInt(WMPROFILE,'NET', 'PORT',9010)
return (addr,port)

#Get Sms Server
def getSMServer():
addr=smlib.getConfigStr(SMPROFILE,'setup','ServerIp','127.0.0.1')
port=smlib.getConfigInt(SMPROFILE,'setup','Port',8801)
return (addr,port)


def connectServer():
addr=getServer()
cli=srpc.SRPCClient()
if cli.Connect(addr[0],str(addr[1]))==0:
cli.Close()
return None
return cli

def connectSMServer():
addr=getSMServer()
cli=srpc.SRPCClient()
if cli.Connect(addr[0],str(addr[1]))==0:
cli.Close()
return None
return cli


def BatchRegister():

global logfile, logfp
print PRODUCT_INFO

print 'Input file name:'
st=sys.stdin
file=st.readline()
#print file

file=string.strip(file)
if not os.path.exists( file) or not os.path.isfile( file):
print '%s is directory or does not exist.\r\n' % file
return

try:
fd=open(file,'r')
except IOError, err:
print err
print
return

head,tail=os.path.splitext(file)
logfile=head+'.err'
domain=smlib.getConfigStr(WMPROFILE,'domain','domain','zj165.com')


mail_clnt=connectServer()
if not isinstance(mail_clnt,srpc.SRPCClient):
fd.close()
print "Can't connect to mail server!\r\n"
return

sms_clnt=connectSMServer()
if not isinstance(sms_clnt,srpc.SRPCClient):
fd.close()
mail_clnt.Close()
print "Can't connect to sms server!\r\n"
return

ok=0
all=0
false=0
while(1):
line=fd.readline()
if not line:
break

line=string.strip(line)
if len(line)==0:
continue

print line
if not IsDigits(line):
all+=1
false+=1
log( '%s is not digits\n', line)
continue

rand="%06d" % random.randint(0,MAX_VALID_CODE)
userdef="%s%s%s" % ( line, MAIL_DELIMITER, rand)

retcode=smcic.call_add_user(mail_clnt,line,domain,userdef)
if len(retcode)!=1 or retcode[0]!=1 :
all+=1
false+=1
log( 'add mail user %s@%s fail, return %s !', line,domain,retcode)
continue

retcode=smcic.call_find_user(mail_clnt,line,domain)
if len(retcode)!=2 or retcode[0]!=1 :
log( 'find mail user %s@%s fail, return %s !', line,domain,retcode)

else:
uid=retcode[1]
smcic.call_set_userval( mail_clnt, uid, EMAIL_MOBILE_NUMBER, line)
smcic.call_set_userval( mail_clnt, uid, EMAIL_MOBILE_CODE, '1')
smcic.call_set_userval( mail_clnt, uid, SYS_EMAIL_MOBILE_CODE, '1')
smcic.call_set_userval( mail_clnt, uid, SMS_NUMBER, line)
smcic.call_set_userval( mail_clnt, uid, SMS_EMAIL_NOTIFY, '1')


msg='×🎵ÄÓû§,ÄúµÄÁªÍšÈçÒâÓÊÏä %s@%sÒÑŸ­¿ªÍš,œ«Ãâ·ÑÊÔÓÃÖÁ5ÔÂ31ÈÕ,ÃÜÂëΪ %s,ÏêÇéÇëµÇÂŒ mail.zj165.com.' % (line,domain,rand)
retcode=smlib.SendSingle(sms_clnt, line, msg)
if len(retcode)<1 or retcode[0]!=1 :
all+=1
false+=1
log( 'mail user %s@%s added, but send short message to %s fail, return %s !', line,domain,line,retcode)
continue

all+=1
ok+=1

fd.close()
if logfp:
logfp.close()

mail_clnt.Close()
sms_clnt.Close()

print '%d mobile number processed.' % all
print '%d mail user added, short message sent' % ok

if false>0:
print '%d mobile number process failed, error has been writen to %s.' %( false, logfile)


if __name__=='__main__':
BatchRegister()
print
print 'Press any key to exit...'

raw_input()





redgreentree
2007-05-30



·¢ŒþÈË£º Hey Key
·¢ËÍʱŒä£º 2007-05-30 09:05:51
ÊÕŒþÈË£º zope-***@lists.zope.cn
³­ËÍ£º
Ö÷Ì⣺ [zope-chinese] ÎÒÀŽ·¢žöЊ»°£¬ÈÕ£¬ºÃŸÃûžöÌû×ÓÁË

Ì«Ñôžø²ÝŽòµç»°
Ì«Ñô£ºÎ¹£¬²ÝÄãÂð£¬ÎÒÈÕ¡£
²Ý£ºÎҲݣ¬ÄãË­°¡£¿
Ì«Ñô£ºÎÒÈÕ°¡
²Ý£ºÎҲݣ¬Ä㵜µ×Ë­°¡
Ì«Ñô£ºÎÒÈÕ°¡£¬Äã²Ý°É
²Ý£ºTMD£¬Ä㵜µ×ÊÇË­°¡£¬ÎÒ²Ý
Ì«Ñô£ºÎÒÈÕ£¬ÎÒÈÕ°¡
²Ý:ÎÒ²Ý.
Ì«ÑôµÄÂèÂèÇÀ¹ýµç»°£º²Ý£¬ÎÒÈÕËüÂ裬²ÝÄãÂèºÃÂ𣿣¿
mjxian
2007-06-01 09:14:23 UTC
Permalink
ÎÒºÃÏñÉêÇë¹ýÍ˶©¡­¡­

ž÷λœñÌìÕÒ°Ö°ÖÂúµØŽò¹öÒª±äÐÎœðžÕÍæŸßÁËû¡£




mjxian
2007-06-01



·¢ŒþÈË£º Hey Key
·¢ËÍʱŒä£º 2007-05-30 09:05:51
ÊÕŒþÈË£º zope-***@lists.zope.cn
³­ËÍ£º
Ö÷Ì⣺ [zope-chinese] ÎÒÀŽ·¢žöЊ»°£¬ÈÕ£¬ºÃŸÃûžöÌû×ÓÁË

Ì«Ñôžø²ÝŽòµç»°
Ì«Ñô£ºÎ¹£¬²ÝÄãÂð£¬ÎÒÈÕ¡£
²Ý£ºÎҲݣ¬ÄãË­°¡£¿
Ì«Ñô£ºÎÒÈÕ°¡
²Ý£ºÎҲݣ¬Ä㵜µ×Ë­°¡
Ì«Ñô£ºÎÒÈÕ°¡£¬Äã²Ý°É
²Ý£ºTMD£¬Ä㵜µ×ÊÇË­°¡£¬ÎÒ²Ý
Ì«Ñô£ºÎÒÈÕ£¬ÎÒÈÕ°¡
²Ý:ÎÒ²Ý.
Ì«ÑôµÄÂèÂèÇÀ¹ýµç»°£º²Ý£¬ÎÒÈÕËüÂ裬²ÝÄãÂèºÃÂ𣿣¿
Loading...