diff --git a/doc/version.txt b/doc/version.txt index faef31a..39e898a 100644 --- a/doc/version.txt +++ b/doc/version.txt @@ -1 +1 @@ -0.7.0 +0.7.1 diff --git a/gen/__init__.py b/gen/__init__.py index b8d5513..4607632 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -1412,7 +1412,7 @@ class Boolean(Type): self.pythonType = bool def getDefaultLayouts(self): - return {'view': 'l;f!_', 'edit': Table('f;lrv;=', width=None)} + return {'view': 'l;f!-', 'edit': Table('f;lrv;=', width=None)} def getValue(self, obj): '''Never returns "None". Returns always "True" or "False", even if @@ -1566,7 +1566,7 @@ class File(Type): def isEmptyValue(self, value, obj=None): '''Must p_value be considered as empty?''' if not obj: return Type.isEmptyValue(self, value) - if value is not None: return False + if value: return False # If "nochange", the value must not be considered as empty return obj.REQUEST.get('%s_delete' % self.name) != 'nochange' @@ -1795,14 +1795,14 @@ class Ref(Type): # Get the needed referred objects i = res.startNumber # Is it possible and more efficient to perform a single query in - # uid_catalog and get the result in the order of specified uids? + # portal_catalog and get the result in the order of specified uids? while i < (res.startNumber + res.batchSize): if i >= res.totalNumber: break # Retrieve every reference in the correct format according to p_type if type == 'uids': ref = uids[i] else: - ref = obj.uid_catalog(UID=uids[i])[0].getObject() + ref = obj.portal_catalog(UID=uids[i])[0].getObject() if type == 'objects': ref = ref.appy() res.objects.append(ref) @@ -1859,7 +1859,7 @@ class Ref(Type): for i in range(len(refs)): if isinstance(refs[i], basestring): # Get the Zope object from the UID - refs[i] = obj.uid_catalog(UID=refs[i])[0].getObject() + refs[i] = obj.portal_catalog(UID=refs[i])[0].getObject() else: refs[i] = refs[i].o # Now we are sure to have a Zope object. # Update the field storing on p_obj the ordered list of UIDs diff --git a/gen/plone25/generator.py b/gen/plone25/generator.py index 1a82737..398e6c4 100644 --- a/gen/plone25/generator.py +++ b/gen/plone25/generator.py @@ -168,8 +168,6 @@ class Generator(AbstractGenerator): self.copyFile('ProfileInit.py', self.repls, destFolder='profiles', destName='__init__.py') self.copyFile('tool.gif', {}) - self.copyFile('Styles.css.dtml',self.repls, destFolder=self.skinsFolder, - destName = '%s.css.dtml' % self.applicationName) # Create version.txt f = open(os.path.join(self.outputFolder, 'version.txt'), 'w') f.write(self.version) @@ -352,14 +350,6 @@ class Generator(AbstractGenerator): for c in classes]) repls['allClassNames'] = ','.join(['"%s"' % c.name \ for c in classesButTool]) - # Compute classes whose instances must not be catalogued. - catalogMap = '' - blackClasses = [self.tool.name] - for blackClass in blackClasses: - catalogMap += "catalogMap['%s'] = {}\n" % blackClass - catalogMap += "catalogMap['%s']['black'] = " \ - "['portal_catalog']\n" % blackClass - repls['catalogMap'] = catalogMap # Compute the list of ordered attributes (forward and backward, # inherited included) for every Appy class. attributes = [] diff --git a/gen/plone25/installer.py b/gen/plone25/installer.py index 1bdd544..ae62069 100644 --- a/gen/plone25/installer.py +++ b/gen/plone25/installer.py @@ -30,7 +30,6 @@ class PloneInstaller: self.appClasses = cfg.appClasses self.appClassNames = cfg.appClassNames self.allClassNames = cfg.allClassNames - self.catalogMap = cfg.catalogMap self.applicationRoles = cfg.applicationRoles # Roles defined in the app self.defaultAddRoles = cfg.defaultAddRoles self.appFrontPage = cfg.appFrontPage @@ -197,20 +196,9 @@ class PloneInstaller: factoryTypes = self.allClassNames + factoryTool.getFactoryTypes().keys() factoryTool.manage_setPortalFactoryTypes(listOfTypeIds=factoryTypes) - # Configure CatalogMultiplex: tell what types will be catalogued or not. + # Whitelist tool in Archetypes, because now UID is in portal_catalog atTool = getattr(site, self.config.ARCHETYPETOOLNAME) - for meta_type in self.catalogMap: - submap = self.catalogMap[meta_type] - current_catalogs = Set( - [c.id for c in atTool.getCatalogsByType(meta_type)]) - if 'white' in submap: - for catalog in submap['white']: - current_catalogs.update([catalog]) - if 'black' in submap: - for catalog in submap['black']: - if catalog in current_catalogs: - current_catalogs.remove(catalog) - atTool.setCatalogsByType(meta_type, list(current_catalogs)) + atTool.setCatalogsByType(self.toolName, ['portal_catalog']) def updatePodTemplates(self): '''Creates or updates the POD templates in the tool according to pod @@ -259,7 +247,6 @@ class PloneInstaller: else: self.tool.createOrUpdate(True, None) self.updatePodTemplates() - self.tool.unindexObject() def installTranslations(self): '''Creates or updates the translation objects within the tool.''' @@ -336,7 +323,7 @@ class PloneInstaller: corresponding index if it does not exist yet.''' # Create a special index for object state, that does not correspond to # a field. - indexInfo = {'getState': 'FieldIndex'} + indexInfo = {'getState': 'FieldIndex', 'UID': 'FieldIndex'} for className in self.attributes.iterkeys(): wrapperClass = self.tool.getAppyClass(className, wrapper=True) for appyType in wrapperClass.__fields__: diff --git a/gen/plone25/mixins/ToolMixin.py b/gen/plone25/mixins/ToolMixin.py index cf2eefe..b79816a 100644 --- a/gen/plone25/mixins/ToolMixin.py +++ b/gen/plone25/mixins/ToolMixin.py @@ -87,7 +87,7 @@ class ToolMixin(BaseMixin): if appyType.name == 'title': continue # Will be included by default. res.append((appyType.name, self.translate(appyType.labelId))) # Add object state - res.append(('workflowState', self.translate('workflow_state'))) + res.append(('state', self.translate('workflow_state'))) return res def _appy_getSearchableFields(self, contentType): @@ -108,7 +108,8 @@ class ToolMixin(BaseMixin): fieldDicts = [] if refInfo: # The search is triggered from a Ref field. - refField = self.getRefInfo(refInfo)[1] + refObject, fieldName = self.getRefInfo(refInfo) + refField = refObject.getAppyType(fieldName) fieldNames = refField.queryFields or () nbOfColumns = refField.queryNbCols else: @@ -172,7 +173,7 @@ class ToolMixin(BaseMixin): def getObject(self, uid, appy=False): '''Allows to retrieve an object from its p_uid.''' - res = self.uid_catalog(UID=uid) + res = self.portal_catalog(UID=uid) if res: res = res[0].getObject() if appy: @@ -183,10 +184,10 @@ class ToolMixin(BaseMixin): search=None, remember=False, brainsOnly=False, maxResults=None, noSecurity=False, sortBy=None, sortOrder='asc', filterKey=None, filterValue=None, - refField=None): + refObject=None, refField=None): '''Executes a query on a given p_contentType (or several, separated - with commas) in Plone's portal_catalog. If p_searchName is specified, - it corresponds to: + with commas) in portal_catalog. If p_searchName is specified, it + corresponds to: 1) a search defined on p_contentType: additional search criteria will be added to the query, or; 2) "_advanced": in this case, additional search criteria will also @@ -221,8 +222,8 @@ class ToolMixin(BaseMixin): to take into account: the corresponding search value is in p_filterValue. - If p_refField is given, the query is limited to the objects that are - referenced through it.''' + If p_refObject and p_refField are given, the query is limited to the + objects that are referenced from p_refObject through p_refField.''' # Is there one or several content types ? if contentType.find(',') != -1: portalTypes = contentType.split(',') @@ -267,6 +268,9 @@ class ToolMixin(BaseMixin): # TODO This value needs to be merged with an existing one if already # in params, or, in a first step, we should avoid to display the # corresponding filter widget on the screen. + if refObject: + refField = refObject.getAppyType(refField) + params['UID'] = refObject._appy_getSortedField(refField.name).data # Determine what method to call on the portal catalog if noSecurity: catalogMethod = 'unrestrictedSearchResults' else: catalogMethod = 'searchResults' @@ -297,12 +301,14 @@ class ToolMixin(BaseMixin): self.REQUEST.SESSION['search_%s' % searchName] = uids return res.__dict__ - def getResultColumnsNames(self, contentType, refField): + def getResultColumnsNames(self, contentType, refInfo): contentTypes = contentType.strip(',').split(',') resSet = None # Temporary set for computing intersections. res = [] # Final, sorted result. fieldNames = None appyTool = self.appy() + refField = None + if refInfo[0]: refField = refInfo[0].getAppyType(refInfo[1]) for cType in contentTypes: if refField: fieldNames = refField.shownInfo @@ -432,7 +438,7 @@ class ToolMixin(BaseMixin): def isSortable(self, name, className, usage): '''Is field p_name defined on p_className sortable for p_usage purposes (p_usage can be "ref" or "search")?''' - if (',' in className) or (name == 'workflowState'): return False + if (',' in className) or (name == 'state'): return False appyType = self.getAppyType(name, className=className) if appyType: return appyType.isSortable(usage=usage) @@ -567,9 +573,10 @@ class ToolMixin(BaseMixin): if not refInfo and (self.REQUEST.get('search', None) == '_advanced'): criteria = self.REQUEST.SESSION.get('searchCriteria', None) if criteria and criteria.has_key('_ref'): refInfo = criteria['_ref'] - if not refInfo: return ('', None) - sourceContentType, refField = refInfo.split(':') - return refInfo, self.getAppyType(refField, className=sourceContentType) + if not refInfo: return (None, None) + objectUid, fieldName = refInfo.split(':') + obj = self.getObject(objectUid) + return obj, fieldName def getSearches(self, contentType): '''Returns the list of searches that are defined for p_contentType. @@ -663,7 +670,7 @@ class ToolMixin(BaseMixin): res['backText'] = self.translate(label) else: fieldName, pageName = d2.split(':') - sourceObj = self.uid_catalog(UID=d1)[0].getObject() + sourceObj = self.portal_catalog(UID=d1)[0].getObject() label = '%s_%s' % (sourceObj.meta_type, fieldName) res['backText'] = '%s : %s' % (sourceObj.Title(), self.translate(label)) @@ -739,7 +746,7 @@ class ToolMixin(BaseMixin): except KeyError: pass except IndexError: pass if uid: - brain = self.uid_catalog(UID=uid) + brain = self.portal_catalog(UID=uid) if brain: sibling = brain[0].getObject() res[urlKey] = sibling.getUrl(nav=newNav % (index + 1), @@ -860,4 +867,15 @@ class ToolMixin(BaseMixin): if ',' in contentType: return () return [f.__dict__ for f in self.getAllAppyTypes(contentType) \ if (f.type == 'Pod') and (f.show == 'result')] + + def getUserLine(self, user): + '''Returns a one-line user info as shown on every page.''' + res = [user.getId()] + name = user.getProperty('fullname') + if name: res.insert(0, name) + rolesToShow = [r for r in user.getRoles() \ + if r not in ('Authenticated', 'Member')] + if rolesToShow: + res.append(', '.join([self.translate(r) for r in rolesToShow])) + return ' | '.join(res) # ------------------------------------------------------------------------------ diff --git a/gen/plone25/mixins/__init__.py b/gen/plone25/mixins/__init__.py index 9fca152..1800ed6 100644 --- a/gen/plone25/mixins/__init__.py +++ b/gen/plone25/mixins/__init__.py @@ -37,8 +37,8 @@ class BaseMixin: rq = self.REQUEST obj = self if created: - obj = self.portal_factory.doCreate(self, self.id) # portal_factory - # creates the final object from the temp object. + # portal_factory creates the final object from the temp object. + obj = self.portal_factory.doCreate(self, self.id) previousData = None if not created: previousData = self.rememberPreviousData() # Perform the change on the object, unless self is a tool being created. @@ -61,7 +61,7 @@ class BaseMixin: # Get the initiator splitted = rq['nav'].split('.') if splitted[0] == 'search': return # Not an initiator but a search. - initiator = self.uid_catalog(UID=splitted[1])[0].getObject() + initiator = self.getTool().getObject(splitted[1]) fieldName = splitted[2].split(':')[0] initiator.appy().link(fieldName, obj) @@ -174,20 +174,24 @@ class BaseMixin: errorMessage = self.translate( 'Please correct the indicated errors.', domain='plone') isNew = rq.get('is_new') == 'True' - # Go back to the consult view if the user clicked on 'Cancel' + # If this object is created from an initiator, get info about him. + initiator = None + initiatorPage = None + if rq.get('nav', '').startswith('ref.'): + splitted = rq['nav'].split('.') + initiator = tool.getObject(splitted[1]) + initiatorPage = splitted[2].split(':')[1] + # If the user clicked on 'Cancel', go back to the previous page. if rq.get('buttonCancel.x', None): - if isNew: - if rq.get('nav', ''): - # We can go back to the initiator page. - splitted = rq['nav'].split('.') - initiator = tool.getObject(splitted[1]) - initiatorPage = splitted[2].split(':')[1] - urlBack = initiator.getUrl(page=initiatorPage, nav='') - else: - # Go back to the root of the site. - urlBack = tool.getSiteUrl() + if initiator: + # Go back to the initiator page. + urlBack = initiator.getUrl(page=initiatorPage, nav='') else: - urlBack = self.getUrl() + if isNew: + # Go back to the root of the site. + urlBack = tool.getSiteUrl() + else: + urlBack = self.getUrl() self.say(self.translate('Changes canceled.', domain='plone')) return self.goto(urlBack) @@ -236,9 +240,11 @@ class BaseMixin: if not obj.allows('View'): return self.goto(tool.getSiteUrl(), msg) if rq.get('buttonOk.x', None) or saveConfirmed: - # Go to the consult view for this object obj.say(msg) - return self.goto(obj.getUrl()) + if isNew and initiator: + return self.goto(initiator.getUrl(page=initiatorPage, nav='')) + else: + return self.goto(obj.getUrl()) if rq.get('buttonPrevious.x', None): # Go to the previous page for this object. # We recompute the list of phases and pages because things diff --git a/gen/plone25/skin/appy.css b/gen/plone25/skin/appy.css index 82755d4..440e004 100644 --- a/gen/plone25/skin/appy.css +++ b/gen/plone25/skin/appy.css @@ -8,12 +8,17 @@ table { font-size: 100%; border-spacing: 0px; border-collapse:collapse;} form { margin: 0; padding: 0;} p { margin: 0;} acronym {cursor: help;} -input { border: 1px solid #a79e9e; - font-family: Lucida,Helvetica,Arial,sans-serif; } +input { border: 1px solid #a79e9e; background-color: #f8f8f8; + font-family: Lucida,Helvetica,Arial,sans-serif; margin-bottom: 1px} input[type=image] { border-width: 0px; background: none; } textarea { width: 99%; font: 100% Lucida,Helvetica,Arial,sans-serif; - border: 1px solid #a79e9e;} + border: 1px solid #a79e9e; background-color: #f8f8f8;} label { font-weight: 600; font-style: italic; line-height: 1.4em;} +legend { padding-bottom: 2px; padding-right: 3px;} +ul { line-height: 1.2em; margin: 0 0 0.2em 0.6em; padding: 0; + list-style: none outside none;} +li { margin: 0; background-image: url("skyn/li.gif"); padding-left: 10px; + background-repeat: no-repeat; background-position: 0 0.5em;} .main { width: 900px; background-color: white; box-shadow: 3px 3px 3px #A9A9A9; border-style: solid; border-width: 1px; border-color: grey; } @@ -22,7 +27,7 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;} .userStrip { background-color: #a2a2a2; height: 30px; border-top: 3px solid #525252; border-bottom: 2px solid #9b0000; } .login { margin-top: 2px; margin-bottom: 2px; color: white;} -.buttons { margin-left: 4px; } +.buttons { margin-left: 4px;} .message { color: #9b0000; font-style: italic; position: absolute; top: -15px; right: 5px} .discreet { font-size: 90%; } @@ -41,7 +46,7 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;} border: 1px solid grey; } .list { border: 1px solid grey; margin-bottom: 3px;} .list td, .list th { border: 1px solid grey; - padding-left: 3px; padding-right: 3px;} + padding-left: 5px; padding-right: 5px; padding-top: 3px;} .list th { background-color: #cbcbcb; font-style: italic; font-weight: normal;} .noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important; } .noStyle td { border:0 !important; padding:0 !important; margin:0 !important; } @@ -62,3 +67,4 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;} .by { background-color: #ededed; font-style: italic; padding-top: 3px;} .workflow { background-color: #ededed; text-align: center;} .objectNavigate { margin-top: 3px;} +.underline {border-bottom: 1px dotted grey;} diff --git a/gen/plone25/skin/appy.js b/gen/plone25/skin/appy.js index e9862ec..8d4dea3 100644 --- a/gen/plone25/skin/appy.js +++ b/gen/plone25/skin/appy.js @@ -232,6 +232,42 @@ function updateSlaves(masterValues, appyTypeId) { } } +function initSlaves() { + // When the current page is loaded, we must set the correct state for all + // slave fields. + var masters = cssQuery('.appyMaster'); + for (var i=0; i < masters.length; i++) { + var cssClasses = masters[i].className.split(' '); + for (var j=0; j < cssClasses.length; j++) { + if (cssClasses[j].indexOf('master_') == 0) { + var appyId = cssClasses[j].split('_')[1]; + var masterValue = []; + if (masters[i].nodeName == 'SPAN'){ + var idField = masters[i].id; + if (idField == '') { + masterValue.push(idField); + } + else { + if ((idField[0] == '(') || (idField[0] == '[')) { + // There are multiple values, split it + var subValues = idField.substring(1, idField.length-1).split(','); + for (var k=0; k < subValues.length; k++){ + var subValue = subValues[k].replace(' ',''); + masterValue.push(subValue.substring(1, subValue.length-1)); + } + } + else { masterValue.push(masters[i].id); + } + } + } + else { masterValue = getMasterValue(masters[i]); + } + updateSlaves(masterValue, appyId); + } + } + } +} + // Function used for triggering a workflow transition function triggerTransition(transitionId, msg) { var theForm = document.getElementById('triggerTransitionForm'); diff --git a/gen/plone25/skin/do.py b/gen/plone25/skin/do.py index b9320db..aeedc84 100644 --- a/gen/plone25/skin/do.py +++ b/gen/plone25/skin/do.py @@ -5,7 +5,7 @@ rq = context.REQUEST # Get the object impacted by the action. if rq.get('objectUid', None): - obj = context.uid_catalog(UID=rq['objectUid'])[0].getObject() + obj = context.portal_catalog(UID=rq['objectUid'])[0].getObject() else: obj = context.getParentNode() # An appy obj or in some cases the app folder. if obj.portal_type == 'AppyFolder': diff --git a/gen/plone25/skin/edit.pt b/gen/plone25/skin/edit.pt index 5a1e618..624f0fc 100644 --- a/gen/plone25/skin/edit.pt +++ b/gen/plone25/skin/edit.pt @@ -1,7 +1,7 @@ - - The page footer. - +The page footer. diff --git a/gen/plone25/skin/result.pt b/gen/plone25/skin/result.pt index 1919f2d..3896f93 100644 --- a/gen/plone25/skin/result.pt +++ b/gen/plone25/skin/result.pt @@ -1,8 +1,9 @@ + newSearchUrl python: '%s/skyn/search?type_name=%s%s' % (tool.absolute_url(), contentType, refUrlPart)"> @@ -29,7 +30,7 @@ () -   —   @@ -60,7 +61,7 @@ - Headers, with filters and sort arrows diff --git a/gen/plone25/skin/sortAsc.png b/gen/plone25/skin/sortAsc.png index 3ca5687..02486f9 100644 Binary files a/gen/plone25/skin/sortAsc.png and b/gen/plone25/skin/sortAsc.png differ diff --git a/gen/plone25/skin/template.pt b/gen/plone25/skin/template.pt index 68d90ba..ab584ef 100644 --- a/gen/plone25/skin/template.pt +++ b/gen/plone25/skin/template.pt @@ -110,7 +110,7 @@
User info and controls for authenticated users - +
+
@@ -128,6 +128,7 @@
diff --git a/gen/plone25/skin/widgets/file.pt b/gen/plone25/skin/widgets/file.pt index 19ef3bd..ee9fae3 100644 --- a/gen/plone25/skin/widgets/file.pt +++ b/gen/plone25/skin/widgets/file.pt @@ -19,7 +19,7 @@ Edit macro for an File. -
+
Keep the file untouched. @@ -29,8 +29,7 @@ id string:${name}_nochange; onclick string:document.getElementById('${name}_file').disabled=true;"/> + i18n:translate="nochange_file" i18n:domain="plone">Keep the file unchanged
Delete the file. @@ -39,8 +38,7 @@ id string:${name}_delete; onclick string:document.getElementById('${name}_file').disabled=true;"/> + i18n:translate="delete_file" i18n:domain="plone">Delete the file
Replace with a new file. @@ -50,8 +48,7 @@ id string:${name}_upload; onclick string:document.getElementById('${name}_file').disabled=false"/> + i18n:translate="upload_file" i18n:domain="plone">Replace it with a new file
The upload field. @@ -66,7 +63,7 @@ Cell macro for an File. - + Search macro for an File. diff --git a/gen/plone25/skin/widgets/ref.pt b/gen/plone25/skin/widgets/ref.pt index 08dc54c..f7adf4d 100644 --- a/gen/plone25/skin/widgets/ref.pt +++ b/gen/plone25/skin/widgets/ref.pt @@ -161,7 +161,7 @@ The search icon if field is queryable + tal:attributes="href python: '%s/skyn/search?type_name=%s&ref=%s:%s' % (tool.absolute_url(), linkedPortalType, contextObj.UID(), appyType['name'])"> diff --git a/gen/plone25/skin/widgets/string.pt b/gen/plone25/skin/widgets/string.pt index e0949e1..71ffb63 100644 --- a/gen/plone25/skin/widgets/string.pt +++ b/gen/plone25/skin/widgets/string.pt @@ -3,8 +3,8 @@ tal:define="fmt widget/format"> -
    -
  • +
      +
    diff --git a/gen/plone25/templates/Styles.css.dtml b/gen/plone25/templates/Styles.css.dtml index 64507fc..f424561 100644 --- a/gen/plone25/templates/Styles.css.dtml +++ b/gen/plone25/templates/Styles.css.dtml @@ -1,19 +1,7 @@ -textarea { width: 99%; } - #importedElem { color: grey; font-style: italic; } -label { font-weight: bold; font-style: italic; line-height: 1.4em; font-size: 92%;} -.appyList { line-height: 1.1em; margin: 0 0 0.5em 1.2em; padding: 0; } -.appyBullet { margin: 0; } .appyPod { float:right; } .appyFocus { color: #900101; } -.appyPlusImg { - vertical-align: top; - position: relative; - left: -1.4em; - top: -0.55em; -} - .appyState { font-size: 85%; font-style: normal; @@ -91,38 +79,6 @@ fieldset { padding: 3px 4px 3px 12px; } -.listing { margin: 0em 0em; } -.listing td, .stx table td { - padding : 0.1em 0.3em 0.1em 0.3em; - border-top : 1px solid #8CACBB; -} -.listing th, .stx table th { padding: 0.25em 0.3em; } -.vertical td { padding-left: 0.3em; } - -.innerAppyTable { - border-width: 0px; -} - -.innerAppyTable td { - border-top: 0px; - border-bottom: 1px solid #8CACBB; - border-right: 0px; - padding: 0.4em 0em 0em 0em; - border-collapse: separate; -} - -.innerAppyTable th { - border-right: 0px; -} - -.innerAppyFieldset { - margin: 0em 1em; - line-height: 1.0em; -} - -.field { - margin: 0 0.2em 0.2em 0; -} /* Portlet elements */ .portletHeader { text-transform: none; @@ -149,5 +105,3 @@ fieldset { float:right; margin:0.5em; } - - diff --git a/gen/plone25/templates/config.py b/gen/plone25/templates/config.py index 93ce0b9..8971fb1 100644 --- a/gen/plone25/templates/config.py +++ b/gen/plone25/templates/config.py @@ -52,9 +52,6 @@ rootClasses = [] appClasses = [] appClassNames = [] allClassNames = [] -# List of classes that must be hidden from the catalog -catalogMap = {} - # In the following dict, we store, for every Appy class, the ordered list of # appy types (included inherited ones). diff --git a/gen/plone25/wrappers/ToolWrapper.py b/gen/plone25/wrappers/ToolWrapper.py index 49e2d95..e0ffa1b 100644 --- a/gen/plone25/wrappers/ToolWrapper.py +++ b/gen/plone25/wrappers/ToolWrapper.py @@ -42,7 +42,7 @@ class ToolWrapper(AbstractWrapper): rq = self.o.REQUEST if rq.get('nav', ''): initiatorUid = rq['nav'].split('.')[1] - res = self.o.uid_catalog(UID=initiatorUid)[0].getObject().appy() + res = self.o.portal_catalog(UID=initiatorUid)[0].getObject().appy() return res def getObject(self, uid): diff --git a/gen/plone25/wrappers/__init__.py b/gen/plone25/wrappers/__init__.py index 59ffa14..86732da 100644 --- a/gen/plone25/wrappers/__init__.py +++ b/gen/plone25/wrappers/__init__.py @@ -139,7 +139,7 @@ class AbstractWrapper(object): to a given p_sortKey which must be an attribute set on referred objects ("title", by default).''' sortedUids = getattr(self.o, '_appy_%s' % fieldName) - c = self.o.uid_catalog + c = self.o.portal_catalog sortedUids.sort(lambda x,y: \ cmp(getattr(c(UID=x)[0].getObject().appy(), sortKey), getattr(c(UID=y)[0].getObject().appy(), sortKey))) diff --git a/pod/doc_importers.py b/pod/doc_importers.py index 4e366ab..8f9a0d6 100644 --- a/pod/doc_importers.py +++ b/pod/doc_importers.py @@ -64,7 +64,7 @@ class DocImporter: fileContent = self.content.read() else: fileContent = self.content - f = file(self.importPath, 'w') + f = file(self.importPath, 'wb') f.write(fileContent) f.close() @@ -181,7 +181,9 @@ class ImageImporter(DocImporter): externally.''' anchorTypes = ('page', 'paragraph', 'char', 'as-char') WRONG_ANCHOR = 'Wrong anchor. Valid values for anchors are: %s.' - def getImportFolder(self): return '%s/unzip/Pictures' % self.tempFolder + pictFolder = '%sPictures%s' % (os.sep, os.sep) + def getImportFolder(self): + return os.path.join(self.tempFolder, 'unzip', 'Pictures') def moveFile(self, at, importPath): '''Copies file at p_at into the ODT file at p_importPath.''' @@ -189,7 +191,7 @@ class ImageImporter(DocImporter): for imagePath, imageAt in self.fileNames.iteritems(): if imageAt == at: # Yes! - i = importPath.rfind('/Pictures/') + 1 + i = importPath.rfind(self.pictFolder) + 1 return importPath[:i] + imagePath # If I am here, the image has not already been imported: copy it. shutil.copy(at, importPath) @@ -208,8 +210,8 @@ class ImageImporter(DocImporter): s = self.svgNs imageName = 'Image%f' % time.time() # Compute path to image - i = self.importPath.rfind('/Pictures/') - imagePath = self.importPath[i+1:] + i = self.importPath.rfind(self.pictFolder) + imagePath = self.importPath[i+1:].replace('\\', '/') self.fileNames[imagePath] = self.at # Compute image size width, height = getSize(self.importPath, self.format)