當前位置: 首頁>>代碼示例>>Python>>正文


Python ChangeList.mapper方法代碼示例

本文整理匯總了Python中resync.change_list.ChangeList.mapper方法的典型用法代碼示例。如果您正苦於以下問題:Python ChangeList.mapper方法的具體用法?Python ChangeList.mapper怎麽用?Python ChangeList.mapper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在resync.change_list.ChangeList的用法示例。


在下文中一共展示了ChangeList.mapper方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: write_change_list

# 需要導入模塊: from resync.change_list import ChangeList [as 別名]
# 或者: from resync.change_list.ChangeList import mapper [as 別名]
 def write_change_list(self,paths=None,outfile=None,ref_sitemap=None,newref_sitemap=None,
                       empty=None,links=None,dump=None):
     """Write a change list
     
     Unless the both ref_sitemap and newref_sitemap are specified then the Change 
     List is calculated between the reference an the current state of files on
     disk. The files on disk are scanned based either on the paths setting or
     else on the mappings.
     """
     cl = ChangeList(ln=links)
     if (not empty):
         # 1. Get and parse reference sitemap
         old_rl = self.read_reference_resource_list(ref_sitemap)
         # 2. Depending on whether a newref_sitemap was specified, either read that 
         # or build resource list from files on disk
         if (newref_sitemap is None):
             # Get resource list from disk
             new_rl = self.build_resource_list(paths=paths,set_path=dump)
         else:
             new_rl = self.read_reference_resource_list(newref_sitemap,name='new reference')
         # 3. Calculate change list
         (same,updated,deleted,created)=old_rl.compare(new_rl)   
         cl.add_changed_resources( updated, change='updated' )
         cl.add_changed_resources( deleted, change='deleted' )
         cl.add_changed_resources( created, change='created' )
     # 4. Write out change list
     cl.mapper = self.mapper
     cl.pretty_xml = self.pretty_xml
     if (self.max_sitemap_entries is not None):
         cl.max_sitemap_entries = self.max_sitemap_entries
     if (outfile is None):
         print cl.as_xml()
     else:
         cl.write(basename=outfile)
     self.write_dump_if_requested(cl,dump)
開發者ID:EHRI,項目名稱:resync,代碼行數:37,代碼來源:client.py


注:本文中的resync.change_list.ChangeList.mapper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。