code: def _get_layer_stub(self):
          
          layerobj = mapscript.layerObj()
          layerobj.name = self.name
          layerobj.status = mapscript.MS_ON
          projection = self.ogr_layer.GetSpatialRef()
          featureIdColumn = self._get_featureId_column()
          if featureIdColumn is not None and featureIdColumn != '' :
              layerobj.metadata.set('gml_featureid', featureIdColumn)
          if projection is not None:
              layerobj.setProjection(projection.ExportToProj4())
          if self.datastore.connection_type == "directory":
              #append the extension to the shapefile until mapserver bug 2895 is fixed
              datastr = os.path.normpath(self.datastore.datastore_str + "/" + self.name)
              if os.path.exists(datastr+'.shp'):
                  datastr = datastr+'.shp'
              elif os.path.exists(datastr+'.SHP'):
                  datastr = datastr+'.SHP'
              layerobj.data = datastr
          elif self.datastore.connection_type == "postgis":
              layerobj.connectiontype = mapscript.MS_POSTGIS
              #remove the leading "PG:" from the connection string
              layerobj.connection = self.datastore.datastore_str[3:].strip()
              if featureIdColumn is not None and featureIdColumn != '' :
                  layerobj.data = "%s from %s using unique %s" %(
                      self.ogr_layer.GetGeometryColumn(),
                      self.name,
                      featureIdColumn)
              else:
                  layerobj.data = "%s from %s"%(self.ogr_layer.GetGeometryColumn(),self.name)
          else:
              raise RuntimeError("unsupported connection type")
          if self.type == 'POINT':
              layerobj.type = mapscript.MS_LAYER_POINT
          elif self.type == 'POLYGON':
              layerobj.type = mapscript.MS_LAYER_POLYGON
          else:
              layerobj.type = mapscript.MS_LAYER_LINE
          return layerobj
docs: builds a minimal mapscript layerobj, with no styling