Changeset 4175


Ignore:
Timestamp:
27 May 2009, 08:19:00 (16 years ago)
Author:
uli
Message:
  • Unpack ZODB oids to make them printable
  • In CSV import viewlet set receiverid as importer attribute
File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/datacenter.py

    r4173 r4175  
    66import os
    77import shutil
     8import struct
    89import sys
    910import grok
     
    136137        this case we can use the memory address of it.
    137138        """
    138         if hasattr(obj, '_p_oid'):
    139             return getattr(obj, '_p_oid')
    140         return str(id(obj))
     139        if not hasattr(obj, '_p_oid'):
     140            return str(id(obj))
     141        oid = getattr(obj, '_p_oid')
     142        return str(struct.unpack('>Q', oid)[0])
    141143
    142144       
     
    249251    def __init__(self, filedescr, importers):
    250252        self.file = filedescr
    251         self.importers = importers
     253        self.importers = []
     254        for importer, receiverid in importers:
     255            importer.receiverid = receiverid
     256            self.importers.append(importer)
    252257       
    253258class ImportCSVMain(grok.Viewlet):
Note: See TracChangeset for help on using the changeset viewer.