dear zope gurus,

i hope, this is the right place to post this:

i'm trying to modify a modified ZSyncer product.
The first modification implements bidirectional syncronisation.
It simply exports any Zope object, transmitts it via XML-RPC and imports it 
remotely, or vice versa.
The problem i'm trying to fix is that synced objects should have synced 
timestamps and not the original one vs. the importation time.

My solution is to *ship* the modification time of the original object 
together with the object, but i don't know how to explicitly change the 
timestamp of the freshly imported one.

the essential part of the code is the following method, which imports the 
object -- it gets the object data, the path of the object and its 
modification time (see "# change modification time"):

    def manage_addXMLRPC(self, data, obj_path, mod_time=0, add_in=1):
        """ Adds / imports an object """
        # make sure we always get a string or a list
        if type(obj_path) == type('string'): obj_path = 
string.split(obj_path, '/')

        # object lets try finding the parent
        try: parent = self.restrictedTraverse(obj_path[:-1])
        except KeyError: return 404

        # lets check they are allowed to do this
        c = getSecurityManager().checkPermission
        allowed = 1
        for perm in ['Delete objects', 'Import/Export objects']:
            if not c(perm, parent): allowed = 0
        if not allowed: return 403

        # if there is one there already, delete it
        if obj_path[-1] in parent.objectIds():

        # lets do it
        if add_in:
            # fake a file using StringIO
            file = StringIO()

            # now import
            new = parent._p_jar.importFile(file)
            parent._setObject(new.getId(), new)

            # change modification time
            my_obj = self.restrictedTraverse(obj_path)
            my_obj._p_mtime = mod_time

        # yay!
        return 200

i tryed to change the modification time via the _p_mtime attribute (because 
bobobase_modification_time() returns it normally), but it doesn't work.
I played around with it but there was no enlightenment.

i guess its a secret of the ZODB.

please help me to get on the right path.

yours faithfully.

Andreas Hoelzl

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to