# Path: bliss/saga/Exception.py
# class Exception(Exception):
#     """ The Exception class encapsulates information about error conditions
#         encountered in SAGA/Bliss.
# 
#         Additionally to the error message (e.message), the exception also provides
#         a trace to the code location where the error condition got raised
#         (e.traceback), and an error code (e.error) which identifies the type of
#         error encountered.
#  
#         B{Example}::
# 
#           try :
#               file = saga.filesystem.File("sftp://alamo.futuregrid.org/tmp/data1.dat")
# 
#           except saga.Exception, e :
#               if e.error == saga.Error.Timeout:
#                   # maybe the network is down?
#                   print "connection timed out"
#               else:
#                   # something else went wrong
#                   print "Exception occurred: %s %s" % (str(e), e.traceback)
# 
#         """
# 
#     ######################################################################
#     ##
#     def __init__(self, error, message):
#         """Create a new Exception object.
# 
#            @param error:   The type of error
#            @type  error:   L{Error}
#            @param message: The error message
#            @type  message: str
#         """
#         self._error = error
#         self._message = message
#         self._traceback = _get_exception_traceback()
# 
#     ######################################################################
#     ##
#     def __str__(self):
#         """String representation (utf-8)."""
#         return unicode(self).decode('utf-8', 'ignore')
# 
#     ######################################################################
#     ##
#     def __unicode__(self):
#         """Unicode representation."""
#         ucstring = u'SAGA Exception (%s): %s' % (unicode(self.error), unicode(self.message))
#         return ucstring
# 
#     ######################################################################
#     ##
#     @property
#     def message(self):
#         """The Exception's error message."""
#         return self._message
# 
#     ######################################################################
#     ##
#     @property
#     def error(self):
#         """The Exception's L{Error} type."""
#         return self._error
# 
#     ######################################################################
#     ##
#     @property
#     def traceback(self):
#         """The Exception's stack trace (if available)."""
#         return self._traceback
# 
# Path: bliss/saga/Error.py
# class Error:
#     """The SAGA error types.
# 
#        SAGA error types are used by the L{Exception} class to 
#        indicate the type of error that has occured.
#     """
# 
#     # entity errors
#     AlreadyExists        = 'AlreadyExists'
#     ''' The entity to be created already exists. '''
# 
#     DoesNotExist         = 'DoesNotExist'
#     ''' An operation tried to access a non-existing entity. '''
# 
#     IncorrectState       = 'IncorrectState'
#     ''' The operation is not allowed on the entity in its current state. '''
# 
#     
#     # parameter errors
#     BadParameter         = 'BadParameter'
#     ''' A given parameter is out of bound or ill formatted. '''
# 
#     IncorrectURL         = 'IncorrectURL'
#     ''' The given URL could not be interpreted, for example due to an incorrect schema.''' 
# 
# 
#     # security errors
#     AuthenticationFailed = 'AuthenticationFailed'
#     ''' The backend could not establish a valid identity. '''
# 
#     AuthorizationFailed  = 'AuthorizationFailed'
#     ''' The used identity is not allowed to use the backend, '''
# 
#     PermissionDenied     = 'PermissionDenied'
#     ''' The used identity is not permitted to perform the requested operation.  '''
# 
# 
#     # implementation / backend errors
#     Timeout              =  'Timeout'
#     ''' The interaction with the backend times out. '''
# 
#     NoSuccess            = 'NoSuccess'
#     ''' Some other error occurred. '''
# 
#     NotImplemented       = 'NotImplemented'
#     ''' Bliss does not implement this method. '''


from bliss.saga.Exception import Exception as SAGAException
from bliss.saga.Error import Error as SAGAError
        '''Check if an attribute is read-only.

        Example::


          d = saga.Attribute()

          # check
          if d.attribute_is_writable("key") :
              d.set_attribute("key", "val")
          fi



        There is no semantic equivalent in python's dicts., really -- dicts
        allow to write to any key.  The dict implementation in bliss will still
        fail though on ReadOnly keys, and will raise a 'PermissionDenied'
        exception::


          d = dict()

          try : 
              d["key"] = "val" 
          except Exception as e :
              print "no no no!"


        '''
        if not self._valid_attribute_key(key):

# Path: bliss/saga/Exception.py
# class Exception(Exception):
#     """ The Exception class encapsulates information about error conditions
#         encountered in SAGA/Bliss.
# 
#         Additionally to the error message (e.message), the exception also provides
#         a trace to the code location where the error condition got raised
#         (e.traceback), and an error code (e.error) which identifies the type of
#         error encountered.
#  
#         B{Example}::
# 
#           try :
#               file = saga.filesystem.File("sftp://alamo.futuregrid.org/tmp/data1.dat")
# 
#           except saga.Exception, e :
#               if e.error == saga.Error.Timeout:
#                   # maybe the network is down?
#                   print "connection timed out"
#               else:
#                   # something else went wrong
#                   print "Exception occurred: %s %s" % (str(e), e.traceback)
# 
#         """
# 
#     ######################################################################
#     ##
#     def __init__(self, error, message):
#         """Create a new Exception object.
# 
#            @param error:   The type of error
#            @type  error:   L{Error}
#            @param message: The error message
#            @type  message: str
#         """
#         self._error = error
#         self._message = message
#         self._traceback = _get_exception_traceback()
# 
#     ######################################################################
#     ##
#     def __str__(self):
#         """String representation (utf-8)."""
#         return unicode(self).decode('utf-8', 'ignore')
# 
#     ######################################################################
#     ##
#     def __unicode__(self):
#         """Unicode representation."""
#         ucstring = u'SAGA Exception (%s): %s' % (unicode(self.error), unicode(self.message))
#         return ucstring
# 
#     ######################################################################
#     ##
#     @property
#     def message(self):
#         """The Exception's error message."""
#         return self._message
# 
#     ######################################################################
#     ##
#     @property
#     def error(self):
#         """The Exception's L{Error} type."""
#         return self._error
# 
#     ######################################################################
#     ##
#     @property
#     def traceback(self):
#         """The Exception's stack trace (if available)."""
#         return self._traceback
# 
# Path: bliss/saga/Error.py
# class Error:
#     """The SAGA error types.
# 
#        SAGA error types are used by the L{Exception} class to 
#        indicate the type of error that has occured.
#     """
# 
#     # entity errors
#     AlreadyExists        = 'AlreadyExists'
#     ''' The entity to be created already exists. '''
# 
#     DoesNotExist         = 'DoesNotExist'
#     ''' An operation tried to access a non-existing entity. '''
# 
#     IncorrectState       = 'IncorrectState'
#     ''' The operation is not allowed on the entity in its current state. '''
# 
#     
#     # parameter errors
#     BadParameter         = 'BadParameter'
#     ''' A given parameter is out of bound or ill formatted. '''
# 
#     IncorrectURL         = 'IncorrectURL'
#     ''' The given URL could not be interpreted, for example due to an incorrect schema.''' 
# 
# 
#     # security errors
#     AuthenticationFailed = 'AuthenticationFailed'
#     ''' The backend could not establish a valid identity. '''
# 
#     AuthorizationFailed  = 'AuthorizationFailed'
#     ''' The used identity is not allowed to use the backend, '''
# 
#     PermissionDenied     = 'PermissionDenied'
#     ''' The used identity is not permitted to perform the requested operation.  '''
# 
# 
#     # implementation / backend errors
#     Timeout              =  'Timeout'
#     ''' The interaction with the backend times out. '''
# 
#     NoSuccess            = 'NoSuccess'
#     ''' Some other error occurred. '''
# 
#     NotImplemented       = 'NotImplemented'
#     ''' Bliss does not implement this method. '''


# Path: bliss/saga/Attributes.py
from bliss.saga.Exception import Exception as SAGAException
from bliss.saga.Error import Error as SAGAError

        '''Check if an attribute is read-only.

        Example::


          d = saga.Attribute()

          # check
          if d.attribute_is_writable("key") :
              d.set_attribute("key", "val")
          fi



        There is no semantic equivalent in python's dicts., really -- dicts
        allow to write to any key.  The dict implementation in bliss will still
        fail though on ReadOnly keys, and will raise a 'PermissionDenied'
        exception::


          d = dict()

          try : 
              d["key"] = "val" 
          except Exception as e :
              print "no no no!"


        '''
        if not self._valid_attribute_key(key):

            raise SAGAException(SAGAError.DoesNotExist, 