Changeset 836

Show
Ignore:
Timestamp:
04/04/07 10:19:38
Author:
mylan
Message:

Add support of skin, generated with older qPSD version, fix some issues

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneSkinDump/trunk/HISTORY.txt

    r788 r836  
     1qPloneSkinDump 0.7.3 
     2    - Add support skins, generated under older qPloneSkinDump version. 
     3    - Fix some issues 
     4 
    15qPloneSkinDump 0.7.2 
    26    - Fixed id.extension - meta_type confusing bug. 
  • qPloneSkinDump/trunk/skin_template/Extensions/utils.py

    r503 r836  
    2121SUMMARY_CLEAN = "> Finished cleaning." 
    2222CREXP_INVALID_ID = re.compile('^The id \"(.*?)\" is invalid - it is already in use.$', re.DOTALL|re.IGNORECASE|re.MULTILINE) 
     23CSS_BASE_IDS_QPSD053 = ['id','expression','enabled','cookable','media','rel','title','rendering']   # supporting qPSD-0.5.3 version 
    2324################    CHECK IMPORTING    ################ 
    2425def checkIfImport(): 
     
    319320        print >> out, "!!! - BAD: your Resource Regestry have'nt %%s resource(s), which may lead to some problems." %% unexistent 
    320321 
     322def getVersion(res_list): 
     323    """Check version of skin product generator.""" 
     324    return (res_list and not '::' in res_list[0] and '0.5') or '0.7' 
     325 
    321326def uninstallResource(portal_res, original_res_list, RESOURCE_SKIN_LIST, resRegisterFunction): 
    322327    # Prepare Resource Registry data for backup to original state 
    323328    original_res_regestry = {} 
     329    genVersion = getVersion(original_res_list) 
    324330    for rec in original_res_list: 
    325331        resource = {} 
    326         [resource.update({prop.split('::')[0]:prop.split('::')[1]}) for prop in rec.split(";")] 
     332        if genVersion == '0.7': 
     333            [resource.update({prop.split('::')[0]:prop.split('::')[1]}) for prop in rec.split(";")] 
     334        elif genVersion == '0.5': 
     335            props = rec.split(";") 
     336            [resource.update({CSS_BASE_IDS_QPSD053[i]:props[i]}) for i in range(len(CSS_BASE_IDS_QPSD053))] 
    327337        original_res_regestry[resource.pop('id')] = resource 
    328338    # Work up actual Resource Registry 
  • qPloneSkinDump/trunk/utils.py

    r788 r836  
    1717    'Page Template', 
    1818    'Script (Python)' ] 
    19 _acceptable_meta_types = _write_custom_meta_type_list + ['Folder'
     19_acceptable_meta_types = _write_custom_meta_type_list + ['Folder',
    2020ospJoin = os.path.join 
    2121 
  • qPloneSkinDump/trunk/version.txt

    r788 r836  
    1 0.7.2 
     10.7.3 
  • qPloneSkinDump/trunk/write_utils.py

    r537 r836  
    33# was made some correction in ControllerBaseMetadata forming procedure 
    44# 
     5import sys 
    56 
    67def writeObjectsMeta( obj_meta, basepath ): 
     
    116117    "Write a list of strings to a file, joining list items with '\n'." 
    117118    f = open( filename, 'wb' ) 
    118     f.write( '\n'.join( [prepareData(item) for item in data]) ) 
     119    try: 
     120        f.write( '\n'.join( [prepareData(item) for item in data]) ) 
     121    except: 
     122        exc_type, exc_value, trace = sys.exc_info() 
     123        raise Exception("There is %s (%s) exception while dumping %s file." % (exc_value, exc_type, filename)) 
    119124    f.close() 
    120125