Mercurial > public > sg101
diff gpp/forums/attachments.py @ 286:72fd300685d5
For #95. You can now make posts with no text in the body if you have attachments. And now if you create a new topic with an attachment, and the POST fails (say you forgot the topic title), we will now re-attach attachments. Also fixed a bug in the smiley code that would arise if it was asked to markup an empty string.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 23 Oct 2010 20:19:46 +0000 |
parents | 8fd4984d5c3b |
children |
line wrap: on
line diff
--- a/gpp/forums/attachments.py Thu Oct 14 02:39:35 2010 +0000 +++ b/gpp/forums/attachments.py Sat Oct 23 20:19:46 2010 +0000 @@ -17,7 +17,7 @@ This class is constructed with a list of Oembed ids. We retrieve the actual Oembed objects associated with these keys for use in subsequent operations. - + """ # ensure all ids are integers self.pks = [] @@ -43,3 +43,17 @@ for n, pk in enumerate(self.pks): attachment = Attachment(post=post, embed=self.embeds[pk], order=n) attachment.save() + + def has_attachments(self): + """ + Return true if we have valid pending attachments. + + """ + return len(self.embeds) > 0 + + def get_ids(self): + """ + Return the list of Oembed ids. + + """ + return self.pks