Changeset 1359

Show
Ignore:
Timestamp:
08/15/08 19:39:52 (3 months ago)
Author:
sgillies
Message:

Get with change to features and place relationship

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pleiades.workspace/trunk/pleiades/workspace/browser/kml.py

    r1355 r1359  
    1 #from Acquisition import aq_inner 
    21import transaction 
    32from Products.Five.browser import BrowserView 
     
    2120 
    2221        places = portal['places'] 
     22        features = portal['features'] 
    2323        names = portal['names'] 
    2424        locations = portal['locations'] 
     
    4040                nid = names.invokeFactory( 
    4141                        'Name', 
    42                         id=ptool.normalizeString(name), 
    4342                        title=name.encode('utf-8') 
    4443                        ) 
    4544                pid = places.invokeFactory( 
    4645                        'Place', 
    47                         id=ptool.normalizeString(name), 
    4846                        title=name.encode('utf-8') 
    4947                        ) 
    50                 place = places[pid] 
    51                 aid = place.invokeFactory( 
    52                         'PlacefulAssociation', 
    53                         id=nid 
     48                fid = features.invokeFactory( 
     49                        'Feature', 
    5450                        ) 
    55                 a = place[aid] 
    56                 a.addReference(names[nid], 'hasName') 
    57                 a.addReference(locations[lid], 'hasLocation') 
     51                f = features[fid] 
     52                f.addReference(names[nid], 'hasName') 
     53                f.addReference(locations[lid], 'hasLocation') 
     54                p = places[pid] 
     55                p.addReference(f, 'hasFeature') 
    5856 
    5957                # Attach to workspace 
    6058                IResource(names[nid]).attach(self.context) 
    6159                IResource(locations[lid]).attach(self.context) 
    62                 IResource(places[pid]).attach(self.context) 
     60                IResource(f).attach(self.context) 
     61                IResource(p).attach(self.context) 
    6362                 
    6463        except: 
  • pleiades.workspace/trunk/pleiades/workspace/browser/xml.py

    r1355 r1359  
    2121        portal = getToolByName(self.context, 'portal_url').getPortalObject() 
    2222        places = portal['places'] 
     23        features = portal['features'] 
    2324        names = portal['names'] 
    2425        locations = portal['locations'] 
     
    3233                for lid in result['location_ids']: 
    3334                    IResource(locations[lid]).attach(self.context) 
     35                for fid in result['feature_ids']: 
     36                    IResource(features[fid]).attach(self.context) 
    3437                IResource(places[result['place_id']]).attach(self.context) 
    3538                count += 1 
  • pleiades.workspace/trunk/pleiades/workspace/configure.zcml

    r1355 r1359  
    2020    factory=".resource.Resource" 
    2121    for="Products.PleiadesEntity.content.Name.Name" 
     22    trusted="true" 
     23    /> 
     24 
     25  <adapter 
     26    factory=".resource.Resource" 
     27    for="Products.PleiadesEntity.content.Feature.Feature" 
    2228    trusted="true" 
    2329    /> 
  • pleiades.workspace/trunk/pleiades/workspace/content/workspace.py

    r1355 r1359  
    9595        tid = self.invokeFactory('Topic', id='names', title='Names') 
    9696        self.initTopic(tid, 'Name') 
     97        tid = self.invokeFactory('Topic', id='features', title='Features') 
     98        self.initTopic(tid, 'Feature') 
    9799        tid = self.invokeFactory('Topic', id='places', title='Places') 
    98100        self.initTopic(tid, 'Place') 
  • pleiades.workspace/trunk/pleiades/workspace/tests/base.py

    r1355 r1359  
    6363        try: 
    6464            test.setRoles(('Manager', 'Contributor')) 
    65             test.portal.invokeFactory('Large Plone Folder', id='names') 
     65            test.portal.invokeFactory('NameContainer', id='names') 
    6666            test.portal.invokeFactory('LocationContainer', id='locations') 
     67            test.portal.invokeFactory('FeatureContainer', id='features') 
    6768            test.portal.invokeFactory('PlaceContainer', id='places') 
    6869        except: 
  • pleiades.workspace/trunk/pleiades/workspace/tests/factory.txt

    r1355 r1359  
    2121    >>> 'places' in ws.objectIds() 
    2222    True 
     23    >>> 'features' in ws.objectIds() 
     24    True 
    2325    >>> 'locations' in ws.objectIds() 
    2426    True 
  • pleiades.workspace/trunk/pleiades/workspace/tests/kml-import.txt

    r1355 r1359  
    1414    >>> ws = folder[wsid] 
    1515    >>> 'places' in ws.objectIds() 
     16    True 
     17    >>> 'features' in ws.objectIds() 
    1618    True 
    1719    >>> 'locations' in ws.objectIds() 
     
    6163Verify import 
    6264 
    63     >>> 'apollonia-sozousa-portus-cyrenorum' in [o.id for o in ws['names'].queryCatalog()] 
     65    >>> 'Apollonia/Sozousa/Portus Cyrenorum' in [o.Title for o in ws['names'].queryCatalog()] 
    6466    True 
    65     >>> 'ptolemais-barkes-limen' in [o.id for o in ws['names'].queryCatalog()] 
     67    >>> 'Ptolemais/Barkes Limen' in [o.Title for o in ws['features'].queryCatalog()] 
    6668    True 
    6769    >>> len(list(ws['locations'].queryCatalog())) 
  • pleiades.workspace/trunk/pleiades/workspace/tests/xml-import.txt

    r1355 r1359  
    1414    >>> ws = folder[wsid] 
    1515    >>> 'places' in ws.objectIds() 
     16    True 
     17    >>> 'features' in ws.objectIds() 
    1618    True 
    1719    >>> 'locations' in ws.objectIds() 
     
    6466    >>> len(list(ws['places'].queryCatalog())) 
    6567    315 
    66     >>> 'aloanda' in [o.id for o in ws['names'].queryCatalog()] 
     68    >>> 'Aloanda' in [o.Title for o in ws['names'].queryCatalog()] 
    6769    True