Ticket #399: diff-ru-1.patch
| File diff-ru-1.patch, 16.2 kB (added by tekNico, 3 years ago) |
|---|
-
trunk/Axiom/axiom/examples/bucket.py
old new 1 1 from axiom import item, attributes 2 2 3 3 class Bucket(item.Item): 4 typeName = 'bucket'5 schemaVersion = 16 7 4 name = attributes.text() 8 5 9 6 def getstuff(self): … … 14 11 15 12 16 13 class FoodItem(item.Item): 17 typeName = 'food'18 schemaVersion = 119 20 14 bucket = attributes.reference() 21 15 extra = attributes.reference() 22 16 deliciousness = attributes.integer(indexed=True) 23 17 24 18 class Chicken(item.Item): 25 typeName = 'chicken'26 schemaVersion = 127 28 19 epistemologicalBasisForCrossingTheRoad = attributes.text() 29 20 def what(self): 30 21 print 'chicken!' 31 22 32 23 class Biscuit(item.Item): 33 typeName = 'biscuit'34 schemaVersion = 135 36 24 fluffiness = attributes.integer() 37 25 def what(self): 38 26 print 'biscuits!' -
trunk/Axiom/axiom/examples/library.py
old new 19 19 20 20 21 21 class Borrower(Item): 22 typeName = 'borrower'23 schemaVersion = 124 22 name = text(indexed=True) 25 23 26 24 class Book(Item): 27 typeName = 'book'28 schemaVersion = 129 30 25 title = text() 31 26 author = text() 32 27 isbn = text() … … 37 32 library = reference() 38 33 39 34 class LendingLibrary(Item): 40 typeName = 'lending_library'41 schemaVersion = 142 43 35 name = text() 44 36 45 37 def books(self): -
trunk/Axiom/axiom/item.py
old new 11 11 12 12 _typeNameToMostRecentClass = {} 13 13 14 def normalize(qualName): 15 return qualName.lower().replace('.', '_') 16 14 17 class NoInheritance(RuntimeError): 15 18 """ 16 19 Inheritance is as-yet unsupported by XAtop. … … 38 41 raise NoInheritance("already inherited from item once: " 39 42 "in-database inheritance not yet supported") 40 43 if T.typeName is None: 41 raise NotImplementedError( 42 "%s did not specify a typeName attribute" % (qual(T),)) 44 T.typeName = normalize(qual(T)) 43 45 if T.schemaVersion is None: 44 raise NotImplementedError( 45 "%s did not specify a schemaVersion attribute" % (qual(T),)) 46 T.schemaVersion = 1 46 47 if T.typeName in _typeNameToMostRecentClass: 47 48 if T.__legacy__: 48 49 return T … … 513 514 if self.store.autocommit: 514 515 self.checkpoint() 515 516 516 # You _MUST_ specify versionin subclasses517 # You may specify schemaVersion and typeName in subclasses 517 518 schemaVersion = None 518 519 typeName = None 519 520 … … 614 615 """ 615 616 I am a connector between the store and a powerup. 616 617 """ 617 typeName = 'axiom_powerup_connector'618 schemaVersion = 1619 620 618 powerup = reference() 621 619 item = reference() 622 620 interface = text() -
trunk/Axiom/axiom/test/itemtest.py
old new 2 2 from axiom import item, attributes 3 3 4 4 class PlainItem(item.Item): 5 typeName = 'axiom_test_plain_item'6 schemaVersion = 17 5 8 6 plain = attributes.text() -
trunk/Axiom/axiom/test/test_attributes.py
old new 8 8 import random 9 9 10 10 class Number(Item): 11 typeName = 'test_number'12 schemaVersion = 113 14 11 value = ieee754_double() 15 12 16 13 … … 32 29 self.assertRaises(TypeError, s.getItemByID, unicode(sid)) 33 30 34 31 class SortedItem(Item): 35 typeName = 'test_sorted_thing'36 schemaVersion = 137 38 32 goingUp = integer() 39 33 goingDown = integer() 40 34 theSame = integer() -
trunk/Axiom/axiom/test/test_count.py
old new 5 5 from axiom.attributes import integer, AND, OR 6 6 7 7 class ThingsWithIntegers(Item): 8 schemaVersion = 19 typeName = 'axiom_test_thing_with_integers'10 11 8 a = integer() 12 9 b = integer() 13 10 14 11 15 12 class NotARealThing(Item): 16 schemaVersion = 117 typeName = 'axiom_test_never_created_item'18 19 13 irrelevantAttribute = integer() 20 14 21 15 def __init__(self, **kw): -
trunk/Axiom/axiom/test/test_files.py
old new 9 9 from axiom.attributes import path 10 10 11 11 class PathTesterItem(Item): 12 schemaVersion = 113 typeName = 'test_path_thing'14 15 12 relpath = path() 16 13 abspath = path(relative=False) 17 14 -
trunk/Axiom/axiom/test/test_inheritance.py
old new 12 12 13 13 def testNoInheritance(self): 14 14 class XA(Item): 15 schemaVersion = 116 typeName = 'inheritance_test_xa'17 15 a = integer() 18 16 19 17 try: 20 18 class XB(XA): 21 schemaVersion = 122 typeName = 'inheritance_test_xb'23 19 b = integer() 24 20 except NoInheritance: 25 21 pass -
trunk/Axiom/axiom/test/test_item.py
old new 49 49 50 50 51 51 class NoAttrsItem(item.Item): 52 typeName = 'noattrsitem' 53 schemaVersion = 1 52 pass 54 53 55 54 class TestItem(unittest.TestCase): 56 55 def testCreateItem(self): -
trunk/Axiom/axiom/test/test_mixin.py
old new 35 35 pass 36 36 37 37 class ItemXYZ(Item, XYZ): 38 typeName = 'item_xyz'39 schemaVersion = 140 41 38 xm = integer(default=0) 42 39 ym = integer(default=0) 43 40 zm = integer(default=0) -
trunk/Axiom/axiom/test/test_powerup.py
old new 22 22 23 23 24 24 class SumContributor(Item): 25 schemaVersion = 126 typeName = 'test_sum_contributor'27 28 25 value = integer() 29 26 30 27 31 28 class Summer(Item): 32 schemaVersion = 133 typeName = 'test_sum_doer'34 35 29 sumTimes = integer() 36 30 sumTotal = integer() 37 31 … … 87 81 from twisted.application.service import IService, Service 88 82 89 83 class SillyService(Item, Service): 90 typeName = 'test_silly_service'91 schemaVersion = 192 93 84 started = integer(default=0) 94 85 stopped = integer(default=0) 95 86 running = integer(default=0) -
trunk/Axiom/axiom/test/test_query.py
old new 7 7 from axiom.attributes import reference, text, bytes, integer, AND, OR 8 8 9 9 class A(Item): 10 schemaVersion = 111 typeName = 'a'12 13 10 reftoc = reference() 14 11 type = text(indexed=True) 15 12 16 13 17 14 class B(Item): 18 schemaVersion = 119 typeName = 'b'20 21 15 cref = reference() 22 16 name = text(indexed=True) 23 17 24 18 class C(Item): 25 schemaVersion = 126 typeName = 'c'27 28 19 name = text(indexed=True) 29 20 30 21 class D(Item): 31 schemaVersion = 132 typeName = 'd'33 22 id = bytes() 34 23 one = bytes() 35 24 two = bytes() 36 25 three = bytes() 37 26 38 27 class E(Item): 39 schemaVersion = 140 typeName = 'e'41 28 name = text() 42 29 transaction = text() 43 30 amount = integer() 44 31 45 32 46 33 class ThingWithCharacterAndByteStrings(Item): 47 schemaVersion = 148 49 typeName = 'ThingWithCharacterAndByteStrings'50 51 34 characterString = text(caseSensitive=True) 52 35 caseInsensitiveCharString = text(caseSensitive=False) 53 36 -
trunk/Axiom/axiom/test/test_queryutil.py
old new 11 11 from axiom.queryutil import overlapping, AttributeTuple 12 12 13 13 class Segment(Item): 14 typeName = 'test_overlap_segment'15 schemaVersion = 116 17 14 x = integer() 18 15 y = integer() 19 16 … … 21 18 return 'Segment<%d,%d>' % (self.x, self.y) 22 19 23 20 class ABC(Item): 24 typeName = 'test_tuple_queries'25 schemaVersion = 126 27 21 a = integer(allowNone=False) 28 22 b = integer(allowNone=False) 29 23 c = integer(allowNone=False) -
trunk/Axiom/axiom/test/test_reference.py
old new 5 5 from axiom.attributes import integer, reference 6 6 7 7 class Referee(Item): 8 schemaVersion = 19 typeName = "test_reference_referee"10 11 8 topSecret = integer() 12 9 13 10 class SimpleReferent(Item): 14 schemaVersion = 115 typeName = "test_reference_referent"16 17 11 ref = reference() 18 12 19 13 class SomeException(Exception): … … 38 32 39 33 def _makeReferentItem(self, whenDeleted, unique): 40 34 class _Referent(Item): 41 schemaVersion = 142 typeName = "test_reference_referent_%r" % unique43 44 35 ref = reference(whenDeleted=whenDeleted) 45 36 46 37 return _Referent -
trunk/Axiom/axiom/test/test_scheduler.py
old new 19 19 20 20 class TestEvent(Item): 21 21 22 typeName = 'test_event'23 schemaVersion = 124 25 22 deferred = inmemory() # these won't fall out of memory due to 26 23 # caching, thanks. 27 24 testCase = inmemory() -
trunk/Axiom/axiom/test/test_sequence.py
old new 8 8 9 9 10 10 class SomeItem(Item): 11 schemaVersion = 112 typeName = 'test_sequence_some_item'13 11 foo = integer() 14 12 15 13 def __repr__(self): -
trunk/Axiom/axiom/test/test_substore.py
old new 10 10 11 11 class SubStored(Item): 12 12 13 schemaVersion = 114 typeName = 'substoredthing'15 13 a = text() 16 14 b = bytes() 17 15 -
trunk/Axiom/axiom/test/test_tablecreate.py
old new 6 6 from twisted.trial.unittest import TestCase 7 7 8 8 class A(item.Item): 9 typeName = 'test_table_creator'10 schemaVersion = 111 12 9 attr = attributes.integer(default=3) 13 10 14 11 def setup(s): -
trunk/Axiom/axiom/test/test_tags.py
old new 8 8 from axiom.attributes import text 9 9 10 10 class Gizmo(Item): 11 typeName = 'test_gizmo'12 schemaVersion = 113 11 name = text() 14 12 15 13 -
trunk/Axiom/axiom/test/test_unavailable_type.py
old new 7 7 def makeItem(): 8 8 class MyItem(item.Item): 9 9 10 typeName = 'test_deadtype_myitem'11 schemaVersion = 112 13 10 hello = attributes.integer() 14 11 15 12 return MyItem -
trunk/Axiom/axiom/test/test_userbase.py
old new 19 19 pass 20 20 21 21 class GarbageProtocolHandler(Item): 22 schemaVersion = 123 typeName = 'test_login_garbage'24 25 22 garbage = integer() 26 23 27 24 implements(IGarbage) … … 116 113 [('nameuser', 'ain.dom'), ('username', 'dom.ain')]) 117 114 118 115 class ThingThatMovesAround(Item): 119 typeName = 'test_thing_that_moves_around'120 schemaVersion = 1121 122 116 superValue = integer() 123 117 124 118 class SubStoreMigrationTestCase(unittest.TestCase): -
trunk/Axiom/axiom/test/test_xatop.py
old new 22 22 23 23 24 24 class TestItem(item.Item): 25 schemaVersion = 126 typeName = 'TestItem'27 25 foo = attributes.integer(indexed=True) 28 26 bar = attributes.text() 29 27 baz = attributes.timestamp() … … 164 162 165 163 166 164 class AttributefulItem(item.Item): 167 schemaVersion = 1168 typeName = 'test_attributeful_item'169 170 165 withDefault = attributes.integer(default=42) 171 166 withoutDefault = attributes.integer() 172 167 … … 175 170 self.storeID, self.withDefault, self.withoutDefault) 176 171 177 172 class StricterItem(item.Item): 178 schemaVersion = 1179 typeName = 'test_stricter_item'180 181 173 aRef = attributes.reference(allowNone=False) 182 174 183 175
