Example #1
0
 def __geo_interface__(self):
     info = super(ProjectGeoItem, self).__geo_interface__
     project = self.context
     properties = {
         # According to PleiadesGeocoder.browser.info comments,
         # OpenLayers can't handle an empty descr or title.
         'description': info['properties']['description'] or 'No description',
         'title': info['properties']['title'] or 'No title',
         'updated': utils.iso8601(project.ModificationDate()),
         'created': utils.iso8601(project.CreationDate()),
         }
     info['properties'].update(properties)
     return info
Example #2
0
 def _published_from_as_iso8601(self):
     return u'%04d-%02d-%02dT%02d:%02d:%02d%s' % (
         self.published_from.year,
         self.published_from.month,
         self.published_from.day,
         self.published_from.hour,
         self.published_from.minute,
         self.published_from.second,
         iso8601(self.published_from),
     )
Example #3
0
 def __geo_interface__(self):
     # Kinda guessing what info we want for members.
     member = self.context
     member_id = member.getId()
     # there's surely a better way to get this url.
     portal_url = getToolByName(member, 'portal_url')()
     home_url = '%s/%s' % (portal_url, member_path(member_id))
     properties = {
         'language': member.getProperty('language'),
         'location': member.getProperty('location'),
         # According to PleiadesGeocoder.browser.info comments,
         # OpenLayers can't handle an empty descr or title.
         'description': member.getProperty('description') or 'No description',
         'title': member.getProperty('fullname') or 'No title',
         'link': home_url,
         'updated': utils.iso8601(member.ModificationDate()),
         'created': utils.iso8601(member.CreationDate()),
         }
     
     return {
         'id': member_id,
         'properties': properties,
         'geometry': {'type': self.geom_type, 'coordinates': self.coords}
         }
Example #4
0
 def root_attributes(self):
     '''*internal*: returns the attributes to be written to the root element as a dict'''
     header0 = self.spec.headers[0]
     dd = dict(
         spec2nexus_version = spec2nexus.__version__,
         SPEC_file = self.spec.specFile,
         SPEC_epoch = header0.epoch,
         SPEC_date = utils.iso8601(header0.date),
         SPEC_comments = '\n'.join(header0.comments),
         SPEC_num_headers = len(self.spec.headers),
         h5py_version = h5py.__version__,
         HDF5_Version = h5py.version.hdf5_version,
         numpy_version = h5py.version.numpy.version.full_version,
         )
     try:
         c = header0.comments[0]
         user = c[c.find('User = '******'=')[1].strip()
         dd['SPEC_user'] = user
     except:
         pass
     return dd
Example #5
0
 def root_attributes(self):
     '''*internal*: returns the attributes to be written to the root element as a dict'''
     header0 = self.spec.headers[0]
     dd = dict(
         spec2nexus_version=spec2nexus.__version__,
         SPEC_file=self.spec.specFile,
         SPEC_epoch=header0.epoch,
         SPEC_date=utils.iso8601(header0.date),
         SPEC_comments='\n'.join(header0.comments),
         SPEC_num_headers=len(self.spec.headers),
         h5py_version=h5py.__version__,
         HDF5_Version=h5py.version.hdf5_version,
         numpy_version=h5py.version.numpy.version.full_version,
     )
     try:
         c = header0.comments[0]
         user = c[c.find('User = '******'=')[1].strip()
         dd['SPEC_user'] = user
     except:
         pass
     return dd