[Zope-dev] Question about import code

Fred Wilson Horch fhorch@ecoaccess.org
Thu, 10 May 2001 13:02:46 -0400


Hi Shane,

You wrote:
> 
> Importing multiple objects simultaneously could result in a fair amount
> of confusion...

Can you elaborate?  When you import a folder, for example, it imports
the folder and all objects in it.

Why is it any different to import two unrelated objects?

Would it be better to do this in two separate transactions?  Or two
subtransactions?

> But if you really think it's a good idea, if you used a list called
> return_oids instead, and appended to this list in the code above, you'd
> probably get what you're looking for.

I tried this approach, too, and I get a ConflictError.  (I can send the
code and traceback if you're interested.)

> Note that for Zope 2.4 this code has changed a bit.  Import is now done
> as a subtransaction rather than a transaction "on the side".

Thanks for the heads up.  When you say "subtransaction", a
subtransaction of what?  I'm familiar with subtransactions being atomic
parts of a larger transaction.  I'm not sure what this larger
transaction would be in this case.  If I start an import, does that
start a transaction with each object's import being a subtransaction of
the whole thing?  (If that's the case, then I don't understand why
importing several objects at once would be confusing.)

Is there any documentation on how to export from and import to the ZODB?

The code I'm wading through has a lot of extraneous stuff thrown in. 
I'd like to be able to just try exporting and importing objects from a
simple Python script so I understand what's going on.

Thanks,
Fred
-- 
Fred Wilson Horch			mailto:fhorch@ecoaccess.org
Executive Director, EcoAccess		http://ecoaccess.org/
P.O. Box 2823, Durham, NC 27715-2823	phone: 919.419-8567