[CalendarServer-changes] [8657] CalendarServer/branches/users/glyph/table-alias
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 13 10:03:43 PST 2012
Revision: 8657
http://trac.macosforge.org/projects/calendarserver/changeset/8657
Author: glyph at apple.com
Date: 2012-02-13 10:03:43 -0800 (Mon, 13 Feb 2012)
Log Message:
-----------
rename .aliases() -> .columnAliases(), to avoid confusion (as much as possible, anyway) with .alias().
Modified Paths:
--------------
CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/syntax.py
CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py
CalendarServer/branches/users/glyph/table-alias/txdav/common/datastore/sql_tables.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/table-alias/
Modified: CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/syntax.py
===================================================================
--- CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/syntax.py 2012-02-13 18:03:40 UTC (rev 8656)
+++ CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/syntax.py 2012-02-13 18:03:43 UTC (rev 8657)
@@ -514,8 +514,15 @@
return [self]
- def aliases(self):
+ def columnAliases(self):
"""
+ Inspect the Python aliases for this table in the given schema. Python
+ aliases for a table are created by setting an attribute on the schema.
+ For example, in a schema which had "schema.MYTABLE.ID =
+ schema.MYTABLE.MYTABLE_ID" applied to it,
+ schema.MYTABLE.columnAliases() would return C{[("ID",
+ schema.MYTABLE.MYTABLE_ID)]}.
+
@return: a list of 2-tuples of (alias (C{str}), column
(C{ColumnSyntax})), enumerating all of the Python aliases provided.
"""
Modified: CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py 2012-02-13 18:03:40 UTC (rev 8656)
+++ CalendarServer/branches/users/glyph/table-alias/twext/enterprise/dal/test/test_sqlsyntax.py 2012-02-13 18:03:43 UTC (rev 8657)
@@ -386,14 +386,14 @@
"""
When attributes are set on a L{TableSyntax}, they will be remembered as
column aliases, and their alias names may be retrieved via the
- L{TableSyntax.aliases} method.
+ L{TableSyntax.columnAliases} method.
"""
- self.assertEquals(self.schema.FOO.aliases(), {})
+ self.assertEquals(self.schema.FOO.columnAliases(), {})
self.schema.FOO.ALIAS = self.schema.FOO.BAR
# you comparing ColumnSyntax object results in a ColumnComparison, which
# you can't test for truth.
fixedForEquality = dict([(k, v.model) for k, v in
- self.schema.FOO.aliases().items()])
+ self.schema.FOO.columnAliases().items()])
self.assertEquals(fixedForEquality,
{'ALIAS': self.schema.FOO.BAR.model})
self.assertIdentical(self.schema.FOO.ALIAS.model,
Modified: CalendarServer/branches/users/glyph/table-alias/txdav/common/datastore/sql_tables.py
===================================================================
--- CalendarServer/branches/users/glyph/table-alias/txdav/common/datastore/sql_tables.py 2012-02-13 18:03:40 UTC (rev 8656)
+++ CalendarServer/branches/users/glyph/table-alias/txdav/common/datastore/sql_tables.py 2012-02-13 18:03:43 UTC (rev 8657)
@@ -118,7 +118,7 @@
result['sequence'] = schema.model.sequenceNamed('REVISION_SEQ').name
for columnSyntax in tableSyntax:
result['column_' + columnSyntax.model.name] = columnSyntax.model.name
- for alias, realColumnSyntax in tableSyntax.aliases().items():
+ for alias, realColumnSyntax in tableSyntax.columnAliases().items():
result['column_' + alias] = realColumnSyntax.model.name
return result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120213/c08bac7c/attachment-0001.html>
More information about the calendarserver-changes
mailing list