Loading...
Skip to end of metadata
Go to start of metadata

ArkAttribute objects support the following methods:

  • GetName()
    Return the name of the attribute.
  • GetType()
    Return the attribute type as it is used in the arKitect ('bool', 'int', 'str', 'pyscript', ...)
  • GetValue()
    Return the value of the attribute. The type of the returned object depends on the attribute type (Integer, Boolean, ...).
  • SetValue( value )
    Set the value of the attribute. The type of value must match the same rules used by GetValue().

    Saved File

    Icon

    This method will raise a ValueError exception for Saved File attribute. For Saved File attributes use special methods given below

  • Execute()
    For the attributes of type 'Program': executes the code in the attribute. Method returns the value, returned by the code. For other attribute types, method raises a ValueError exceptio
  • IsModifiable()
    Returns True if attribute value can be modified, False otherwise.
  • GetArkObj()
    Returns ArkObj owner object.

Methods for "SavedFiles" attributes:

  • DownloadFileSVN( fileName, folder=default files folder, revisionNumber=None)
    For the attributes of type 'Saved files': Download chosen file to specified or default folder.
    (revisionNumber parameter type : integer) if "revisionNumber" is not specified the latest is returned. Returns the path to the downloaded file
  • UploadFileSVN( path, fileComment=None, revisionComment=None)
    For the attributes of type 'Saved files': Upload chosen file on server side and add this file to attribute value. Optionally can set comment for the file.
    If a standard file with the same name already exists, the file you are uploading will be added as a new version of that file. Third argument allows specifying revision message. Upload failed if a shared file with same name already exist. Returns the resulting revision number from SVN server. 

  • GetFileRevisionListSVN(fileName)
    Returns a list of  dictionaries with the following keys ['user', 'time', 'description', 'file', 'revision'].
    (Values are of type "String" except the last one: "revison" of type "Integer").

  • RemoveFileSVN(fileName)
    Remove the saved file from SVN using its "fileName". Deleted file also removed from the attribute attached file list. Can not be used with shared files, use DetachSharedFile for them.
  • AttachSharedFile(fileName)
    Attaches named shared saved file to the object. Shared file can't be attached if a standard file already exists in attribute with the same name. Doesn't check existence
  • DetachSharedFile(fileName)
    Detaches named shared saved file from the object. Doesn't check existence

Examples:

import pyark
import os
def run(self):
     
    filePathList = r"C:\Users\SomeUserName\Desktop\Nouveau dossier"
    fileToUpdate = r"C:\Users\SomeUserName\Desktop\text.txt"
     
    # Upload files from "filePathList" to SVN
    for elt in os.listdir(filePathList):
        self.GetAttribute("SF").UploadFileSVN(os.path.join(filePathList, elt))
     
    # Upload a new version of the file "text.txt"
    self.GetAttribute("SF").UploadFileSVN(fileToUpdate)
     
    # Share file "text.txt"
    self.GetAttribute("SF").AttachSharedFile(os.path.basename(fileToUpdate))
 
    # Download all files from SVN
    for elt in self.GetAttribute("SF").GetValue():
        self.GetAttribute("SF").DownloadFileSVN(elt[0], r"C:\Users\SomeUserName\SomeFolder")
     
    # Download specific version of the file "text.txt"
    self.GetAttribute("SF").DownloadFileSVN("text.txt", r"C:\Users\SomeUserName\SomeFolder", "6079")
     
    # Displays revision list of all file from the repository
    for elt in os.listdir(filePathList):
        for item in self.GetAttribute("SF").GetFileRevisionListSVN(elt):           
            print item
  • No labels