Changeset 1722 in main


Ignore:
Timestamp:
11/07/12 15:14:39 (7 years ago)
Author:
pcosquer
Message:

document3D: fix get_all_geometry_files (returned too many files)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/apps/document3D/models.py

    r1665 r1722  
    234234                if tempfile_size: 
    235235                    filename = new_STP_file.filename 
    236                     path = docfs.get_available_name(filename) 
     236                    path = docfs.get_available_name(filename.encode("utf-8")) 
    237237                    shutil.copy(tempfile_size[0].name, docfs.path(path)) 
    238238                    new_doc = DocumentFile.objects.create(file=path, 
     
    307307                else: 
    308308                    self._stps = DocumentFile.objects.none().values_list("id", flat=True) 
    309             q = Q(stp=doc_file) | Q(stp__in=self._stps) 
     309            q = Q(stp=doc_file) 
     310            stps = list(self._stps) 
     311            if stps: 
     312                q |= Q(stp__in=self._stps) 
    310313            gfs = GeometryFile.objects.filter(q) 
    311314        else: 
     
    670673        old_product=Product_from_Arb(json.loads(old_arbre)) # doc_id and doc_path original 
    671674        new_stp_file=DocumentFile() 
    672         name = new_stp_file.file.storage.get_available_name(product.name+".stp".encode("utf-8")) 
     675        name = new_stp_file.file.storage.get_available_name((product.name+".stp").encode("utf-8")) 
    673676        new_stp_path = os.path.join(new_stp_file.file.storage.location, name) 
    674677        f = File(open(new_stp_path, 'w')) 
Note: See TracChangeset for help on using the changeset viewer.