<s> from sharepoint . xml import namespaces , SP <EOL> from sharepoint . lists . definitions import LIST_WEBSERVICE <EOL> class SharePointAttachments ( object ) : <EOL> def __init__ ( self , opener , list_id , row_id ) : <EOL> self . opener = opener <EOL> self . list_id , self . row_id = list_id , row_id <EOL> def __iter__ ( self ) : <EOL> """<STR_LIT>""" <EOL> xml = SP . GetAttachmentCollection ( SP . listName ( self . list_id ) , <EOL> SP . listItemID ( str ( self . row_id ) ) ) <EOL> response = self . opener . post_soap ( LIST_WEBSERVICE , xml , <EOL> soapaction = '<STR_LIT>' ) <EOL> for url in response . xpath ( '<STR_LIT>' , namespaces = namespaces ) : <EOL> yield SharePointAttachment ( self , url . text ) <EOL> def delete ( self , url ) : <EOL> raise NotImplementedError <EOL> def add ( self , filename , content ) : <EOL> raise NotImplementedError <EOL> def open ( self , url ) : <EOL> return self . opener . open ( url ) <EOL> class SharePointAttachment ( object ) : <EOL> def __init__ ( self , attachments , url ) : <EOL> self . attachments , self . url = attachments , url <EOL> def delete ( self ) : <EOL> self . attachments . delete ( self . url ) <EOL> def open ( self ) : <EOL> return self . attachments . open ( self . url ) <EOL> def __unicode__ ( self ) : <EOL> return self . url <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( type ( self ) . __name__ , self . url ) </s>
