Changeset 1839
- Timestamp:
- 11/03/08 17:48:10 (2 months ago)
- Location:
- siteapp/branches/story-type-as-attribute/opengeo/almanac
- Files:
-
- 4 modified
-
content.py (modified) (2 diffs)
-
rest.txt (modified) (2 diffs)
-
security.txt (modified) (1 diff)
-
smoketest.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
siteapp/branches/story-type-as-attribute/opengeo/almanac/content.py
r1827 r1839 271 271 grok.implements(IStory) 272 272 273 def _get_type(self): 274 from utils import _media_type_scheme 275 for scheme, type, label in self.categories: 276 if scheme == _media_type_scheme: 277 if label == 'words': 278 return 'text' 279 return label 280 return 'text' 281 raise ValueError('Could not find media type from categories: %s' % 282 self.categories) 283 284 def _set_type(self, value): 285 assert value in ('text', 'image', 'video'), "Invalid story media type: '%s'" % value 286 from utils import _media_type_scheme 287 cats = [] 288 media_type_added = False 289 for scheme, type, label in self.categories: 290 if scheme == _media_type_scheme: 291 cats.append((scheme, type, value)) 292 media_type_added = True 293 else: 294 cats.append((scheme, type, label)) 295 if not media_type_added: 296 cats.append((_media_type_scheme, 'Story', value)) 297 self.categories = tuple(cats) 298 299 type = property(_get_type, _set_type) 273 300 274 301 class Comment(BaseModel): … … 382 409 @grok.action("Update") 383 410 def update_obj(self, **data): 411 # XXX we lose the correct type for whatever reason 412 type = self.context.type 384 413 self.applyData(self.context, **data) 414 self.context.type = type 385 415 self.flash(u'Almanac updated') 386 416 self.redirect(self.url(self.context)) -
siteapp/branches/story-type-as-attribute/opengeo/almanac/rest.txt
r1837 r1839 30 30 >>> request = testing.new_interaction('bob') 31 31 >>> alm1, s1 = content_setup(app, request, data1, data2) 32 >>> s1.type = 'image'33 >>> s1.photoid = '1234'34 32 >>> endInteraction() 35 33 … … 206 204 ('http://xmlns.opengeo.org/almanac/atom#contenttype', 'Story', 'Story')) 207 205 208 >>> story.type = 'text'209 210 206 211 207 Security -
siteapp/branches/story-type-as-attribute/opengeo/almanac/security.txt
r1837 r1839 232 232 and should be able to delete the story of another:: 233 233 234 >>> app['a1']['third-awesome-story.1'].type = 'text'235 234 >>> url = "http://localhost/++rest++app/our-app/a1/third-awesome-story.1" 236 235 >>> response = http_call('DELETE', url, data=testing.entry1, handle_errors=True, **make_header('dude')) -
siteapp/branches/story-type-as-attribute/opengeo/almanac/smoketest.txt
r1837 r1839 20 20 21 21 >>> a1, s1 = testing.setup_basic_content_fixture(app, request, data1, data2) 22 >>> s1.type = 'text'23 22 >>> endInteraction() 24 23 >>> alm1 = a1
