(self, chain, policy, counters=None)
Set the policy of *chain* to *policy*, and also update chain
        counters if *counters* is specified.
Set the policy of *chain* to *policy*, and also update chain
        counters if *counters* is specified.
Set the policy of * chain * to * policy * and also update chain counters if * counters * is specified .
def set_policy(self, chain, policy, counters=None):
        """Set the policy of *chain* to *policy*, and also update chain
        counters if *counters* is specified."""
        if isinstance(chain, Chain):
            chain = chain.name
        if isinstance(policy, Policy):
            policy = policy.name
        if counters:
            cntrs = xt_counters()
            cntrs.pcnt = counters[0]
            cntrs.bcnt = counters[1]
            cntrs = ct.pointer(cntrs)
        else:
            cntrs = None
        rv = self._iptc.iptc_set_policy(chain.encode(), policy.encode(),
                                        cntrs, self._handle)
        if rv != 1:
            raise IPTCError("can't set policy %s on chain %s: %s" %
                            (policy, chain, self.strerror()))
def set_policy ( self , chain , policy , counters = None ) : if isinstance ( chain , Chain ) : chain = chain . name if isinstance ( policy , Policy ) : policy = policy . name if counters : cntrs = xt_counters ( ) cntrs . pcnt = counters [ 0 ] cntrs . bcnt = counters [ 1 ] cntrs = ct . pointer ( cntrs ) else : cntrs = None rv = self . _iptc . iptc_set_policy ( chain . encode ( ) , policy . encode ( ) , cntrs , self . _handle ) if rv != 1 : raise IPTCError ( "can't set policy %s on chain %s: %s" % ( policy , chain , self . strerror ( ) ) )