Esempio n. 1
0
 def test_uncamel(self):
     """Test the un-camel-casing routines in util."""
     from micromongo.utils import uncamel
     self.assertEquals(uncamel('CamelCase'), 'camel_case')
     self.assertEquals(uncamel('CamelCamelCase'), 'camel_camel_case')
     self.assertEquals(uncamel('already_un'), 'already_un')
     self.assertEquals(uncamel('Capitalized'), 'capitalized')
     self.assertEquals(uncamel('getHTTPResponseCode'), 'get_http_response_code')
Esempio n. 2
0
 def __classinit__(cls, attrs):
     if cls.__name__ == 'Model':
         return
     if 'collection' in attrs and 'database' in attrs:
         key = '%s.%s' % (attrs['database'], attrs['collection'])
     elif 'collection' in attrs:
         key = attrs['collection']
     else:
         module = cls.__module__.split('.')[-1]
         key = '%s.%s' % (uncamel(module), uncamel(cls.__name__))
     cls._collection_key = key
     AccountingMeta.collection_map[key] = cls
Esempio n. 3
0
 def __classinit__(cls, attrs):
     if cls.__name__ == 'Model':
         return
     if 'collection' in attrs and 'database' in attrs:
         key = '%s.%s' % (attrs['database'], attrs['collection'])
     elif 'collection' in attrs:
         key = attrs['collection']
     else:
         module = cls.__module__.split('.')[-1]
         key = '%s.%s' % (uncamel(module), uncamel(cls.__name__))
     cls._collection_key = key
     AccountingMeta.collection_map[key] = cls