================================================================================
                 Naaya Photo Archive - Content management
================================================================================
--------------------------------------------------------------------------------
     Apply some contant management action to naaya photo archive objects
--------------------------------------------------------------------------------

As any Naaya content-type Naaya photo archive objects supports to be added,
edited, deleted, copied/cutted/pasted.

Let's add an album

    >>> self.login()
    >>> info = self.portal.info
    >>> gallery_id = info.manage_addNyPhotoGallery(id='mygallery', title='My Gallery')
    >>> gallery = info[gallery_id]
    >>> album_id = gallery.addNyPhotoFolder(id='myalbum', title='My Album')
    >>> album = gallery[album_id]

Now we'll do some cut/copy/paste on our album

    >>> cp = gallery.copyObjects(ids=[album_id])
    >>> res = gallery.pasteObjects(cp_data=cp)
    >>> gallery.objectIds()
    ['myalbum', 'copy_of_myalbum']

Was it indexed in portal catalog ?

    >>> ctool = self.portal.portal_catalog
    >>> brains = ctool(title='My Album')
    >>> [brain.getObject().getId() for brain in brains]
    ['myalbum', 'copy_of_myalbum']

Let's cut an album

    >>> gallery_id = info.manage_addNyPhotoGallery(id='new_gallery', title='New Gallery')
    >>> new_gallery = info[gallery_id]
    >>> cp = gallery.cutObjects(ids=['copy_of_myalbum'])
    >>> res = new_gallery.pasteObjects(cp_data=cp)
    >>> brains = ctool(title='My Album')
    >>> sorted([brain.getObject().absolute_url(1) for brain in brains])
    ['portal/info/mygallery/myalbum', 'portal/info/new_gallery/copy_of_myalbum']

Now delete the gallery and album

    >>> new_gallery.deleteObjects(ids=['copy_of_myalbum'])
    >>> new_gallery.objectIds()
    []
    >>> info.deleteObjects(id=['new_gallery'])
    >>> 'new_gallery' in info.objectIds()
    False
    >>> brains = ctool(title='New Gallery')
    >>> [brain for brain in brains]
    []
    >>> brains = ctool(title='My Album')
    >>> [brain.getObject().absolute_url(1) for brain in brains]
    ['portal/info/mygallery/myalbum']

Add some photos

    >>> zip = self.loadFile('data/test.zip')
    >>> error = album.uploadPhotoOrZip(zip)
    >>> album.objectIds()
    ['a.gif', 'b.gif', 'c-d.gif', 'd_and_d.gif', 'e-34.gif', 'k.gif']
    >>> album['a.gif'].saveProperties(title='A GIF Image')
    >>> album['b.gif'].saveProperties(title='B GIF Image')

Copy/paste them

    >>> cp = album.copyObjects(ids=['a.gif', 'b.gif'])
    >>> res = album.pasteObjects(cp_data=cp)
    >>> brains = ctool(title='GIF Image')
    >>> [brain.getObject().getId() for brain in brains]
    ['a.gif',  'b.gif', 'copy_of_a.gif', 'copy_of_b.gif']

Cut/paste

    >>> album_id = gallery.addNyPhotoFolder(id='newalbum', title='New Album')
    >>> new_album = gallery[album_id]
    >>> cp = album.cutObjects(ids=['copy_of_a.gif', 'copy_of_b.gif'])
    >>> res = new_album.pasteObjects(cp_data=cp)
    >>> album.objectIds()
    ['a.gif', 'b.gif', 'c-d.gif', 'd_and_d.gif', 'e-34.gif', 'k.gif']
    >>> new_album.objectIds()
    ['copy_of_a.gif', 'copy_of_b.gif']
    >>> brains = ctool(title='GIF Image')
    >>> sorted([brain.getObject().absolute_url(1) for brain in brains])
    ['portal/info/mygallery/myalbum/a.gif', 'portal/info/mygallery/myalbum/b.gif', 'portal/info/mygallery/newalbum/copy_of_a.gif', 'portal/info/mygallery/newalbum/copy_of_b.gif']

Delete photos

    >>> new_album.deleteObjects(ids=['copy_of_a.gif', 'copy_of_b.gif'])
    >>> new_album.objectIds()
    []
    >>> brains = ctool(title='GIF Image')
    >>> sorted([brain.getObject().absolute_url(1) for brain in brains])
    ['portal/info/mygallery/myalbum/a.gif', 'portal/info/mygallery/myalbum/b.gif']
