Esempio n. 1
0
    def setUp(self):
        from columns.model import Setting

        tmp = Setting.from_dict(dict(module=u"test", values={"name": u"test_user"}))
        try:
            tmp.save()
        except Exception, ex:
            print ex
Esempio n. 2
0
	def _create(self, format, parent_id=None):
		if format == 'json':
			params = json.loads(request.body)
		#elif format == 'atom':
		#	from lxml import etree
		#	params = Setting.parse_xml(etree.fromstring(request.body))
		elif format == 'html':
			from formencode import NestedVariables
			params = NestedVariables.to_python(request.POST.mixed())
		else:
			raise UnacceptedFormat(format)
		
		item = Setting.from_dict(params)
		item.save()
		app_globals.clear_settings()
		return item