app/soc/logic/lists.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 19 Feb 2009 21:10:09 +0000
changeset 1402 e699ea116b32
parent 1308 35b75ffcbb37
child 1458 ec06d3ee73e4
permissions -rw-r--r--
Added OSI approved licenses Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
1308
35b75ffcbb37 Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
     3
# Copyright 2008 the Melange authors.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    17
"""List generation logic.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
class Lists(object):
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    26
  """List array suitable for enumerating over with just 'for in'.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
  """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
  DEF_PASSTHROUGH_FIELDS = [
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
      'pagination',
572
1b3e7280743a Made list pagination part of Lists
Sverre Rabbelier <srabbelier@gmail.com>
parents: 560
diff changeset
    31
      'pagination_form',
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
      'description',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
      'heading',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
      'row',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
      'limit',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
      'newest',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
      'prev',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
      'next',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
      'first',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
      'last',
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
      ]
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
  def __init__(self, contents):
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    44
    """Constructs a new Lists object with the specified contents.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
    # All the contents of all the lists
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    48
    self._contents = contents
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    49
    self._content = {}
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
    # For iterating over all the lists
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    52
    self._lists = range(len(contents))
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    53
    self._list_data = []
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
    # For iterating over the rows
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    56
    self._rows = []
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    57
    self._row_data = []
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    58
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
  def __getattr__(self, attr):
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    60
    """Delegate field lookup to the current list if appropriate.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
    If, and only if, a lookup is done on one of the fields defined in
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
    DEF_PASSTHROUGH_FIELDS, and the current list defines this field,
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
    the value from the current list is returned.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    66
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
    if attr not in self.DEF_PASSTHROUGH_FIELDS:
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
      raise AttributeError()
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    69
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    70
    if attr not in self._content:
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
      raise AttributeError()
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
    return self.get(attr)
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
  def get(self, item):
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    76
    """Returns the item for the current list data.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    79
    return self._content[item]
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    81
  def nextList(self):
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    82
    """Shifts out the current list content.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
    The main content of the next list is returned for further processing.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    85
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    87
    # Advance the list data once
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    88
    self._content = self._contents[0]
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    89
    self._contents = self._contents[1:]
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
    # Update internal 'iterators'
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    92
    self._list_data = self.get('data')
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    93
    self._rows = range(len(self._list_data))
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
    return self.get('main')
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    96
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    97
  def nextRow(self):
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
    98
    """Returns the next list row for the current list.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   100
    Before calling this method, nextList should be called at least once.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   103
    # Update internal 'iterators'
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   104
    self._row_data =  self._list_data[0]
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
    # Advance the row data once
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   107
    self._list_data = self._list_data[1:]
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   108
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   109
    return self.get('row')
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
  def lists(self):
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
    """Returns a list of numbers the size of the amount of lists.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   114
    This method can be used to iterate over all lists with shift,
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   115
    without using a while loop.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   116
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   117
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   118
    return self._lists
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   120
  def rows(self):
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
    """Returns a list of numbers the size of the amount of items.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   122
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   123
    This method can be used to iterate over all items with next for
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   124
    the current list, without using a while loop.
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   125
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   127
    return self._rows
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   128
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   129
  def item(self):
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   130
    """Returns the current row item for the current list.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   132
    Before calling this method, nextRow should be called at least once.
539
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   133
    """
e30462354e26 Allow for multiple list objects
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   134
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   135
    return self._row_data
553
c0cc20b4afc9 Make redirect generic using the new Lists object
Sverre Rabbelier <srabbelier@gmail.com>
parents: 539
diff changeset
   136
c0cc20b4afc9 Make redirect generic using the new Lists object
Sverre Rabbelier <srabbelier@gmail.com>
parents: 539
diff changeset
   137
  def redirect(self):
c0cc20b4afc9 Make redirect generic using the new Lists object
Sverre Rabbelier <srabbelier@gmail.com>
parents: 539
diff changeset
   138
    """Returns the redirect for the current row item in the current list.
c0cc20b4afc9 Make redirect generic using the new Lists object
Sverre Rabbelier <srabbelier@gmail.com>
parents: 539
diff changeset
   139
    """
c0cc20b4afc9 Make redirect generic using the new Lists object
Sverre Rabbelier <srabbelier@gmail.com>
parents: 539
diff changeset
   140
560
a32be584ee04 Requests are almost working now
Sverre Rabbelier <srabbelier@gmail.com>
parents: 553
diff changeset
   141
    action, args = self.get('action')
625
ec867361b5ba Add missing dots in soc.logic.lists module. Change method names to comply with Style Guide. Make class variable protected by adding "_" to the name of variable. Update lists templates respectively (methods name change).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 572
diff changeset
   142
    return action(self._row_data, args)