parameters: (f, origin = None, rdclass = dns.rdataclass.IN,
                relativize = True, zone_factory=Zone, filename=None,
                allow_include=True, check_origin=True)
return_statement: return z
docstring: Read a master file and build a zone object.
  
      @param f: file or string.  If I{f} is a string, it is treated
      as the name of a file to open.
      @param origin: The origin of the zone; if not specified, the first
      $ORIGIN statement in the master file will determine the origin of the
      zone.
      @type origin: dns.name.Name object or string
      @param rdclass: The zone's rdata class; the default is class IN.
      @type rdclass: int
      @param relativize: should names be relativized?  The default is True
      @type relativize: bool
      @param zone_factory: The zone factory to use
      @type zone_factory: function returning a Zone
      @param filename: The filename to emit when describing where an error
      occurred; the default is '<file>', or the value of I{f} if I{f} is a
      string.
      @type filename: string
      @param allow_include: is $INCLUDE allowed?
      @type allow_include: bool
      @param check_origin: should sanity checks of the origin node be done?
      The default is True.
      @type check_origin: bool
      @raises dns.zone.NoSOA: No SOA RR was found at the zone origin
      @raises dns.zone.NoNS: No NS RRset was found at the zone origin
      @rtype: dns.zone.Zone object
docstring_summary: Read a master file and build a zone object.
docstring_tokens: Read a master file and build a zone object .
function: def from_file(f, origin = None, rdclass = dns.rdataclass.IN,
                relativize = True, zone_factory=Zone, filename=None,
                allow_include=True, check_origin=True):
      """Read a master file and build a zone object.
  
      @param f: file or string.  If I{f} is a string, it is treated
      as the name of a file to open.
      @param origin: The origin of the zone; if not specified, the first
      $ORIGIN statement in the master file will determine the origin of the
      zone.
      @type origin: dns.name.Name object or string
      @param rdclass: The zone's rdata class; the default is class IN.
      @type rdclass: int
      @param relativize: should names be relativized?  The default is True
      @type relativize: bool
      @param zone_factory: The zone factory to use
      @type zone_factory: function returning a Zone
      @param filename: The filename to emit when describing where an error
      occurred; the default is '<file>', or the value of I{f} if I{f} is a
      string.
      @type filename: string
      @param allow_include: is $INCLUDE allowed?
      @type allow_include: bool
      @param check_origin: should sanity checks of the origin node be done?
      The default is True.
      @type check_origin: bool
      @raises dns.zone.NoSOA: No SOA RR was found at the zone origin
      @raises dns.zone.NoNS: No NS RRset was found at the zone origin
      @rtype: dns.zone.Zone object
      """
  
      if sys.hexversion >= 0x02030000:
          # allow Unicode filenames; turn on universal newline support
          str_type = basestring
          opts = 'rU'
      else:
          str_type = str
          opts = 'r'
      if isinstance(f, str_type):
          if filename is None:
              filename = f
          f = file(f, opts)
          want_close = True
      else:
          if filename is None:
              filename = '<file>'
          want_close = False
  
      try:
          z = from_text(f, origin, rdclass, relativize, zone_factory,
                        filename, allow_include, check_origin)
      finally:
          if want_close:
              f.close()
      return z
function_tokens: def from_file ( f , origin = None , rdclass = dns . rdataclass . IN , relativize = True , zone_factory = Zone , filename = None , allow_include = True , check_origin = True ) : if sys . hexversion >= 0x02030000 : # allow Unicode filenames; turn on universal newline support str_type = basestring opts = 'rU' else : str_type = str opts = 'r' if isinstance ( f , str_type ) : if filename is None : filename = f f = file ( f , opts ) want_close = True else : if filename is None : filename = '<file>' want_close = False try : z = from_text ( f , origin , rdclass , relativize , zone_factory , filename , allow_include , check_origin ) finally : if want_close : f . close ( ) return z