Ignore:
Timestamp:
22/12/08 12:18:38 (12 years ago)
Author:
cbyrom
Message:

Add delete function to atom editor to delete granule atoms - together
with warning messages beforehand and result pop up messages afterwards.
Adjust granulite to expose the delete functions publicly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MILK/trunk/milk_server/milk_server/controllers/atom_editor/editatom.py

    r4679 r4697  
    218218                        c.atom = None 
    219219                        uri = None 
    220                      
    221220                             
    222221                # now do redirection - NB, this ensures that current atom contents are 
     
    421420        self.addRelatedLinksDropDowns() 
    422421 
     422 
     423    def delete(self, uri): 
     424        ''' 
     425        Delete the atom associated with the specified uri - and return 
     426        user to the atom home page.  NB, only granule atoms can be deleted 
     427        at the moment. 
     428        ''' 
     429        if uri: 
     430            try: 
     431                logging.info("Deleting atom, '%s'" %uri) 
     432                self.prepareDataModel(uri) 
     433                eXistClient = self.__getExistClient('local') 
     434                gran = granulite(None, granuleAtom = c.atom, \ 
     435                                 eXistClient = eXistClient, \ 
     436                                 deleteMode = True) 
     437     
     438                gran.deleteGranuleAndDEReferences() 
     439                raise Exception('blah') 
     440                c.deleteResult = "Atom deleted successfully." 
     441                logging.info("- atom deleted") 
     442            except Exception, e: 
     443                logging.error("Problem occured whilst deleting atom: '%s'" %e.message) 
     444                c.deleteResult = "Warning: a problem occured whilst deleting the atom - this " + \ 
     445                    "may have left the system in an unstable state - please check if the atom, or " + \ 
     446                    "references to the atom still exist" 
     447 
     448        return render("genshi", "atom_editor/atom_home") 
     449         
    423450     
    424451    def edit(self, uri): 
     
    682709            logging.info("Validating input") 
    683710            try: 
    684                 inputs = request.params 
     711                inputs = self.__getTidyInputs() 
    685712                validator = CreateAtomFormSchema() 
    686713                validator.to_python(inputs) 
     
    718745 
    719746        try: 
    720             return savePageAndRender(self.pathInfo, 'atom_editor/atom_creator') 
     747            return savePageAndRender(self.pathInfo, 'atom_editor/atom_creator', **inputs) 
    721748 
    722749        except Exception, e: 
Note: See TracChangeset for help on using the changeset viewer.