@@ -532,15 +532,22 @@ def __init__(self, min_stamp=None, max_stamp=None, include_time_ranges=None, exc
532532 super (Copy , self ).__init__ (kwargs .keys (), None , None , None , min_stamp , max_stamp ,
533533 include_time_ranges , exclude_time_ranges , include_tags , exclude_tags )
534534 self ._add_tags = add_tags
535- self .copy = kwargs
535+ self .copy = dict ()
536+ for topic_from , topic_to in kwargs :
537+ if not topic_from .startswith ('/' ):
538+ topic_from = '/' + topic_from
539+ self .copy [topic_from ] = topic_to
536540
537541 def filter (self , topic , datatype , data , md5sum , pytype , stamp , header , tags ):
538542 copy_tags = tags_for_generated_msg (tags )
539543 if self ._add_tags :
540544 copy_tags = copy_tags .union (self ._add_tags )
545+ topic_from = topic
546+ if not topic_from .startswith ('/' ):
547+ topic_from = '/' + topic_from
541548 return [
542549 (topic , datatype , data , md5sum , pytype , stamp , header , tags ),
543- (self .copy . get ( topic , topic ) , (datatype , data , md5sum , pytype ), stamp , header , copy_tags ),
550+ (self .copy [ topic_from ] , (datatype , data , md5sum , pytype ), stamp , header , copy_tags ),
544551 ]
545552
546553 def _str_params (self ):
0 commit comments