rhmessaging commits: r4379 - mgmt/trunk/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 15:43:07 -0400 (Fri, 08 Oct 2010)
New Revision: 4379
Modified:
mgmt/trunk/wooly/python/wooly/__init__.py
mgmt/trunk/wooly/python/wooly/bench.py
mgmt/trunk/wooly/python/wooly/datatable.py
mgmt/trunk/wooly/python/wooly/demo.py
mgmt/trunk/wooly/python/wooly/pages.py
mgmt/trunk/wooly/python/wooly/parameters.py
mgmt/trunk/wooly/python/wooly/server.py
mgmt/trunk/wooly/python/wooly/sql.py
mgmt/trunk/wooly/python/wooly/tables.py
mgmt/trunk/wooly/python/wooly/util.py
mgmt/trunk/wooly/python/wooly/widgets.py
Log:
Clean up wooly imports
Modified: mgmt/trunk/wooly/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/__init__.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/__init__.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,10 +1,4 @@
-from cStringIO import StringIO
-from urllib import quote, unquote_plus, unquote
-from copy import copy
-from urlparse import urlsplit
-from time import gmtime
-
-from wooly.profile import *
+from profile import *
from resources import ResourceFinder, StringCatalog
from template import *
from util import *
@@ -654,7 +648,8 @@
self.cookies_by_name[name] = (True, value, expires)
def expire_cookie(self, name):
- self.set_cookie(name, "", datetime(*gmtime(1)[0:6]))
+ dawn_of_time = time.gmtime(1)[0:6]
+ self.set_cookie(name, "", datetime(*dawn_of_time))
def get(self, key):
if key in self.values_by_path:
Modified: mgmt/trunk/wooly/python/wooly/bench.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/bench.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/bench.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,8 +1,8 @@
from xml.parsers.expat import ParserCreate
+from server import ClientSession
+from util import *
from wooly import Session, PageRedirect
-from wooly.server import ClientSession
-from util import *
class BenchmarkHarness(object):
def __init__(self, app):
Modified: mgmt/trunk/wooly/python/wooly/datatable.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/datatable.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/datatable.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,8 +1,8 @@
+from parameters import *
+from table import *
+from util import *
+from widgets import *
from wooly import *
-from wooly.parameters import *
-from wooly.table import *
-from wooly.widgets import *
-from util import *
strings = StringCatalog(__file__)
Modified: mgmt/trunk/wooly/python/wooly/demo.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/demo.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/demo.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,14 +1,10 @@
-import os
-
-from threading import Thread
-from time import sleep
-
+from forms import *
+from pages import HtmlPage
+from resources import StringCatalog
+from server import WebServer
+from util import *
+from widgets import *
from wooly import Application
-from wooly.server import WebServer
-from wooly.pages import HtmlPage
-from wooly.widgets import *
-from wooly.forms import *
-from wooly.resources import StringCatalog
strings = StringCatalog(__file__)
Modified: mgmt/trunk/wooly/python/wooly/pages.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/pages.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/pages.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,11 +1,8 @@
-import os
-
-from datetime import datetime
-
+from parameters import ListParameter
+from resources import StringCatalog
+from util import *
+from widgets import ItemSet
from wooly import *
-from wooly.parameters import ListParameter
-from wooly.resources import StringCatalog
-from wooly.widgets import ItemSet
strings = StringCatalog(__file__)
Modified: mgmt/trunk/wooly/python/wooly/parameters.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/parameters.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/parameters.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,5 +1,4 @@
-from copy import copy
-
+from util import *
from wooly import *
class DictParameter(Parameter):
Modified: mgmt/trunk/wooly/python/wooly/server.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/server.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/server.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,11 +1,7 @@
import socket
-from traceback import print_exc
-from datetime import datetime, timedelta
-from threading import Thread
-from wooly import *
-
from util import *
+from wooly import *
from wsgiserver import CherryPyWSGIServer
log = logging.getLogger("wooly.server")
Modified: mgmt/trunk/wooly/python/wooly/sql.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/sql.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/sql.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,5 +1,3 @@
-from copy import copy
-
from resources import *
from template import *
from util import *
Modified: mgmt/trunk/wooly/python/wooly/tables.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/tables.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/tables.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,6 +1,7 @@
+from parameters import *
+from util import *
+from widgets import *
from wooly import *
-from widgets import *
-from parameters import *
strings = StringCatalog(__file__)
Modified: mgmt/trunk/wooly/python/wooly/util.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/util.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/util.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,13 +1,22 @@
+import htmlentitydefs as entity
import logging
+import math
import os
import random
import sys
import time
+from copy import copy
from cStringIO import StringIO
-from datetime import datetime
+from datetime import datetime, timedelta
+from threading import Thread
from traceback import print_exc
+from urllib import quote, unquote_plus, unquote
+from urlparse import urlsplit
+from xml.sax.saxutils import escape
+from parsley.collectionsex import *
+
def unique_id():
bits0 = random.getrandbits(32)
bits1 = random.getrandbits(32)
@@ -16,24 +25,6 @@
return "%08x-%08x-%08x-%08x" % (bits0, bits1, bits2, bits3)
-try:
- from collections import defaultdict
-except ImportError:
- class defaultdict(dict):
- def __init__(self, default_factory=None):
- super(dict, self).__init__()
-
- self.default_factory = default_factory
-
- def __getitem__(self, key):
- try:
- super(dict, self).__getitem__(key)
- except KeyError:
- if self.default_factory is None:
- raise
- else:
- return self.default_factory()
-
class Writer(object):
def __init__(self):
self.writer = StringIO()
@@ -47,3 +38,20 @@
self.writer.close()
return string
+
+def escape_amp(string):
+ return str(string).replace("&", "&")
+
+def escape_entity(string, exceptions=None):
+ if not string:
+ return ""
+ t = ""
+ ex = exceptions or list()
+ for i in string:
+ if ord(i) in entity.codepoint2name and \
+ i not in ex:
+ name = entity.codepoint2name.get(ord(i))
+ t += "&" + name + ";"
+ else:
+ t += i
+ return t
Modified: mgmt/trunk/wooly/python/wooly/widgets.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/widgets.py 2010-10-08 19:33:55 UTC (rev 4378)
+++ mgmt/trunk/wooly/python/wooly/widgets.py 2010-10-08 19:43:07 UTC (rev 4379)
@@ -1,11 +1,7 @@
-from math import ceil
-import htmlentitydefs as entity
-from xml.sax.saxutils import escape
-
from parameters import *
from resources import *
+from util import *
from wooly import *
-import urllib
strings = StringCatalog(__file__)
@@ -351,11 +347,11 @@
def get_page_count(self, session):
count = self.get_count(session)
- return int(ceil(count / float(self.page_size)))
+ return int(math.ceil(count / float(self.page_size)))
def get_pageset_count(self, session):
page_count = self.get_page_count(session)
- return int(ceil(page_count / float(self.pageset_size)))
+ return int(math.ceil(page_count / float(self.pageset_size)))
def __link(self, href, content, class_=""):
return "<a href=\"%s\"%s>%s</a>" % \
@@ -493,20 +489,3 @@
def render_tag(self, session, action):
return action[2] and "a" or "span"
-
-def escape_amp(string):
- return str(string).replace("&", "&")
-
-def escape_entity(string, exceptions=None):
- if not string:
- return ""
- t = ""
- ex = exceptions or list()
- for i in string:
- if ord(i) in entity.codepoint2name and \
- i not in ex:
- name = entity.codepoint2name.get(ord(i))
- t += "&" + name + ";"
- else:
- t += i
- return t
14 years, 2 months
rhmessaging commits: r4378 - in mgmt/trunk/wooly: boneyard and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 15:33:55 -0400 (Fri, 08 Oct 2010)
New Revision: 4378
Added:
mgmt/trunk/wooly/boneyard/
mgmt/trunk/wooly/boneyard/model.py
Removed:
mgmt/trunk/wooly/python/wooly/model.py
Log:
Move wooly's model code to the boneyard; nothing uses it
Copied: mgmt/trunk/wooly/boneyard/model.py (from rev 4376, mgmt/trunk/wooly/python/wooly/model.py)
===================================================================
--- mgmt/trunk/wooly/boneyard/model.py (rev 0)
+++ mgmt/trunk/wooly/boneyard/model.py 2010-10-08 19:33:55 UTC (rev 4378)
@@ -0,0 +1,300 @@
+from new import instancemethod
+from threading import RLock
+
+class Model(object):
+ def __init__(self):
+ self.indexes = dict()
+ self.mclasses = dict()
+ self.__lock = RLock();
+
+ def get_index(self, cls):
+ return self.indexes.setdefault(cls, dict())
+
+ def lock(self):
+ self.__lock.acquire()
+
+ def unlock(self):
+ self.__lock.release()
+
+ def get_object(self, mclass, id):
+ self.get_index(mclass).get(id)
+
+class ModelClass(object):
+ def __init__(self, model, name):
+ self.model = model
+ self.name = name
+ self.endpoints = set()
+
+class ModelAssociation(object):
+ def __init__(self, model, name):
+ self.model = model
+ self.name = name
+ self.endpoints = set()
+
+ def add_endpoint(self, mclass, name, multiplicity):
+ if not isinstance(mclass, ModelClass):
+ raise TypeError()
+
+ if multiplicity not in ("0..1", "0..n"):
+ raise Exception("Multiplicity not recognized")
+
+ if len(self.endpoints) > 1:
+ raise Exception("Too many endpoints")
+
+ endpoint = self.Endpoint()
+ endpoint.name = name
+ endpoint.multiplicity = multiplicity
+
+ self.endpoints.add(endpoint)
+ endpoint.association = self
+
+ mclass.endpoints.add(endpoint)
+ endpoint.mclass = mclass
+
+ return endpoint
+
+ class Endpoint(object):
+ def __init__(self):
+ self.association = None
+ self.mclass = None
+
+ self.name = None
+ self.multiplicity = None
+
+ def other(self):
+ for end in self.association.endpoints:
+ if end is not self:
+ return end
+
+ def is_scalar(self):
+ return self.multiplicity == "0..1"
+
+ def set_scalar(self, this, that):
+ this.__dict__[self.name] = that
+
+ def get_scalar(self, this):
+ return this.__dict__[self.name]
+
+ def items(self, this):
+ return this.__dict__[self.name + "_set"]
+
+ def add(self, this, that):
+ if self.is_scalar():
+ self.set_scalar(this, that)
+ else:
+ self.items(this).add(that)
+
+ def remove(self, this, that):
+ if self.is_scalar():
+ self.set_scalar(this, None)
+ else:
+ self.items(this).remove(that)
+
+ def object_items(self, this):
+ return self.items(this)
+
+ def add_object(self, this, that):
+ this.lock()
+ try:
+ self.add(this, that)
+
+ that.lock()
+ try:
+ self.other().add(that, this)
+ finally:
+ that.unlock()
+ finally:
+ this.unlock()
+
+ def remove_object(self, this, that):
+ this.lock()
+ try:
+ self.remove(this, that)
+
+ that.lock()
+ try:
+ self.other().remove(that, this)
+ finally:
+ that.unlock()
+ finally:
+ this.unlock()
+
+ def get_object(self, this):
+ return self.get_scalar(this)
+
+ def set_object(self, this, new_that):
+ this.lock()
+ try:
+ old_that = self.get_scalar(this)
+
+ if old_that != None:
+ old_that.lock()
+ try:
+ self.other().remove(old_that, this)
+ finally:
+ old_that.unlock()
+
+ self.set_scalar(this, new_that)
+
+ if new_that != None:
+ new_that.lock()
+ try:
+ self.other().add(new_that, this)
+ finally:
+ new_that.unlock()
+ finally:
+ this.unlock()
+
+class ModelObject(object):
+ sequence = 100
+
+ def __init__(self, model, mclass):
+ self.model = model
+ self.mclass = mclass
+ self.__lock = RLock()
+
+ for end in self.mclass.endpoints:
+ if end.is_scalar():
+ self.add_scalar_attributes(end)
+ else:
+ self.add_set_attributes(end)
+
+ self.lock()
+ try:
+ self.__class__.sequence += 1
+ self.id = self.__class__.sequence
+ model.get_index(self.mclass)[self.id] = self
+ finally:
+ self.unlock()
+
+ def lock(self):
+ self.__lock.acquire()
+
+ def unlock(self):
+ self.__lock.release()
+
+ def setmethod(self, name, func):
+ if not hasattr(self, name):
+ method = instancemethod(func, self, self.__class__)
+ setattr(self, name, method)
+
+ def add_set_attributes(this, end):
+ setattr(this, end.name + "_set", set())
+
+ def items_method(self): return end.object_items(this)
+ this.setmethod(end.name + "_items", items_method)
+
+ def do_add_method(self, that):
+ if that == None:
+ raise Exception()
+
+ end.add_object(this, that)
+
+ this.setmethod("do_add_" + end.name, do_add_method)
+
+ def add_method(self, that): do_add_method(self, that)
+ this.setmethod("add_" + end.name, add_method)
+
+ def do_remove_method(self, that):
+ if that == None:
+ raise Exception()
+
+ end.remove_object(this, that)
+
+ this.setmethod("do_remove_" + end.name, do_remove_method)
+
+ def remove_method(self, that): do_remove_method(self, that)
+ this.setmethod("remove_" + end.name, remove_method)
+
+ def add_scalar_attributes(this, end):
+ end.set_scalar(this, None)
+
+ def get_method(self): return end.get_object(this)
+ this.setmethod("get_" + end.name, get_method)
+
+ def set_method(self, that): end.set_object(this, that)
+ this.setmethod("set_" + end.name, set_method)
+
+ # Note that this doesn't go through the add_someobject methods
+ def remove(self):
+ self.lock()
+ try:
+ for end in self.mclass.endpoints:
+ this = self
+
+ if end.is_scalar():
+ end.set_object(this, None)
+ else:
+ for that in end.items(this).copy():
+ end.remove_object(this, that)
+
+ del self.model.get_index(self.mclass)[self.id]
+ finally:
+ self.unlock()
+
+ def __str__(self):
+ return self.__class__.__name__ + "(" + str(self.id) + ")"
+
+class TestModel(Model):
+ def __init__(self):
+ super(TestModel, self).__init__()
+
+ self.order = ModelClass(self, self.Order)
+ self.item = ModelClass(self, self.Item)
+
+ self.assoc = ModelAssociation(self, "order_item")
+ self.assoc.add_endpoint(self.order, "item", "0..n")
+ self.assoc.add_endpoint(self.item, "order", "0..1")
+
+ class Order(ModelObject):
+ def __init__(self, model):
+ super(TestModel.Order, self).__init__(model, model.order)
+
+ class Item(ModelObject):
+ def __init__(self, model):
+ super(TestModel.Item, self).__init__(model, model.item)
+
+ def test(self):
+ def results(heading):
+ print heading
+ for item in order.item_set:
+ print " item", item, "item.order", item.order
+
+ item0 = self.Item(self)
+ item1 = self.Item(self)
+ item2 = self.Item(self)
+
+ order = self.Order(self)
+
+ order.add_item(item0)
+ order.add_item(item1)
+ order.add_item(item2)
+
+ results("beginning state")
+
+ order.remove_item(item0)
+
+ results("remove item0 from order.items")
+
+ item1.set_order(order)
+
+ results("remove order from item1.order")
+
+ order.add_item(item1)
+
+ results("a")
+
+ item1.set_order(None)
+
+ results("b")
+
+ item1.set_order(order)
+
+ results("c")
+
+ item1.remove()
+
+ results("d")
+
+if __name__ == "__main__":
+ TestModel().test()
Deleted: mgmt/trunk/wooly/python/wooly/model.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/model.py 2010-10-08 19:30:31 UTC (rev 4377)
+++ mgmt/trunk/wooly/python/wooly/model.py 2010-10-08 19:33:55 UTC (rev 4378)
@@ -1,300 +0,0 @@
-from new import instancemethod
-from threading import RLock
-
-class Model(object):
- def __init__(self):
- self.indexes = dict()
- self.mclasses = dict()
- self.__lock = RLock();
-
- def get_index(self, cls):
- return self.indexes.setdefault(cls, dict())
-
- def lock(self):
- self.__lock.acquire()
-
- def unlock(self):
- self.__lock.release()
-
- def get_object(self, mclass, id):
- self.get_index(mclass).get(id)
-
-class ModelClass(object):
- def __init__(self, model, name):
- self.model = model
- self.name = name
- self.endpoints = set()
-
-class ModelAssociation(object):
- def __init__(self, model, name):
- self.model = model
- self.name = name
- self.endpoints = set()
-
- def add_endpoint(self, mclass, name, multiplicity):
- if not isinstance(mclass, ModelClass):
- raise TypeError()
-
- if multiplicity not in ("0..1", "0..n"):
- raise Exception("Multiplicity not recognized")
-
- if len(self.endpoints) > 1:
- raise Exception("Too many endpoints")
-
- endpoint = self.Endpoint()
- endpoint.name = name
- endpoint.multiplicity = multiplicity
-
- self.endpoints.add(endpoint)
- endpoint.association = self
-
- mclass.endpoints.add(endpoint)
- endpoint.mclass = mclass
-
- return endpoint
-
- class Endpoint(object):
- def __init__(self):
- self.association = None
- self.mclass = None
-
- self.name = None
- self.multiplicity = None
-
- def other(self):
- for end in self.association.endpoints:
- if end is not self:
- return end
-
- def is_scalar(self):
- return self.multiplicity == "0..1"
-
- def set_scalar(self, this, that):
- this.__dict__[self.name] = that
-
- def get_scalar(self, this):
- return this.__dict__[self.name]
-
- def items(self, this):
- return this.__dict__[self.name + "_set"]
-
- def add(self, this, that):
- if self.is_scalar():
- self.set_scalar(this, that)
- else:
- self.items(this).add(that)
-
- def remove(self, this, that):
- if self.is_scalar():
- self.set_scalar(this, None)
- else:
- self.items(this).remove(that)
-
- def object_items(self, this):
- return self.items(this)
-
- def add_object(self, this, that):
- this.lock()
- try:
- self.add(this, that)
-
- that.lock()
- try:
- self.other().add(that, this)
- finally:
- that.unlock()
- finally:
- this.unlock()
-
- def remove_object(self, this, that):
- this.lock()
- try:
- self.remove(this, that)
-
- that.lock()
- try:
- self.other().remove(that, this)
- finally:
- that.unlock()
- finally:
- this.unlock()
-
- def get_object(self, this):
- return self.get_scalar(this)
-
- def set_object(self, this, new_that):
- this.lock()
- try:
- old_that = self.get_scalar(this)
-
- if old_that != None:
- old_that.lock()
- try:
- self.other().remove(old_that, this)
- finally:
- old_that.unlock()
-
- self.set_scalar(this, new_that)
-
- if new_that != None:
- new_that.lock()
- try:
- self.other().add(new_that, this)
- finally:
- new_that.unlock()
- finally:
- this.unlock()
-
-class ModelObject(object):
- sequence = 100
-
- def __init__(self, model, mclass):
- self.model = model
- self.mclass = mclass
- self.__lock = RLock()
-
- for end in self.mclass.endpoints:
- if end.is_scalar():
- self.add_scalar_attributes(end)
- else:
- self.add_set_attributes(end)
-
- self.lock()
- try:
- self.__class__.sequence += 1
- self.id = self.__class__.sequence
- model.get_index(self.mclass)[self.id] = self
- finally:
- self.unlock()
-
- def lock(self):
- self.__lock.acquire()
-
- def unlock(self):
- self.__lock.release()
-
- def setmethod(self, name, func):
- if not hasattr(self, name):
- method = instancemethod(func, self, self.__class__)
- setattr(self, name, method)
-
- def add_set_attributes(this, end):
- setattr(this, end.name + "_set", set())
-
- def items_method(self): return end.object_items(this)
- this.setmethod(end.name + "_items", items_method)
-
- def do_add_method(self, that):
- if that == None:
- raise Exception()
-
- end.add_object(this, that)
-
- this.setmethod("do_add_" + end.name, do_add_method)
-
- def add_method(self, that): do_add_method(self, that)
- this.setmethod("add_" + end.name, add_method)
-
- def do_remove_method(self, that):
- if that == None:
- raise Exception()
-
- end.remove_object(this, that)
-
- this.setmethod("do_remove_" + end.name, do_remove_method)
-
- def remove_method(self, that): do_remove_method(self, that)
- this.setmethod("remove_" + end.name, remove_method)
-
- def add_scalar_attributes(this, end):
- end.set_scalar(this, None)
-
- def get_method(self): return end.get_object(this)
- this.setmethod("get_" + end.name, get_method)
-
- def set_method(self, that): end.set_object(this, that)
- this.setmethod("set_" + end.name, set_method)
-
- # Note that this doesn't go through the add_someobject methods
- def remove(self):
- self.lock()
- try:
- for end in self.mclass.endpoints:
- this = self
-
- if end.is_scalar():
- end.set_object(this, None)
- else:
- for that in end.items(this).copy():
- end.remove_object(this, that)
-
- del self.model.get_index(self.mclass)[self.id]
- finally:
- self.unlock()
-
- def __str__(self):
- return self.__class__.__name__ + "(" + str(self.id) + ")"
-
-class TestModel(Model):
- def __init__(self):
- super(TestModel, self).__init__()
-
- self.order = ModelClass(self, self.Order)
- self.item = ModelClass(self, self.Item)
-
- self.assoc = ModelAssociation(self, "order_item")
- self.assoc.add_endpoint(self.order, "item", "0..n")
- self.assoc.add_endpoint(self.item, "order", "0..1")
-
- class Order(ModelObject):
- def __init__(self, model):
- super(TestModel.Order, self).__init__(model, model.order)
-
- class Item(ModelObject):
- def __init__(self, model):
- super(TestModel.Item, self).__init__(model, model.item)
-
- def test(self):
- def results(heading):
- print heading
- for item in order.item_set:
- print " item", item, "item.order", item.order
-
- item0 = self.Item(self)
- item1 = self.Item(self)
- item2 = self.Item(self)
-
- order = self.Order(self)
-
- order.add_item(item0)
- order.add_item(item1)
- order.add_item(item2)
-
- results("beginning state")
-
- order.remove_item(item0)
-
- results("remove item0 from order.items")
-
- item1.set_order(order)
-
- results("remove order from item1.order")
-
- order.add_item(item1)
-
- results("a")
-
- item1.set_order(None)
-
- results("b")
-
- item1.set_order(order)
-
- results("c")
-
- item1.remove()
-
- results("d")
-
-if __name__ == "__main__":
- TestModel().test()
14 years, 2 months
rhmessaging commits: r4377 - in mgmt/trunk: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 15:30:31 -0400 (Fri, 08 Oct 2010)
New Revision: 4377
Modified:
mgmt/trunk/Makefile
mgmt/trunk/wooly/Makefile
Log:
Add wooly to the top-level make clean
Modified: mgmt/trunk/Makefile
===================================================================
--- mgmt/trunk/Makefile 2010-10-08 15:43:19 UTC (rev 4376)
+++ mgmt/trunk/Makefile 2010-10-08 19:30:31 UTC (rev 4377)
@@ -22,6 +22,7 @@
clean:
$(MAKE) clean -C parsley
+ $(MAKE) clean -C wooly
$(MAKE) clean -C rosemary
$(MAKE) clean -C mint
$(MAKE) clean -C cumin
Modified: mgmt/trunk/wooly/Makefile
===================================================================
--- mgmt/trunk/wooly/Makefile 2010-10-08 15:43:19 UTC (rev 4376)
+++ mgmt/trunk/wooly/Makefile 2010-10-08 19:30:31 UTC (rev 4377)
@@ -1,4 +1,4 @@
-.PHONY: build install
+.PHONY: build install clean
include ../etc/Makefile.common
@@ -19,3 +19,5 @@
install -pm 0644 LICENSE* COPYING* ${doc}
install -d ${share}/resources
install -pm 0644 resources/* ${share}/resources
+
+clean: clean-python-files
14 years, 2 months
rhmessaging commits: r4376 - mgmt/trunk/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 11:43:19 -0400 (Fri, 08 Oct 2010)
New Revision: 4376
Modified:
mgmt/trunk/cumin/bin/cumin-database
Log:
In the install process, always restart the database after configuration
Modified: mgmt/trunk/cumin/bin/cumin-database
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database 2010-10-08 15:27:58 UTC (rev 4375)
+++ mgmt/trunk/cumin/bin/cumin-database 2010-10-08 15:43:19 UTC (rev 4376)
@@ -123,7 +123,10 @@
check-initialized &> /dev/null || initialize
- check-configured &> /dev/null || configure
+ check-configured &> /dev/null || {
+ configure
+ restart > /dev/null
+ }
check-started &> /dev/null || start > /dev/null
@@ -144,6 +147,13 @@
/sbin/service postgresql stop
}
+function restart {
+ check-environment || exit 1
+ check-initialized || exit 1
+
+ /sbin/service postgresql restart
+}
+
function initialize {
check-environment || exit 1
14 years, 2 months
rhmessaging commits: r4375 - mgmt/trunk/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: tmckay
Date: 2010-10-08 11:27:58 -0400 (Fri, 08 Oct 2010)
New Revision: 4375
Modified:
mgmt/trunk/cumin/bin/cumin-database
Log:
Tweaks to the script, functionality is essentially unchanged.
Modified: mgmt/trunk/cumin/bin/cumin-database
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database 2010-10-08 14:40:01 UTC (rev 4374)
+++ mgmt/trunk/cumin/bin/cumin-database 2010-10-08 15:27:58 UTC (rev 4375)
@@ -163,18 +163,18 @@
# Try initdb first, and if it fails try start followed by stop. This
# should leave the database and the service in the same state on all
# 8.x versions of Postgres.
- set +e
echo -e "\nAttempting to use initdb option..."
- run "/sbin/service postgresql initdb"
- if [ $? -ne 0 ]; then
+ run "/sbin/service postgresql initdb" || {
echo -e "\ninitdb option not supported, using start..."
run "/sbin/service postgresql start"
run "/sbin/service postgresql stop"
- fi
+ }
# now check again, to make sure one of the two methods worked
- check-initialized &> /dev/null || { echo "Database initialization failed."; exit 1; }
- set -e
+ check-initialized &> /dev/null || {
+ echo "Error: Database initialization failed."
+ exit 1
+ }
}
function configure {
14 years, 2 months
rhmessaging commits: r4374 - in mgmt/trunk: etc and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 10:40:01 -0400 (Fri, 08 Oct 2010)
New Revision: 4374
Added:
mgmt/trunk/etc/devel.profile
Modified:
mgmt/trunk/
Log:
Set the topdir to ignore changes to the Profile symlink; add an etc/devel.profile symlink to maintain compatibility
Property changes on: mgmt/trunk
___________________________________________________________________
Name: svn:ignore
+ Profile
Added: mgmt/trunk/etc/devel.profile
===================================================================
--- mgmt/trunk/etc/devel.profile (rev 0)
+++ mgmt/trunk/etc/devel.profile 2010-10-08 14:40:01 UTC (rev 4374)
@@ -0,0 +1 @@
+link Profile.bash
\ No newline at end of file
Property changes on: mgmt/trunk/etc/devel.profile
___________________________________________________________________
Name: svn:special
+ *
14 years, 2 months
rhmessaging commits: r4373 - in mgmt/trunk: etc and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-08 10:33:13 -0400 (Fri, 08 Oct 2010)
New Revision: 4373
Added:
mgmt/trunk/Profile
mgmt/trunk/etc/Profile.bash
mgmt/trunk/etc/Profile.tcsh
mgmt/trunk/etc/Profile.zsh
Removed:
mgmt/trunk/etc/devel.profile
mgmt/trunk/etc/devel.profile.tcsh
mgmt/trunk/etc/devel.profile.zsh
Log:
Rename devel env profile script to Profile, and link to it from the top directory
Added: mgmt/trunk/Profile
===================================================================
--- mgmt/trunk/Profile (rev 0)
+++ mgmt/trunk/Profile 2010-10-08 14:33:13 UTC (rev 4373)
@@ -0,0 +1 @@
+link etc/Profile.bash
\ No newline at end of file
Property changes on: mgmt/trunk/Profile
___________________________________________________________________
Name: svn:special
+ *
Copied: mgmt/trunk/etc/Profile.bash (from rev 4372, mgmt/trunk/etc/devel.profile)
===================================================================
--- mgmt/trunk/etc/Profile.bash (rev 0)
+++ mgmt/trunk/etc/Profile.bash 2010-10-08 14:33:13 UTC (rev 4373)
@@ -0,0 +1,28 @@
+export DEVEL_HOME="$PWD"
+export DEVEL_MODULES="mint cumin basil parsley wooly rosemary"
+
+if [[ -z "$DEVEL_ORIGINAL_PATH" ]]; then
+ export DEVEL_ORIGINAL_PATH="$PATH"
+fi
+
+export PATH="${DEVEL_HOME}/bin:${DEVEL_ORIGINAL_PATH}"
+
+if [[ -z "$DEVEL_ORIGINAL_PYTHONPATH" ]]; then
+ export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
+fi
+
+export PYTHONPATH="${DEVEL_HOME}/lib/python:${HOME}/lib/python:${DEVEL_ORIGINAL_PYTHONPATH}"
+
+for module in $DEVEL_MODULES; do
+ echo "Configuring module '${module}'"
+
+ pushd "${DEVEL_HOME}/${module}" > /dev/null
+
+ if [[ -f "etc/module.profile" ]]; then
+ source "etc/module.profile"
+ else
+ source "../etc/module.profile"
+ fi
+
+ popd > /dev/null
+done
Copied: mgmt/trunk/etc/Profile.tcsh (from rev 4372, mgmt/trunk/etc/devel.profile.tcsh)
===================================================================
--- mgmt/trunk/etc/Profile.tcsh (rev 0)
+++ mgmt/trunk/etc/Profile.tcsh 2010-10-08 14:33:13 UTC (rev 4373)
@@ -0,0 +1,39 @@
+setenv DEVEL_HOME "$PWD"
+set DEVEL_MODULES=(mint cumin basil parsley wooly)
+
+# PYTHONPATH
+
+if ($?PYTHONPATH) then
+ if (! $?DEVEL_ORIGINAL_PYTHONPATH) then
+ setenv DEVEL_ORIGINAL_PYTHONPATH "$PYTHONPATH"
+ endif
+else
+ setenv DEVEL_ORIGINAL_PYTHONPATH
+endif
+
+set pypath="$DEVEL_HOME"/lib/python:"$HOME"/lib/python:"$DEVEL_ORIGINAL_PYTHONPATH"
+
+foreach module ($DEVEL_MODULES)
+ set pypath="$DEVEL_HOME"/"$module"/python:"$pypath"
+end
+
+setenv PYTHONPATH "$pypath"
+
+# PATH
+
+if (! $?DEVEL_ORIGINAL_PATH) then
+ setenv DEVEL_ORIGINAL_PATH "$PATH"
+endif
+
+set path="$DEVEL_HOME"/bin:"$DEVEL_ORIGINAL_PATH"
+
+foreach module ($DEVEL_MODULES)
+ set path="$DEVEL_HOME"/"$module"/bin:"$path"
+end
+
+setenv PATH "$path"
+
+# cumin test instance
+setenv CUMIN_HOME "$DEVEL_HOME"/cumin-test-0
+
+setenv INSTALL_PREFIX "$DEVEL_HOME"/install
Copied: mgmt/trunk/etc/Profile.zsh (from rev 4372, mgmt/trunk/etc/devel.profile.zsh)
===================================================================
--- mgmt/trunk/etc/Profile.zsh (rev 0)
+++ mgmt/trunk/etc/Profile.zsh 2010-10-08 14:33:13 UTC (rev 4373)
@@ -0,0 +1,33 @@
+export DEVEL_HOME="$PWD"
+export DEVEL_MODULES="mint cumin basil parsley wooly"
+
+# PYTHONPATH
+
+if [[ -z "$DEVEL_ORIGINAL_PYTHONPATH" ]] {
+ export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
+}
+
+pypath="$DEVEL_HOME/lib/python:$HOME/lib/python:$DEVEL_ORIGINAL_PYTHONPATH"
+
+foreach module in `echo $DEVEL_MODULES`
+ pypath="$DEVEL_HOME/$module/python:$pypath"
+end
+
+export PYTHONPATH="$pypath"
+
+# PATH
+
+if [[ -z "$DEVEL_ORIGINAL_PATH" ]] {
+ export DEVEL_ORIGINAL_PATH="$PATH"
+}
+
+path="$DEVEL_HOME/bin:$DEVEL_ORIGINAL_PATH"
+
+foreach module in `echo $DEVEL_MODULES`
+ path="$DEVEL_HOME/$module/bin:$path"
+end
+
+export PATH="$path"
+
+# cumin test instance
+export CUMIN_HOME="$DEVEL_HOME/cumin-test-0"
Deleted: mgmt/trunk/etc/devel.profile
===================================================================
--- mgmt/trunk/etc/devel.profile 2010-10-08 13:31:58 UTC (rev 4372)
+++ mgmt/trunk/etc/devel.profile 2010-10-08 14:33:13 UTC (rev 4373)
@@ -1,28 +0,0 @@
-export DEVEL_HOME="$PWD"
-export DEVEL_MODULES="mint cumin basil parsley wooly rosemary"
-
-if [[ -z "$DEVEL_ORIGINAL_PATH" ]]; then
- export DEVEL_ORIGINAL_PATH="$PATH"
-fi
-
-export PATH="${DEVEL_HOME}/bin:${DEVEL_ORIGINAL_PATH}"
-
-if [[ -z "$DEVEL_ORIGINAL_PYTHONPATH" ]]; then
- export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
-fi
-
-export PYTHONPATH="${DEVEL_HOME}/lib/python:${HOME}/lib/python:${DEVEL_ORIGINAL_PYTHONPATH}"
-
-for module in $DEVEL_MODULES; do
- echo "Configuring module '${module}'"
-
- pushd "${DEVEL_HOME}/${module}" > /dev/null
-
- if [[ -f "etc/module.profile" ]]; then
- source "etc/module.profile"
- else
- source "../etc/module.profile"
- fi
-
- popd > /dev/null
-done
Deleted: mgmt/trunk/etc/devel.profile.tcsh
===================================================================
--- mgmt/trunk/etc/devel.profile.tcsh 2010-10-08 13:31:58 UTC (rev 4372)
+++ mgmt/trunk/etc/devel.profile.tcsh 2010-10-08 14:33:13 UTC (rev 4373)
@@ -1,39 +0,0 @@
-setenv DEVEL_HOME "$PWD"
-set DEVEL_MODULES=(mint cumin basil parsley wooly)
-
-# PYTHONPATH
-
-if ($?PYTHONPATH) then
- if (! $?DEVEL_ORIGINAL_PYTHONPATH) then
- setenv DEVEL_ORIGINAL_PYTHONPATH "$PYTHONPATH"
- endif
-else
- setenv DEVEL_ORIGINAL_PYTHONPATH
-endif
-
-set pypath="$DEVEL_HOME"/lib/python:"$HOME"/lib/python:"$DEVEL_ORIGINAL_PYTHONPATH"
-
-foreach module ($DEVEL_MODULES)
- set pypath="$DEVEL_HOME"/"$module"/python:"$pypath"
-end
-
-setenv PYTHONPATH "$pypath"
-
-# PATH
-
-if (! $?DEVEL_ORIGINAL_PATH) then
- setenv DEVEL_ORIGINAL_PATH "$PATH"
-endif
-
-set path="$DEVEL_HOME"/bin:"$DEVEL_ORIGINAL_PATH"
-
-foreach module ($DEVEL_MODULES)
- set path="$DEVEL_HOME"/"$module"/bin:"$path"
-end
-
-setenv PATH "$path"
-
-# cumin test instance
-setenv CUMIN_HOME "$DEVEL_HOME"/cumin-test-0
-
-setenv INSTALL_PREFIX "$DEVEL_HOME"/install
Deleted: mgmt/trunk/etc/devel.profile.zsh
===================================================================
--- mgmt/trunk/etc/devel.profile.zsh 2010-10-08 13:31:58 UTC (rev 4372)
+++ mgmt/trunk/etc/devel.profile.zsh 2010-10-08 14:33:13 UTC (rev 4373)
@@ -1,33 +0,0 @@
-export DEVEL_HOME="$PWD"
-export DEVEL_MODULES="mint cumin basil parsley wooly"
-
-# PYTHONPATH
-
-if [[ -z "$DEVEL_ORIGINAL_PYTHONPATH" ]] {
- export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
-}
-
-pypath="$DEVEL_HOME/lib/python:$HOME/lib/python:$DEVEL_ORIGINAL_PYTHONPATH"
-
-foreach module in `echo $DEVEL_MODULES`
- pypath="$DEVEL_HOME/$module/python:$pypath"
-end
-
-export PYTHONPATH="$pypath"
-
-# PATH
-
-if [[ -z "$DEVEL_ORIGINAL_PATH" ]] {
- export DEVEL_ORIGINAL_PATH="$PATH"
-}
-
-path="$DEVEL_HOME/bin:$DEVEL_ORIGINAL_PATH"
-
-foreach module in `echo $DEVEL_MODULES`
- path="$DEVEL_HOME/$module/bin:$path"
-end
-
-export PATH="$path"
-
-# cumin test instance
-export CUMIN_HOME="$DEVEL_HOME/cumin-test-0"
14 years, 2 months
rhmessaging commits: r4372 - mgmt/trunk/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: tmckay
Date: 2010-10-08 09:31:58 -0400 (Fri, 08 Oct 2010)
New Revision: 4372
Modified:
mgmt/trunk/cumin/bin/cumin-database
Log:
Modify the install function to use the postgresql service interface to initialize the database. The interface changed between PostgreSQL 8.3 and 8.4; support both.
Modified: mgmt/trunk/cumin/bin/cumin-database
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database 2010-10-08 02:40:04 UTC (rev 4371)
+++ mgmt/trunk/cumin/bin/cumin-database 2010-10-08 13:31:58 UTC (rev 4372)
@@ -158,11 +158,23 @@
exit 1
fi
- run "initdb --pgdata='$pgdata' --auth='ident sameuser'" postgres
- run "mkdir '$pglog'" postgres
- run "chmod 700 '$pglog'" postgres
+ # On older versions of Postgres (before 8.4), initdb does not exist but
+ # using the start option will initialize the database, then start it.
+ # Try initdb first, and if it fails try start followed by stop. This
+ # should leave the database and the service in the same state on all
+ # 8.x versions of Postgres.
+ set +e
+ echo -e "\nAttempting to use initdb option..."
+ run "/sbin/service postgresql initdb"
+ if [ $? -ne 0 ]; then
+ echo -e "\ninitdb option not supported, using start..."
+ run "/sbin/service postgresql start"
+ run "/sbin/service postgresql stop"
+ fi
- /sbin/restorecon -R "$pgdata"
+ # now check again, to make sure one of the two methods worked
+ check-initialized &> /dev/null || { echo "Database initialization failed."; exit 1; }
+ set -e
}
function configure {
14 years, 2 months
rhmessaging commits: r4370 - store/trunk/cpp/tests/jrnl/jtt.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-10-06 15:29:36 -0400 (Wed, 06 Oct 2010)
New Revision: 4370
Modified:
store/trunk/cpp/tests/jrnl/jtt/Makefile.am
Log:
Added missing (but empty) TESTS macro in jtt Makefile.am, which prevented the jtt check-long from working
Modified: store/trunk/cpp/tests/jrnl/jtt/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2010-10-01 20:19:19 UTC (rev 4369)
+++ store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2010-10-06 19:29:36 UTC (rev 4370)
@@ -40,6 +40,8 @@
.valgrind.supp: $(top_srcdir)/tests/.valgrind.supp
cp $^ .
+TESTS =
+
LONG_TESTS = \
_ut_data_src \
_ut_long_data_src \
14 years, 2 months
rhmessaging commits: r4369 - mgmt/newdata/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-10-01 16:19:19 -0400 (Fri, 01 Oct 2010)
New Revision: 4369
Modified:
mgmt/newdata/cumin/python/cumin/messaging/broker.py
mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
mgmt/newdata/cumin/python/cumin/messaging/main.py
Log:
Hide broker group functionality, since it's not functional
Modified: mgmt/newdata/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/broker.py 2010-10-01 20:09:05 UTC (rev 4368)
+++ mgmt/newdata/cumin/python/cumin/messaging/broker.py 2010-10-01 20:19:19 UTC (rev 4369)
@@ -55,7 +55,7 @@
return sql_options
class BrokerSelector(ObjectSelector):
- def __init__(self, app, name, data):
+ def __init__(self, app, name):
# Actually a vhost selector, as it happens
vhost = app.model.org_apache_qpid_broker.Vhost
@@ -136,7 +136,7 @@
self.exchange_add = ExchangeAdd(app, self)
self.brokerlink_add = BrokerLinkAdd(app, self)
self.move_messages = MoveMessages(app, self)
- self.engroup = BrokerEngroup(app, self)
+ #self.engroup = BrokerEngroup(app, self)
def get_title(self, session):
return self.broker.get(session).name
@@ -223,8 +223,7 @@
self.group_tmpl = WidgetTemplate(self, "group_html")
- data = BrokerData(app)
- self.brokers = BrokerSelector(app, "brokers", data)
+ self.brokers = BrokerSelector(app, "brokers")
self.add_child(self.brokers)
def render_title(self, session, *args):
Modified: mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py 2010-10-01 20:09:05 UTC (rev 4368)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py 2010-10-01 20:19:19 UTC (rev 4369)
@@ -79,8 +79,7 @@
super(BrokerGroupFrame, self).__init__(app, name, cls)
- data = BrokerData(app)
- brokers = BrokerSelector(app, "brokers", data)
+ brokers = BrokerSelector(app, "brokers")
brokers.group = self.object
self.view.add_tab(brokers)
Modified: mgmt/newdata/cumin/python/cumin/messaging/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/main.py 2010-10-01 20:09:05 UTC (rev 4368)
+++ mgmt/newdata/cumin/python/cumin/messaging/main.py 2010-10-01 20:19:19 UTC (rev 4369)
@@ -61,8 +61,7 @@
self.tabs = TabbedModeSet(app, "tabs")
self.add_child(self.tabs)
- self.tabs.add_tab(BrokerBrowser(app, "brokers"))
- self.tabs.add_tab(BrokerGroupSelector(app, "brokergroups"))
+ self.tabs.add_tab(BrokerSelector(app, "brokers"))
class Heading(CuminHeading):
def render_title(self, session):
14 years, 2 months