auto_update_iplist.py
IPホイホイ用(ZMI上(customね)に設置してIP晒しページを更新するスクリプト)
Size 1 kB - File type text/python-sourceFile contents
## Script (Python) "auto_update_iplist" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=tgtid,ip,date ##title= ## ent = context #Check Target Content if ent.id != tgtid: return base_text = ent.getText() text=base_text.replace('\r','') chg_cr = False if text != base_text : chg_cr = True line = '<tr>\n<td>' + ip + '</td>\n<td>' + date + '</td>\n</tr>\n\n' # Add IPList ins_header1 = '<tbody>\n' ins_header2 = '<tr>\n<td>' ins_header = ins_header1 + ins_header2 new_text = text.replace( ins_header, ins_header1 + line + ins_header2 ) if chg_cr : new_text = new_text.replace('\n','\r\n') #Text Set ent.setText(new_text) # Index entry ent.reindexObject()