parameters: (self, target_path, serve_wms)
return_statement: return target_id
docstring: Adds target path into target_table and sets serve_wms flag.
  
      Args:
        target_path: target path.
        serve_wms: whether target point is servable through WMS.
      Raises:
        psycopg2.Error/Warning, PublishServeException.
        PublishServeException is raised in case of this target path is already
        in use.
      Returns:
        target_id: ID of added/existed target point.
docstring_summary: Adds target path into target_table and sets serve_wms flag.
docstring_tokens: Adds target path into target_table and sets serve_wms flag .
function: def _AddTarget(self, target_path, serve_wms):
      """Adds target path into target_table and sets serve_wms flag.
  
      Args:
        target_path: target path.
        serve_wms: whether target point is servable through WMS.
      Raises:
        psycopg2.Error/Warning, PublishServeException.
        PublishServeException is raised in case of this target path is already
        in use.
      Returns:
        target_id: ID of added/existed target point.
      """
      assert target_path and target_path[0] == "/" and target_path[-1] != "/"
      # Check if the target point already exists.
      # Note: Here we have case-sensitive query for target from target_table.
      # It allows to keep target path as user have entered it.
      target_id = self._QueryTargetIdByPath(target_path)
      if target_id != -1:
        # Check if the target point is currently used.
        if self._QueryIsTargetUsed(target_id):
          # Note: might be an assert since we check it before.
          raise exceptions.PublishServeException(
              "Target path %s is already in use. Note that paths are "
              "case insensitve. Input another path"
              " or un-publish database using this path." % target_path)
  
        # Sets serve_wms flag for existing path.
        query_string = ("UPDATE target_table SET serve_wms = %s"
                        " WHERE target_path = %s")
        self.DbModify(query_string, (serve_wms, target_path))
        return target_id
  
      # Add the target point entry.
      query_string = (
          "INSERT INTO target_table (target_path, serve_wms) VALUES(%s, %s)")
      self.DbModify(query_string, (target_path, serve_wms))
      target_id = self._QueryTargetIdByPath(target_path)
      return target_id
function_tokens: def _AddTarget ( self , target_path , serve_wms ) : assert target_path and target_path [ 0 ] == "/" and target_path [ - 1 ] != "/" # Check if the target point already exists. # Note: Here we have case-sensitive query for target from target_table. # It allows to keep target path as user have entered it. target_id = self . _QueryTargetIdByPath ( target_path ) if target_id != - 1 : # Check if the target point is currently used. if self . _QueryIsTargetUsed ( target_id ) : # Note: might be an assert since we check it before. raise exceptions . PublishServeException ( "Target path %s is already in use. Note that paths are " "case insensitve. Input another path" " or un-publish database using this path." % target_path ) # Sets serve_wms flag for existing path. query_string = ( "UPDATE target_table SET serve_wms = %s" " WHERE target_path = %s" ) self . DbModify ( query_string , ( serve_wms , target_path ) ) return target_id # Add the target point entry. query_string = ( "INSERT INTO target_table (target_path, serve_wms) VALUES(%s, %s)" ) self . DbModify ( query_string , ( target_path , serve_wms ) ) target_id = self . _QueryTargetIdByPath ( target_path ) return target_id