Hi Andy, I'm not sure what's going on, because the behavior definitely
should have changed if you modified that models.py file.  Maybe it would be
worth throwing a print statement in that function and then running the
development server just to make sure that the correct functions are being
called?  You could test to see if the try/except blocks are working as we
want them to.  Sorry, not a real answer, I know, but get us on the right
track.

Adam

On Mon, Nov 16, 2015 at 3:18 PM, Andy Graham <andyg...@gmail.com> wrote:

> Still no luck.  I made the changes reinstalled and restarted apache and
> end up with the exact same error message.
>
>
> On Wednesday, November 4, 2015 at 11:39:32 AM UTC-8, Andy Graham wrote:
>>
>> Currently still using the Django development server and we work through
>> some issues, but will try it out on apache soon and let you know.  Thanks.
>>
>> On Wednesday, November 4, 2015 at 6:24:12 AM UTC-8, Adam Cox wrote:
>>>
>>> Did you restart apache?
>>>
>>> On Tuesday, November 3, 2015 at 10:29:29 AM UTC-6, Andy Graham wrote:
>>>>
>>>> Posted a response earlier but it appears to have been deleted, not sure
>>>> why.
>>>>
>>>> Thanks much for the suggestion Adam, however, I am still having the
>>>> same issue.  I have made the changes below but when I try and delete the
>>>> media nothing happens.  The error I am getting via the developer tools is
>>>> below:
>>>>
>>>> k.cors.a.crossdomain.s...@jquery.js:8623n.extend.a...@jquery.js:8152
>>>> backbone.view.extend.deleteresou...@delete-resource.js:12
>>>> n.event.dispa...@jquery.js:4409r.han...@jquery.js:4095
>>>>
>>>> The first issue above (k.cors.a.crossDomain.send) seems to be erroring
>>>> out on the below line in the jquery.js file:
>>>>
>>>> try {
>>>> // Do send the request (this may raise an exception)
>>>> xhr.send( options.hasContent && options.data || null );
>>>>
>>>>
>>>> Any suggestions are appreciated, thanks.
>>>>
>>>> Andy
>>>>
>>>> On Thursday, October 22, 2015 at 1:01:18 PM UTC-7, Adam Cox wrote:
>>>>>
>>>>> Thanks for posting on the forum about this... I added the S3 bucket
>>>>> info to the documentation, but didn't think to test deleting files from
>>>>> it.  After trying it out a little bit ago, I got the same result as you
>>>>> did.  What is happening is that the db resource is deleted, but Django 
>>>>> hits
>>>>> an error while trying to delete the actual file on S3 (that's why the
>>>>> redirect didn't work).  You'll see that the files you were trying to 
>>>>> delete
>>>>> still exist in your bucket.
>>>>>
>>>>> I was able to fix it up, drawing mainly from this question
>>>>> <http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F5372934%2Fhow-do-i-get-django-admin-to-delete-files-when-i-remove-an-object-from-the-datab&sa=D&sntz=1&usg=AFQjCNFObrQVe4pUUGw_FqqUANaWBc269Q>
>>>>>  (see
>>>>> the second answer, and its comments).  It will be easy for you to do in
>>>>> this one case, but will require some more info in the documentation, and
>>>>> ultimately a modification in the arches code to accommodate S3 storage.
>>>>>
>>>>> For now, *carefully* head into your virtual environment, and open up
>>>>> this file: ENV/lib/python2.7/site-packages/arches/app/models/models.py.  
>>>>> Be
>>>>> sure to back it up before you do!  Around line 433 is a function
>>>>> called auto_delete_file_on_delete().  In that function, you'll see a line
>>>>> that says "if os.path.isfile(instance.val.path):"  That line is causing a
>>>>> server error, because instance.val doesn't have a path property when you
>>>>> use S3 storage (it has a url property).
>>>>> To make the fix, replace the contents of the function with this (note
>>>>> that the same first line is used):
>>>>>
>>>>>     if instance.val:
>>>>>         try:
>>>>>             if os.path.isfile(instance.val.path):
>>>>>                 os.remove(instance.val.path)
>>>>>         except:
>>>>>             storage, name = instance.val.storage, instance.val.name
>>>>>             storage.delete(name)
>>>>>
>>>>> Now it'll still try the old method, but when it comes across an error
>>>>> (a.k.a. "exception") it'll skip to the new code that is necessary for
>>>>> dealing with S3.
>>>>>
>>>>> This is really a hack, not a fix, but if you are careful about the
>>>>> indentation I think you'll be able to manage just fine.  Also, if you are
>>>>> using a text editor like notepad++, be sure that you are using 4 spaces
>>>>> (not tab) to make the indentation (4 spaces per indent).
>>>>>
>>>>> Good luck and thanks again for posting this issue!
>>>>>
>>>>> On Wednesday, October 21, 2015 at 3:38:32 PM UTC-5, Andy Graham wrote:
>>>>>>
>>>>>> Hello All,
>>>>>> A question about an error I am getting trying to delete Media
>>>>>> resources on S3.  When I delete the resource via the Resource Manager
>>>>>> (Delete Resource in the left side tool bar) I get the message that states
>>>>>> "You won't be able to undo this operation!", then I click on the Delete
>>>>>> button and nothing happens, however, if I go back to the Map or Search 
>>>>>> the
>>>>>> resource has been deleted.
>>>>>>
>>>>>> Using the developer tools for the browser I have traced the error
>>>>>> back to the delete-resource.js in the arches/app/media/js/views/forms
>>>>>>  folder.
>>>>>>
>>>>>> Specifically:
>>>>>>
>>>>>>         deleteResource: function() {
>>>>>>             $.ajax({
>>>>>>                 method: 'DELETE',
>>>>>>                 url: '',
>>>>>>                 success: function() {
>>>>>>                     location.href = arches.urls.home;
>>>>>>                 }
>>>>>>             });
>>>>>>
>>>>>> The error seems to be taking place at the url:, which isn't
>>>>>> populated.  Does anyone have suggestions for the proper way to reference
>>>>>> the S3 bucket here, and if there are any specific permissions that need 
>>>>>> to
>>>>>> be set to allow deleting files from S3?  Any help is appreciated, thanks.
>>>>>>
>>>>>> Andy
>>>>>>
>>>>> --
> -- To post, send email to archesproject@googlegroups.com. To unsubscribe,
> send email to archesproject+unsubscr...@googlegroups.com. For more
> information, visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to archesproject+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- To post, send email to archesproject@googlegroups.com. To unsubscribe, send 
email to archesproject+unsubscr...@googlegroups.com. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to archesproject+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to