Hey Mark,

If I'm reading this correctly I'd say this is expected behaviour.
>From the moment you upload a new version the data that's set on the current 
>version will be stored, the data that's set after that upload will not be 
>applied to that created version.
Further break down of your workflow:

- Upload new version through add content widget, creates version 1.0 and sets 
the description to 'V1';
- Upload second version, this takes description 'V1' and creates version 1.1. 
Afterwards you change the description to 'V2';
- Upload a third version, this takes description 'V2' and applies it to 1.2.

Results:

- 1.0 has description of V1
- 1.1 has description of V1
- 1.2 has description of V2

So, in short, users would have to change their description to 'V2', 'V3', etc. 
prior to uploading a new version.

Hope to help (and make sense)
- Bert

On 6 Jun 2012, at 08:11, Mark Triggs wrote:

> Hi all,
> 
> [Long, sorry]
> 
> I've been trying to wrap my head around how versions are stored, and
> I've noticed some slightly strange behaviour.  I just wanted to check
> that what I'm seeing is expected.
> 
> Suppose I have a file called "document.txt" containing the string 
> "This is the first version of my document"
> 
> I upload this through the UI:
> 
>  * Add content
>  * [upload content] 
>  * title="document.txt", description="Version: 1"
>  * Add
>  * Done, add collected
> 
> If I look at this with curl, so far so good:
> 
>  $ curl -s -u admin:admin 'http://localhost:8080/p/lfekdsuCie.versions.json' 
> | python -mjson.tool
>  {
>      "items": 1, 
>      "path": "lfekdsuCie", 
>      "total": 1, 
>      ...
>      "versions": {
>          "1.0": {
>              "_created": 1338965314454, 
>              "_lastModifiedBy": "admin", 
>              "_versionNumber": 1338965314561, 
>              "sakai:pool-content-created-for": "admin", 
>              "sakai:pooled-content-file-name": "document.txt", 
>              "versionId": "otnTYK-jEeGkOt_aCgEBgA+"
>          }
>      }
>  }
> 
> 
>  $ curl -s -u admin:admin 
> 'http://localhost:8080/p/lfekdsuCie.version.,otnTYK-jEeGkOt_aCgEBgA+,.json' | 
> python -mjson.tool
>  {
>      "_blockId": "ot6OUK-jEeGkOt_aCgEBgA+", 
>      "_bodyCreated": 1338965314485, 
>      "_bodyCreatedBy": "admin", 
>      "_bodyLastModified": 1338965314485, 
>      "_bodyLastModifiedBy": "admin", 
>      "_bodyLocation": "2012/5/dk/57/G3/dk57G3QOWtNOqPzOKknw9aEUvLg", 
>      "_created": 1338965314454, 
>      "_createdBy": "admin", 
>      "_id": "otnTYK-jEeGkOt_aCgEBgA+", 
>      "_lastModified": 1338965314543, 
>      "_lastModifiedBy": "admin", 
>      "_length": 41, 
>      "_mimeType": "text/plain", 
>      "_nextVersion": "ouonEa-jEeGkOt_aCgEBgA+", 
>      "_path": "lfekdsuCie", 
>      "_readOnly": "Y", 
>      "_versionHistoryId": "ouonEK-jEeGkOt_aCgEBgA+", 
>      "_versionNumber": 1338965314561, 
>      "sakai:allowcomments": "true", 
>      "sakai:copyright": "creativecommons", 
>      "sakai:description": "Version: 1", 
>      "sakai:fileextension": "txt", 
>      "sakai:needsprocessing": "true", 
>      "sakai:permissions": "public", 
>      "sakai:pool-content-created-for": "admin", 
>      "sakai:pooled-content-file-name": "document.txt", 
>      "sakai:pooled-content-manager": [
>          "admin"
>      ], 
>      "sakai:showcomments": "true", 
>      "sling:resourceType": "sakai/pooled-content"
>  }
> 
> 
>  $ curl -s -u admin:admin 
> 'http://localhost:8080/p/lfekdsuCie.version.,otnTYK-jEeGkOt_aCgEBgA+,/document.txt'
>  This is the first version of my document
>  {noformat}
> 
> 
> Immediately after creation there's one version, it has the right
> description and the file content is indeed what I uploaded.
> 
> Now I create another version:
> 
>  * Change the contents of my document.txt to "This is the second
>    version of my document"
> 
>  * [ Tools ] -> Upload a new version
> 
>  * Select my file, hit "Upload"
> 
>  * Change the description to "Version: 2"
> 
> 
> Again with the curls:
> 
> 
>  $ curl -s -u admin:admin 'http://localhost:8080/p/lfekdsuCie.versions.json' 
> | python -mjson.tool
>  {
>      "items": 2, 
>      "path": "lfekdsuCie", 
>      "total": 2, 
>      ...
>      "versions": {
>          "1.0": {
>              "_created": 1338965314454, 
>              "_lastModifiedBy": "admin", 
>              "_versionNumber": 1338965314561, 
>              "sakai:pool-content-created-for": "admin", 
>              "sakai:pooled-content-file-name": "document.txt", 
>              "versionId": "otnTYK-jEeGkOt_aCgEBgA+"
>          }, 
>          "1.1": {
>              "_created": 1338965314454, 
>              "_lastModifiedBy": "admin", 
>              "_versionNumber": 1338965443298, 
>              "sakai:pool-content-created-for": "admin", 
>              "sakai:pooled-content-file-name": "document.txt", 
>              "versionId": "ouonEa-jEeGkOt_aCgEBgA+"
>          }
>      }
>  }
> 
> 
>  $ curl -s -u admin:admin 
> 'http://localhost:8080/p/lfekdsuCie.version.,ouonEa-jEeGkOt_aCgEBgA+,.json' | 
> python -mjson.tool
>  {
>      "_blockId": "75iVsK-jEeGkOt_aCgEBgA+", 
>      "_bodyCreated": 1338965314485, 
>      "_bodyCreatedBy": "admin", 
>      "_bodyLastModified": 1338965443211, 
>      "_bodyLastModifiedBy": "admin", 
>      "_bodyLocation": "2012/5/Sl/Ut/3T/SlUt3T8uBeLfOtbfM-Gm4cCUXVM", 
>      "_created": 1338965314454, 
>      "_createdBy": "admin", 
>      "_id": "ouonEa-jEeGkOt_aCgEBgA+", 
>      "_lastModified": 1338965443275, 
>      "_lastModifiedBy": "admin", 
>      "_length": 42, 
>      "_mimeType": "text/plain", 
>      "_nextVersion": "76XcIK-jEeGkOt_aCgEBgA+", 
>      "_path": "lfekdsuCie", 
>      "_previousBlockId": "ot6OUK-jEeGkOt_aCgEBgA+", 
>      "_previousVersion": "otnTYK-jEeGkOt_aCgEBgA+", 
>      "_readOnly": "Y", 
>      "_versionHistoryId": "ouonEK-jEeGkOt_aCgEBgA+", 
>      "_versionNumber": 1338965443298, 
>      "commentCount": 0, 
>      "sakai:allowcomments": "true", 
>      "sakai:copyright": "creativecommons", 
>      "sakai:description": "Version: 1", 
>      "sakai:fileextension": "txt", 
>      "sakai:hasPreview": "false", 
>      "sakai:needsprocessing": "true", 
>      "sakai:pagecount": "0", 
>      "sakai:permissions": "public", 
>      "sakai:pool-content-created-for": "admin", 
>      "sakai:pooled-content-editor": [], 
>      "sakai:pooled-content-file-name": "document.txt", 
>      "sakai:pooled-content-manager": [
>          "admin"
>      ], 
>      "sakai:pooled-content-viewer": [
>          "everyone", 
>          "anonymous"
>      ], 
>      "sakai:showcomments": "true", 
>      "sling:resourceType": "sakai/pooled-content"
>  }
> 
> 
> 
>  $ curl -s -u admin:admin 
> 'http://localhost:8080/p/lfekdsuCie.version.,ouonEa-jEeGkOt_aCgEBgA+,/document.txt'
>  This is the second version of my document
> 
> 
> And if I repeat this whole process once more, the end result doesn't
> quite match up:
> 
> 
>  * Version 1.0:
>      - description: Version: 1
>      - content: This is the first version of my document
> 
>  * Version 1.1:
>      - description: Version: 1
>      - content: This is the second version of my document
> 
>  * Version 1.2:
>      - description: Version: 2
>      - content: This is the third version of my document
> 
> 
> I think I understand why this is happening: any time a new version of a
> file is uploaded, the old version gets snapshotted and squirreled away,
> but this happens after the binary content has been changed but prior to
> the description/etc. being changed.
> 
> This makes life tricky when you're writing code to deal with the
> versions.  To get the byte blob from a point in time and the metadata
> that corresponded to it, you need to get the blob from version N, but
> the metadata from version N+1 (or from the active content object if
> you've run out of versions).
> 
> Not the end of the world, but I just thought I'd report it in case it's
> a sign of something sinister.
> 
> Cheers,
> 
> Mark
> 
> -- 
> Mark Triggs
> <[email protected]>
> _______________________________________________
> oae-dev mailing list
> [email protected]
> http://collab.sakaiproject.org/mailman/listinfo/oae-dev

_______________________________________________
oae-dev mailing list
[email protected]
http://collab.sakaiproject.org/mailman/listinfo/oae-dev

Reply via email to