@@ -1835,8 +1835,31 @@ def __init__(self, *args, **kwargs):
18351835 super (Template , self ).__init__ (* args , ** kwargs )
18361836 self .constraint_factory = constraints .TemplateConstraintFactory ()
18371837 self .title = ''
1838+ self .user_name = ''
18381839 self .view_types = []
18391840
1841+ def clone (self ):
1842+ """
1843+ Performs a deep clone
1844+ =====================
1845+
1846+ This method will produce a clone that is independent,
1847+ and can be altered without affecting the original,
1848+ but starts off with the exact same state as it.
1849+
1850+ The only shared elements should be the model
1851+ and the service, which are shared by all queries
1852+ that refer to the same webservice.
1853+
1854+ @return: same class as caller
1855+ """
1856+ newobj = super (Template , self ).clone ()
1857+ setattr (newobj , "user_name" , getattr (self , "user_name" ))
1858+ return newobj
1859+
1860+ def add_user_name (self , user_name ):
1861+ self .user_name = user_name
1862+
18401863 @classmethod
18411864 def from_xml (cls , xml , * args , ** kwargs ):
18421865 """
@@ -1914,7 +1937,7 @@ def to_query_params(self):
19141937
19151938 @rtype: dict
19161939 """
1917- p = {'name' : self .name }
1940+ p = {'name' : self .name , 'userName' : self . user_name }
19181941 i = 1
19191942 for c in self .editable_constraints :
19201943 if not c .switched_on :
@@ -1964,6 +1987,7 @@ def get_adjusted_template(self, con_values):
19641987 @rtype: L{Template}
19651988 """
19661989 clone = self .clone ()
1990+
19671991 for code , options in list (con_values .items ()):
19681992 con = clone .get_constraint (code )
19691993 if not con .editable :
@@ -2031,7 +2055,6 @@ def get_row_list(self, start=0, size=None, **con_values):
20312055 return super (Template , clone ).get_row_list (start , size )
20322056
20332057 def rows (self , start = 0 , size = None , ** con_values ):
2034- print ("basil2" )
20352058 """Get an iterator over the rows returned by this query"""
20362059 clone = self .get_adjusted_template (con_values )
20372060 return super (Template , clone ).rows (start , size )
0 commit comments