Exemplo n.º 1
0
 def set_property(self, name, value, serializable=True):
     super(Principal, self).set_property(name, value, serializable)
     # fallback: create a new resource path
     if self._resource_path is None:
         if name == "Id":
             self._resource_path = ResourcePathEntity(
                 self.context, self._parent_collection.resourcePath,
                 ODataPathParser.from_method("GetById", [value]))
         elif name == "LoginName":
             self._resource_path = ResourcePathEntity(
                 self.context, self._parent_collection.resourcePath,
                 ODataPathParser.from_method("GetByName", [value]))
Exemplo n.º 2
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available("Id") and orig_path is None:
         return ResourcePathEntry(self.context,
                                  self.context.web.lists.resource_path,
                                  ODataPathParser.from_method("GetById", [self.properties["Id"]]))
     elif self.is_property_available("Title") and orig_path is None:
         path = ResourcePathEntry(self.context,
                                  ResourcePathEntry(self.context, None, "Web"),
                                  ODataPathParser.from_method("GetByTitle", [self.properties["Title"]]))
         return path
     return orig_path
Exemplo n.º 3
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available("Id") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.site_groups.resource_path,
             ODataPathParser.from_method("GetById",
                                         [self.properties["Id"]]))
     if self.is_property_available("LoginName") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.site_groups.resource_path,
             ODataPathParser.from_method("GetByName",
                                         [self.properties["LoginName"]]))
     return orig_path
Exemplo n.º 4
0
 def set_property(self, name, value, serializable=True):
     super(File, self).set_property(name, value, serializable)
     # fallback: create a new resource path
     if self._resource_path is None:
         if name == "ServerRelativeUrl":
             self._resource_path = ResourcePathEntity(
                 self.context, ResourcePathEntity(self.context, None,
                                                  "Web"),
                 ODataPathParser.from_method("GetFileByServerRelativeUrl",
                                             [value]))
         elif name == "UniqueId":
             self._resource_path = ResourcePathEntity(
                 self.context, ResourcePathEntity(self.context, None,
                                                  "Web"),
                 ODataPathParser.from_method("GetFileById", [value]))
Exemplo n.º 5
0
    def resource_path(self):
        resource_path = super(Principal, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("Id"):
            self._resource_path = ResourcePathEntity(
                self.context, self._parent_collection.resource_path,
                ODataPathParser.from_method("GetById",
                                            [self.properties["Id"]]))
        elif self.is_property_available("LoginName"):
            self._resource_path = ResourcePathEntity(
                self.context, self._parent_collection.resource_path,
                ODataPathParser.from_method("GetByName",
                                            [self.properties["LoginName"]]))
Exemplo n.º 6
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available(
             "ServerRelativeUrl") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.resource_path,
             ODataPathParser.from_method(
                 "GetFolderByServerRelativeUrl",
                 [self.properties["ServerRelativeUrl"]]))
     elif self.is_property_available("UniqueId") and orig_path is None:
         return ResourcePathEntry(
             self.context, self.context.web.resource_path,
             ODataPathParser.from_method(
                 "GetFolderById", [{
                     'guid': self.properties["UniqueId"]
                 }]))
     return orig_path
Exemplo n.º 7
0
 def set_property(self, name, value, serializable=True):
     super(ListItem, self).set_property(name, value, serializable)
     # fallback: create a new resource path
     if name == "Id":
         self._resource_path = ResourcePathEntity(
             self.context,
             self._parent_collection.resourcePath,
             ODataPathParser.from_method("getItemById", [value]))
 def service_operation_query(client_object,
                             action_type,
                             method_name,
                             method_params=None,
                             payload=None):
     url = client_object.url + "/" + ODataPathParser.from_method(
         method_name, method_params)
     qry = ClientQuery(url, action_type, payload)
     return qry
    def __init__(self, method_name, method_parameters=None, parent=None):
        """
        :type method_parameters: list or dict or office365.runtime.client_value.ClientValue or None
        :type method_name: str


        """
        super(ResourcePathServiceOperation, self).__init__(ODataPathParser.from_method(method_name, method_parameters),
                                                           parent)
Exemplo n.º 10
0
    def resource_path(self):
        resource_path = super(Folder, self).resource_path
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("ServerRelativeUrl"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity.from_uri("Web", self.context),
                ODataPathParser.from_method(
                    "GetFolderByServerRelativeUrl",
                    [self.properties["ServerRelativeUrl"]]))
        elif self.is_property_available("UniqueId"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity.from_uri("Web", self.context),
                ODataPathParser.from_method(
                    "GetFolderById", [{
                        'guid': self.properties["UniqueId"]
                    }]))
        return self._resource_path
Exemplo n.º 11
0
    def resourcePath(self):
        resource_path = super(ListItem, self).resourcePath
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("Id"):
            self._resource_path = ResourcePathEntity(
                self.context, self._parent_collection.resourcePath,
                ODataPathParser.from_method("getItemById",
                                            [self.properties["Id"]]))

        return self._resource_path
Exemplo n.º 12
0
 def resource_path(self):
     orig_path = ClientObject.resource_path.fget(self)
     if self.is_property_available("Id") and "ParentList" in self.properties and orig_path is None:
         parent_list = self.properties["ParentList"]
         if '__deferred' in parent_list:
             list_resource_path = ResourcePathEntry.from_uri(self.properties["ParentList"]['__deferred']['uri'],
                                                             self.context)
         else:
             list_resource_path = parent_list.resource_path
         return ResourcePathEntry(self.context,
                                  list_resource_path,
                                  ODataPathParser.from_method("getItemById", [self.properties["Id"]]))
     return orig_path
    def resourcePath(self):
        resource_path = super(AttachmentFile, self).resourcePath
        if resource_path:
            return resource_path

        # fallback: create a new resource path
        if self.is_property_available("ServerRelativeUrl"):
            self._resource_path = ResourcePathEntity(
                self.context, ResourcePathEntity(self.context, None, "Web"),
                ODataPathParser.from_method(
                    "GetFileByServerRelativeUrl",
                    [self.properties["ServerRelativeUrl"]]))

        return self._resource_path
Exemplo n.º 14
0
 def segment(self):
     return ODataPathParser.from_method(self._method_name,
                                        self._method_parameters)
Exemplo n.º 15
0
 def __init__(self, resource, method, method_name, method_params=None, payload=None):
     url = resource.resourceUrl + "/" + ODataPathParser.from_method(method_name, method_params)
     super(ServiceOperationQuery, self).__init__(url, method, payload)
Exemplo n.º 16
0
 def __init__(self, method_name, method_parameters=None, parent=None):
     super(ResourcePathServiceOperation, self).__init__(ODataPathParser.from_method(method_name, method_parameters),
                                                        parent)